From: fweimer@redhat.com (Florian Weimer)
To: libc-alpha@sourceware.org
Subject: [PATCH] math.h: Warn about an already-defined log macro
Date: Mon, 04 Sep 2017 09:10:00 -0000 [thread overview]
Message-ID: <20170904090959.276DE439942E3@oldenburg.str.redhat.com> (raw)
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.
2017-09-04 Florian Weimer <fweimer@redhat.com>
* math/math.h: Issue warning if log is defined.
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. */
next reply other threads:[~2017-09-04 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-04 9:10 Florian Weimer [this message]
2017-09-04 15:45 ` Joseph Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170904090959.276DE439942E3@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).