mirror of git://sourceware.org/git/glibc.git
cdefs: Limit definition of fortification macros
Define the __glibc_fortify and other macros only when __FORTIFY_LEVEL >
0. This has the effect of not defining these macros on older C90
compilers that do not have support for variable length argument lists.
Also trim off the trailing backslashes from the definition of
__glibc_fortify and __glibc_fortify_n macros.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
(cherry picked from commit 2337e04e21)
This commit is contained in:
parent
6bcd5d8e36
commit
ae045ed16b
|
|
@ -152,6 +152,7 @@
|
||||||
# define __glibc_objsize(__o) __bos (__o)
|
# define __glibc_objsize(__o) __bos (__o)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __USE_FORTIFY_LEVEL > 0
|
||||||
/* Compile time conditions to choose between the regular, _chk and _chk_warn
|
/* Compile time conditions to choose between the regular, _chk and _chk_warn
|
||||||
variants. These conditions should get evaluated to constant and optimized
|
variants. These conditions should get evaluated to constant and optimized
|
||||||
away. */
|
away. */
|
||||||
|
|
@ -187,7 +188,7 @@
|
||||||
? __ ## f ## _alias (__VA_ARGS__) \
|
? __ ## f ## _alias (__VA_ARGS__) \
|
||||||
: (__glibc_unsafe_len (__l, __s, __osz) \
|
: (__glibc_unsafe_len (__l, __s, __osz) \
|
||||||
? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \
|
? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \
|
||||||
: __ ## f ## _chk (__VA_ARGS__, __osz))) \
|
: __ ## f ## _chk (__VA_ARGS__, __osz)))
|
||||||
|
|
||||||
/* Fortify function f, where object size argument passed to f is the number of
|
/* Fortify function f, where object size argument passed to f is the number of
|
||||||
elements and not total size. */
|
elements and not total size. */
|
||||||
|
|
@ -197,7 +198,8 @@
|
||||||
? __ ## f ## _alias (__VA_ARGS__) \
|
? __ ## f ## _alias (__VA_ARGS__) \
|
||||||
: (__glibc_unsafe_len (__l, __s, __osz) \
|
: (__glibc_unsafe_len (__l, __s, __osz) \
|
||||||
? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \
|
? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \
|
||||||
: __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \
|
: __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s))))
|
||||||
|
#endif
|
||||||
|
|
||||||
#if __GNUC_PREREQ (4,3)
|
#if __GNUC_PREREQ (4,3)
|
||||||
# define __warnattr(msg) __attribute__((__warning__ (msg)))
|
# define __warnattr(msg) __attribute__((__warning__ (msg)))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue