From a018052d410126f94c2602b208b099839d333b05 Mon Sep 17 00:00:00 2001 From: q66 Date: Fri, 15 Dec 2023 23:48:58 +0100 Subject: Rename some macros to be more namespace-friendly --- include/stdio.h | 86 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'include/stdio.h') diff --git a/include/stdio.h b/include/stdio.h index 59ae4ff..c6817fa 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -44,7 +44,7 @@ extern "C" { #undef fmemopen #undef popen -__access(read_only, 2) +__fh_access(read_only, 2) #if __has_builtin(__builtin_fdopen) __diagnose_as_builtin(__builtin_fdopen, 1, 2) #endif @@ -53,7 +53,7 @@ _FORTIFY_FN(fdopen) FILE *fdopen(int __f, const char* _FORTIFY_POS0 __m) return __orig_fdopen(__f, __m); } -__malloc(malloc (fclose, 1)) +__fh_malloc(malloc (fclose, 1)) #if __has_builtin(__builtin_fmemopen) __diagnose_as_builtin(__builtin_fmemopen, 1, 2, 3) #endif @@ -62,9 +62,9 @@ _FORTIFY_FN(fmemopen) FILE *fmemopen(void* _FORTIFY_POS0 __b, size_t __s, const return __orig_fmemopen(__b, __s, __m); } -__access(read_only, 1) -__access(read_only, 2) -__malloc(malloc (pclose, 1)) +__fh_access(read_only, 1) +__fh_access(read_only, 2) +__fh_malloc(malloc (pclose, 1)) #if __has_builtin(__builtin_popen) __diagnose_as_builtin(__builtin_popen, 1, 2) #endif @@ -75,22 +75,22 @@ _FORTIFY_FN(popen) FILE *popen(const char* _FORTIFY_POS0 __c, const char* _FORTI #endif /* _POSIX_SOURCE || _POSIX_C_SOURCE || _XOPEN_SOURCE || _GNU_SOURCE || _BSD_SOURCE */ -__access(write_only, 1, 2) +__fh_access(write_only, 1, 2) #if __has_builtin(__builtin_fgets) __diagnose_as_builtin(__builtin_fgets, 1, 2, 3) #endif _FORTIFY_FN(fgets) char *fgets(char * _FORTIFY_POS0 __s, int __n, FILE *__f) { - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if ((__fh_size_t)__n > __b) __builtin_trap(); return __orig_fgets(__s, __n, __f); } -__access(read_only, 1) -__access(read_only, 2) -__malloc(malloc (fclose, 1)) +__fh_access(read_only, 1) +__fh_access(read_only, 2) +__fh_malloc(malloc (fclose, 1)) #if __has_builtin(__builtin_fopen) __diagnose_as_builtin(__builtin_fopen, 1, 2) #endif @@ -99,14 +99,14 @@ _FORTIFY_FN(fopen) FILE *fopen(const char* _FORTIFY_POS0 __p, const char* _FORTI return __orig_fopen(__p, __m); } -__access(write_only, 1) +__fh_access(write_only, 1) #if __has_builtin(__builtin_fread) __diagnose_as_builtin(__builtin_fread, 1, 2, 3, 4) #endif _FORTIFY_FN(fread) size_t fread(void * _FORTIFY_POS0 __d, size_t __n, size_t __m, FILE *__f) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__bmo(__n, __m)) __builtin_trap(); @@ -115,14 +115,14 @@ _FORTIFY_FN(fread) size_t fread(void * _FORTIFY_POS0 __d, size_t __n, return __orig_fread(__d, __n, __m, __f); } -__access(read_only, 1) +__fh_access(read_only, 1) #if __has_builtin(__builtin_fwrite) __diagnose_as_builtin(__builtin_fwrite, 1, 2, 3, 4) #endif _FORTIFY_FN(fwrite) size_t fwrite(const void * _FORTIFY_POS0 __d, size_t __n, size_t __m, FILE *__f) { - __fh_size_t __b = __bos(__d, 0); + __fh_size_t __b = __fh_bos(__d, 0); if (__bmo(__n, __m)) __builtin_trap(); @@ -133,7 +133,7 @@ _FORTIFY_FN(fwrite) size_t fwrite(const void * _FORTIFY_POS0 __d, size_t __n, #ifndef __clang__ /* FIXME */ #undef tmpfile -__malloc(malloc (fclose, 1)) +__fh_malloc(malloc (fclose, 1)) #if __has_builtin(__builtin_tmpfile) __diagnose_as_builtin(__builtin_tmpfile) #endif @@ -143,9 +143,9 @@ _FORTIFY_FN(tmpfile) FILE *tmpfile(void) } #endif -__access(read_write, 1, 2) -__access(read_only, 3) -__format(printf, 3, 0) +__fh_access(read_write, 1, 2) +__fh_access(read_only, 3) +__fh_format(printf, 3, 0) #if __has_builtin(__builtin_vsnprintf) __diagnose_as_builtin(__builtin_vsnprintf, 1, 2, 3, 4) #endif @@ -153,9 +153,9 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, const char *__f, __builtin_va_list __v) { #if __has_builtin(__builtin___vsnprintf_chk) && USE_NATIVE_CHK - return __builtin___vsnprintf_chk(__s, __n, _FORTIFY_SOURCE, __bos(__s, 0), __f, __v); + return __builtin___vsnprintf_chk(__s, __n, _FORTIFY_SOURCE, __fh_bos(__s, 0), __f, __v); #else - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); @@ -163,9 +163,9 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, #endif } -__format(printf, 2, 0) -__access(read_write, 1) -__access(read_only, 2) +__fh_format(printf, 2, 0) +__fh_access(read_write, 1) +__fh_access(read_only, 2) #if __has_builtin(__builtin_vsprintf) __diagnose_as_builtin(__builtin_vsprintf, 1, 2, 3) #endif @@ -173,9 +173,9 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, __builtin_va_list __v) { #if __has_builtin(__builtin___vsprintf_chk) && USE_NATIVE_CHK - return __builtin___vsprintf_chk(__s, _FORTIFY_SOURCE, __bos(__s, 0), __f, __v); + return __builtin___vsprintf_chk(__s, _FORTIFY_SOURCE, __fh_bos(__s, 0), __f, __v); #else - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); int __r; if (__b != (__fh_size_t)-1) { @@ -193,8 +193,8 @@ _FORTIFY_FN(vsprintf) int vsprintf(char * _FORTIFY_POS0 __s, const char *__f, #undef vfprintf #undef vprintf -__access(read_only, 2) -__format(printf, 2, 0) +__fh_access(read_only, 2) +__fh_format(printf, 2, 0) #if __has_builtin(__builtin_vfprintf) __diagnose_as_builtin(__builtin_vfprintf, 2, 3) #endif @@ -207,8 +207,8 @@ _FORTIFY_FN(vfprintf) int vfprintf(FILE * __s, const char *__f, __builtin_va_lis #endif } -__access(read_only, 1) -__format(printf, 1, 0) +__fh_access(read_only, 1) +__fh_format(printf, 1, 0) #if __has_builtin(__builtin_vprintf) __diagnose_as_builtin(__builtin_vprintf, 1, 2) #endif @@ -248,16 +248,16 @@ _FORTIFY_FN(vprintf) int vprintf(const char *__f, __builtin_va_list __v) #undef printf #undef fprintf -__access(read_write, 1, 2) -__access(read_only, 3) -__format(printf, 3, 4) +__fh_access(read_write, 1, 2) +__fh_access(read_only, 3) +__fh_format(printf, 3, 4) _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, const char *__f, ...) { #if __has_builtin(__builtin___snprintf_chk) && USE_NATIVE_CHK - return __builtin___snprintf_chk(__s, __n, _FORTIFY_SOURCE, __bos(__s, 0), __f, __builtin_va_arg_pack()); + return __builtin___snprintf_chk(__s, __n, _FORTIFY_SOURCE, __fh_bos(__s, 0), __f, __builtin_va_arg_pack()); #else - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); if (__n > __b) __builtin_trap(); @@ -265,15 +265,15 @@ _FORTIFY_FN(snprintf) int snprintf(char *__s, size_t __n, #endif } -__format(printf, 2, 3) -__access(read_write, 1) -__access(read_only, 2) +__fh_format(printf, 2, 3) +__fh_access(read_write, 1) +__fh_access(read_only, 2) _FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...) { #if __has_builtin(__builtin___sprintf_chk) && USE_NATIVE_CHK - return __builtin___sprintf_chk(__s, _FORTIFY_SOURCE, __bos(__s, 0), __f, __builtin_va_arg_pack()); + return __builtin___sprintf_chk(__s, _FORTIFY_SOURCE, __fh_bos(__s, 0), __f, __builtin_va_arg_pack()); #else - __fh_size_t __b = __bos(__s, 0); + __fh_size_t __b = __fh_bos(__s, 0); int __r; if (__b != (__fh_size_t)-1) { @@ -287,8 +287,8 @@ _FORTIFY_FN(sprintf) int sprintf(char *__s, const char *__f, ...) #endif } -__format(printf, 1, 2) -__access(read_only, 1) +__fh_format(printf, 1, 2) +__fh_access(read_only, 1) _FORTIFY_FN(printf) int printf(const char *__f, ...) { #if __has_builtin(__builtin___printf_chk) && USE_NATIVE_CHK @@ -298,8 +298,8 @@ _FORTIFY_FN(printf) int printf(const char *__f, ...) #endif } -__access(read_only, 2) -__format(printf, 2, 0) +__fh_access(read_only, 2) +__fh_format(printf, 2, 0) #if __has_builtin(__builtin_fprintf) __diagnose_as_builtin(__builtin_fprintf, 2, 3) #endif -- cgit v1.3