diff options
author | Zack Weinberg <zackw@panix.com> | 2016-11-14 08:34:59 -0500 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2016-11-14 08:34:59 -0500 |
commit | 809b72df6c90303aa3622a28f2837ec6c518290d (patch) | |
tree | b3c7546831817355514ffd37d522acc43f6899b2 /misc/sys/cdefs.h | |
parent | 14f95a420313ee745b80fe71a0fe6f61b46b327c (diff) | |
download | glibc-809b72df6c90303aa3622a28f2837ec6c518290d.zip glibc-809b72df6c90303aa3622a28f2837ec6c518290d.tar.gz glibc-809b72df6c90303aa3622a28f2837ec6c518290d.tar.bz2 |
[BZ #19239] Issue deprecation warnings on macro expansion.
By using __glibc_macro_warning instead of __attribute_deprecated__,
we get the deprecation warnings whenever the macros are expanded,
not just when they compile to a function call. This is important
for unintentional uses like the test case in #19239 (C++ var(value)
initialization syntax, with a variable named "major"). It's also
simpler, because __REDIRECT is no longer required.
* misc/sys/sysmacros.h (__SYSMACROS_DM, __SYSMACROS_DM1): New macros.
(__SYSMACROS_DEPRECATION_MSG, __SYSMACROS_FST_DECL_TEMPL)
(__SYSMACROS_FST_IMPL_TEMPL): Delete.
(major, minor, makedev): Use __SYSMACROS_DM in definition, instead
of redirected function names.
* misc/sys/cdefs.h (__glibc_macro_warning): Activate for clang >= 3.5
as well. Document that MESSAGE must be a single string literal.
Diffstat (limited to 'misc/sys/cdefs.h')
-rw-r--r-- | misc/sys/cdefs.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 50e00e6..9298dd6 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -473,8 +473,11 @@ #endif /* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is - intended for use in preprocessor macros. */ -#if __GNUC_PREREQ (4,8) + intended for use in preprocessor macros. + + Note: MESSAGE must be a _single_ string; concatenation of string + literals is not supported. */ +#if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5) # define __glibc_macro_warning1(message) _Pragma (#message) # define __glibc_macro_warning(message) \ __glibc_macro_warning1 (GCC warning message) |