diff options
author | Florian Weimer <fweimer@redhat.com> | 2017-09-04 10:52:28 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-09-04 17:56:31 +0200 |
commit | b38042f51430974642616a60afbbf96fd0b98659 (patch) | |
tree | c729d45879af209b07ee0d3c30a4c83840f3540c | |
parent | 059b64046e2ca4e55d28a65ef7235da8eeb525ea (diff) | |
download | glibc-b38042f51430974642616a60afbbf96fd0b98659.tar glibc-b38042f51430974642616a60afbbf96fd0b98659.tar.gz glibc-b38042f51430974642616a60afbbf96fd0b98659.tar.bz2 glibc-b38042f51430974642616a60afbbf96fd0b98659.zip |
math.h: Warn about an already-defined log macro
This is a common programming error, and the cause of the problem is not
always obvious.
<tgmath.h> defines a log macro, but it includes <math.h> before that, so
that is compatible with the warning.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | math/math.h | 5 |
2 files changed, 9 insertions, 0 deletions
@@ -1,3 +1,7 @@ +2017-09-04 Florian Weimer <fweimer@redhat.com> + + * math/math.h: Issue warning if log is defined. + 2017-09-04 Joseph Myers <joseph@codesourcery.com> * scripts/build-many-glibcs.py (Context.checkout): Default Linux diff --git a/math/math.h b/math/math.h index 547b36d10e..6c2ad97fb8 100644 --- a/math/math.h +++ b/math/math.h @@ -26,6 +26,11 @@ #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION #include <bits/libc-header-start.h> +#if defined log && defined __GNUC__ +# warning A macro called log was already defined when <math.h> was included. +# warning This will cause compilation problems. +#endif + __BEGIN_DECLS /* Get definitions of __intmax_t and __uintmax_t. */ |