This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pushed] common/common-defs.h: Define __STDC_FORMAT_MACROS as well (Re: GDB AIX build broken)


On 10/25/2016 01:48 PM, Pedro Alves wrote:
> On 10/25/2016 01:41 PM, David Edelsohn wrote:

>> Thanks, however...
>>
>> The missing macro is __STDC_FORMAT_MACROS.  The macros that you
>> re-added were not causing problems on AIX and don't enable the printf
>> format macros in C++.
> 
> Indeed, missed.  Will add that too shortly.

Done now.  Let me know how it goes.

>From b30f354acb39f63bf3213673a0584119e63538b9 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Tue, 25 Oct 2016 13:50:20 +0100
Subject: [PATCH] common/common-defs.h: Define __STDC_FORMAT_MACROS as well

Ref: https://sourceware.org/ml/gdb-patches/2016-10/msg00694.html

gdb/ChangeLog:
2016-10-25  Pedro Alves  <palves@redhat.com>

	* common/common-defs.h (__STDC_FORMAT_MACROS): Define.
---
 gdb/ChangeLog            |  4 ++++
 gdb/common/common-defs.h | 12 ++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c2a8579..1f58821 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2016-10-25  Pedro Alves  <palves@redhat.com>
 
+	* common/common-defs.h (__STDC_FORMAT_MACROS): Define.
+
+2016-10-25  Pedro Alves  <palves@redhat.com>
+
 	* common/new-op.c: Add comment about -fsanitize=address.
 
 2016-10-25  Pedro Alves  <palves@redhat.com>
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 3d5ff18..8fbb4bf 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -35,10 +35,18 @@
    macros such as INTMAX_C, and one must define __STDC_LIMIT_MACROS to
    make visible the definitions of limit macros such as INTMAX_MAX.".
 
-   Must do this before including any system header, since system
-   headers may include stdint.h.  */
+   And:
+    https://www.gnu.org/software/gnulib/manual/html_node/inttypes_002eh.html
+
+   "On some hosts that predate C++11, when using C++ one must define
+   __STDC_FORMAT_MACROS to make visible the declarations of format
+   macros such as PRIdMAX."
+
+   Must do this before including any system header, since other system
+   headers may include stdint.h/inttypes.h.  */
 #define __STDC_CONSTANT_MACROS 1
 #define __STDC_LIMIT_MACROS 1
+#define __STDC_FORMAT_MACROS 1
 
 #include <stdarg.h>
 #include <stdio.h>
-- 
2.5.5



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]