![Trutz Behn](/assets/img/avatar_default.png)
Newer compilers default to GNU11, a C11 dialect. Some software however is unprepared for this or has wrong compatibility checks. What happens is that some software will for compatibility with C89 #define inline before inclusion of a standard header, which is undefined behaviour in C99 and above (C99/C11 7.1.2/4), as inline is a keyword. If any libc headers that are then included via #include_next provide an __inline macro definition (current musl does this if C++ or C99 and above is detected) like the following #define __inline inline this results in any __inline token to be preprocessed away. This breaks use of __builtin_va_arg_pack() in our stdio.h at compile-time as it can only be used in always inlined functions. The function attributes __always_inline__ and __gnu_inline__ themselves require an inline specifier on the function to be applied.
25 lines
1.0 KiB
C
25 lines
1.0 KiB
C
/*
|
|
* Copyright (C) 2015 Dimitris Papastamos <sin@2f30.org>
|
|
*
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
* purpose with or without fee is hereby granted.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#ifndef _FORTIFY_HEADERS_H
|
|
#define _FORTIFY_HEADERS_H
|
|
|
|
#define _FORTIFY_STR(s) #s
|
|
#define _FORTIFY_ORIG(p,fn) __typeof__(fn) __orig_##fn __asm__(_FORTIFY_STR(p) #fn)
|
|
#define _FORTIFY_FN(fn) _FORTIFY_ORIG(__USER_LABEL_PREFIX__,fn); \
|
|
extern __inline__ __attribute__((__always_inline__,__gnu_inline__,__artificial__))
|
|
|
|
#endif
|