Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: David Edelsohn <dje.gcc@gmail.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: [pushed] Define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS again (Re: GDB AIX build broken)
Date: Tue, 25 Oct 2016 10:58:00 -0000	[thread overview]
Message-ID: <8fd35f0e-3a7e-25fb-f2ee-2fa50c35beff@redhat.com> (raw)
In-Reply-To: <ef5bde16-047e-f7c0-db55-7fa24a40a79c@redhat.com>

On 10/25/2016 02:22 AM, Pedro Alves wrote:
> On 10/25/2016 02:08 AM, David Edelsohn wrote:
>> On Mon, Oct 24, 2016 at 8:50 PM, Pedro Alves <palves@redhat.com> wrote:
>>> On 10/25/2016 01:31 AM, Pedro Alves wrote:
>>>> On 10/25/2016 01:13 AM, David Edelsohn wrote:
>>>>> On Mon, Oct 24, 2016 at 7:00 PM, Pedro Alves <palves@redhat.com> wrote:
>>>>>
>>>>>> That's a hint, but it can't be the fix.  common-defs.h must be the
>>>>>> first file included.  I suspect that gnulib's inttypes.h
>>>>>> replacement logic is broken on AIX.
>>>>>
>>>>> The gnulib import definitely is the commit that caused the breakage.
>>>
>>> Could it be it's the commit after the import?  The one
>>> that removes __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS from
>>> common-defs.h?
>>
>> common-defs.h needs __STDC_FORMAT_MACROS defined before stdio.h is
>> included, as one possible solution.
> 
> I'll do this tomorrow.

I've pushed the patch below to master.

From 28fe4f87e0b815f4c0d9b80e0a9f3e6a53c649b3 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Tue, 25 Oct 2016 11:47:18 +0100
Subject: [PATCH] Define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS again.

Revert commit f6abaf7a4088 (gdb: no longer define
__STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS), with the tweak suggested
in that commit's log: the macros are now defined before any system
header is included.

This should fix AIX:
  https://sourceware.org/ml/gdb-patches/2016-10/msg00682.html

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

       * common/common-defs.h (__STDC_CONSTANT_MACROS)
       (__STDC_LIMIT_MACROS): Define.
---
 gdb/ChangeLog            |  5 +++++
 gdb/common/common-defs.h | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5541086..40fab9b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-25  Pedro Alves  <palves@redhat.com>
+
+       * common/common-defs.h (__STDC_CONSTANT_MACROS)
+       (__STDC_LIMIT_MACROS): Define.
+
 2016-10-25  Yao Qi  <yao.qi@linaro.org>
 
 	PR gdb/20716
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 9b5d853..3d5ff18 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -27,6 +27,19 @@
 #include "build-gnulib/config.h"
 #endif
 
+/* 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.".
+
+   Must do this before including any system header, since system
+   headers may include stdint.h.  */
+#define __STDC_CONSTANT_MACROS 1
+#define __STDC_LIMIT_MACROS 1
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
-- 
2.5.5



  reply	other threads:[~2016-10-25 10:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 22:40 GDB AIX build broken David Edelsohn
2016-10-24 22:46 ` Pedro Alves
2016-10-24 22:53   ` David Edelsohn
2016-10-24 23:00     ` Pedro Alves
2016-10-25  0:13       ` David Edelsohn
2016-10-25  0:31         ` Pedro Alves
2016-10-25  0:50           ` Pedro Alves
2016-10-25  1:08             ` David Edelsohn
2016-10-25  1:22               ` Pedro Alves
2016-10-25 10:58                 ` Pedro Alves [this message]
2016-10-25 12:41                   ` [pushed] Define __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS again (Re: GDB AIX build broken) David Edelsohn
2016-10-25 12:48                     ` Pedro Alves
2016-10-25 12:54                       ` [pushed] common/common-defs.h: Define __STDC_FORMAT_MACROS as well " Pedro Alves
2016-10-25 13:01                         ` David Edelsohn
2016-10-25  0:51           ` GDB AIX build broken David Edelsohn
2016-10-25  1:10             ` Pedro Alves

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=8fd35f0e-3a7e-25fb-f2ee-2fa50c35beff@redhat.com \
    --to=palves@redhat.com \
    --cc=dje.gcc@gmail.com \
    --cc=gdb-patches@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