This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] gdb: no longer define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS
- From: Pedro Alves <palves at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 18 Oct 2016 22:17:34 -0000
- Subject: [binutils-gdb] gdb: no longer define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f6abaf7a4088dc9a5d73ee2233246347af9181d5
commit f6abaf7a4088dc9a5d73ee2233246347af9181d5
Author: Pedro Alves <palves@redhat.com>
Date: Tue Oct 18 20:48:37 2016 +0100
gdb: no longer define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS
My gnulib fix at:
https://lists.gnu.org/archive/html/bug-gnulib/2015-11/msg00010.html
was merged upstream meanwhile and our gnulib copy now includes it.
As a concidence, Kevin was telling me today that these macros are
causing a build problem on FreeBSD:
common/common-defs.h:47:0: error: "__STDC_CONSTANT_MACROS" redefined [-Werror]
#define __STDC_CONSTANT_MACROS 1
/usr/include/sys/cdefs.h:408:0: note: this is the location of the previous definition
#define __STDC_CONSTANT_MACROS
(and a similar error for __STDC_LIMIT_MACROS)
The problem seems to be that we should be defining these input macros
before including any system header, but, we're not.
So let's just revert e063da67902e ([C++] Define __STDC_CONSTANT_MACROS
/ __STDC_LIMIT_MACROS for stdint.h). If this causes a problem
somewhere, we can re-define the macros higher up in the file, before
system headers are included.
gdb/ChangeLog:
2016-10-18 Pedro Alves <palves@redhat.com>
* common/common-defs.h (__STDC_CONSTANT_MACROS)
(__STDC_LIMIT_MACROS): Delete.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/common/common-defs.h | 16 ----------------
2 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7dd1b32..80215df 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-10-18 Pedro Alves <palves@redhat.com>
+ * common/common-defs.h (__STDC_CONSTANT_MACROS)
+ (__STDC_LIMIT_MACROS): Delete.
+
+2016-10-18 Pedro Alves <palves@redhat.com>
+
* gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to
2692e23a48e21f6daa029e8af9f1a143b7532f47.
* gnulib/configure, gnulib/config.in, gnulib/aclocal.m4:
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 5426dd5..9b5d853 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -31,23 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
-
-/* From:
- https://www.gnu.org/software/gnulib/manual/html_node/stdint_002eh.html
-
- "On some hosts that predate C++11, when using C++ one must define
- __STDC_CONSTANT_MACROS to make visible the definitions of constant
- macros such as INTMAX_C, and one must define __STDC_LIMIT_MACROS to
- make visible the definitions of limit macros such as INTMAX_MAX."
-
- gnulib doesn't fix this for us correctly yet. See:
- https://lists.gnu.org/archive/html/bug-gnulib/2015-11/msg00004.html
-
- Meanwhile, explicitly define these ourselves, as C99 intended. */
-#define __STDC_CONSTANT_MACROS 1
-#define __STDC_LIMIT_MACROS 1
#include <stdint.h>
-
#include <string.h>
#ifdef HAVE_STRINGS_H
#include <strings.h> /* for strcasecmp and strncasecmp */