about summary refs log tree commit diff
path: root/math/math.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-09-04 10:52:28 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-09-04 17:56:31 +0200
commitb38042f51430974642616a60afbbf96fd0b98659 (patch)
treec729d45879af209b07ee0d3c30a4c83840f3540c /math/math.h
parent059b64046e2ca4e55d28a65ef7235da8eeb525ea (diff)
downloadglibc-b38042f51430974642616a60afbbf96fd0b98659.tar.gz
glibc-b38042f51430974642616a60afbbf96fd0b98659.tar.xz
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.
Diffstat (limited to 'math/math.h')
-rw-r--r--math/math.h5
1 files changed, 5 insertions, 0 deletions
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.  */