]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
math.h: Warn about an already-defined log macro
authorFlorian Weimer <fweimer@redhat.com>
Mon, 4 Sep 2017 08:52:28 +0000 (10:52 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 4 Sep 2017 15:56:31 +0000 (17:56 +0200)
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.

ChangeLog
math/math.h

index ef4a6edc5ea30dfc8a428e0536910e89ffcc053f..a9fb242bf26dea782f18a3f04f16be0caa059172 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 547b36d10ed9548422fdf2f425acb9b70a2d46f0..6c2ad97fb8e10a81c85c50bb0c3b2e99e55bbe86 100644 (file)
 #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.  */