Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: palves@redhat.com (Pedro Alves)
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: Use std::max and std::min throughout
Date: Mon, 19 Sep 2016 11:47:00 -0000	[thread overview]
Message-ID: <20160919114724.A00EC10B7EF@oc8523832656.ibm.com> (raw)
In-Reply-To: <77416303-1ed7-fe71-7a52-1dbd1ca6aa56@redhat.com> from "Pedro Alves" at Sep 16, 2016 08:00:59 PM

Pedro Alves wrote:

> gdb/ChangeLog:
> 2016-09-16  Pedro Alves  <palves@redhat.com>
> 
> 	* defs.h (min, max): Delete.
> 	* aarch64-tdep.c: Include <algorithm> and use std::min and
> 	std::max throughout.

This causes build failures on many files on my SPU daily build.  This
may be related to the fact that I'm using --disable-nls and/or that I'm
building on RHEL 5 using a GCC 4.1 host compiler.

The symptom is:

/usr/include/libintl.h:40: error: expected unqualified-id before ‘const’
/usr/include/libintl.h:40: error: expected `)' before ‘const’
/usr/include/libintl.h:40: error: expected initializer before ‘const’
/usr/include/libintl.h:45: error: expected unqualified-id before ‘const’
/usr/include/libintl.h:45: error: expected `)' before ‘const’
/usr/include/libintl.h:45: error: expected initializer before ‘const’
/usr/include/libintl.h:52: error: expected unqualified-id before ‘const’
/usr/include/libintl.h:52: error: expected `)' before ‘const’
/usr/include/libintl.h:52: error: expected initializer before ‘const’
/usr/include/libintl.h:83: error: expected unqualified-id before ‘while’
/usr/include/libintl.h:83: error: expected initializer before ‘while’
/usr/include/libintl.h:87: error: expected unqualified-id before ‘while’
/usr/include/libintl.h:87: error: expected initializer before ‘while’

Line 40 in this header is originally:

extern char *gettext (__const char *__msgid)
     __THROW __attribute_format_arg__ (1);

but after preprocessing we get:

extern char *(__const char *__msgid)
     throw () __attribute__ ((__format_arg__ (1)));

which is obviously broken.

It seems the reason for this is a GDB header trick in common/gdb_locale.h:

#ifdef ENABLE_NLS
...
#else
# define gettext(Msgid) (Msgid)
...
#endif

This will obviously cause problems if the <libintl.h> header is included
at any point after "gdb_locale.h" (which is in turn included by "defs.h"
via "common-defs.h", and thus by any GDB file).

Apparently in the past this newer happened.  But after your change to
include <algorithm>, this is now triggered, since (at least the GCC 4.1
copy of) <algorihm> includes <libintl.h> via <bits/stl_algobase.h>,
<iosfwd>, and <bits/c++locale.h>.

Any thoughts how to fix this?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


  parent reply	other threads:[~2016-09-19 11:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15 16:52 Pedro Alves
2016-09-15 17:47 ` Simon Marchi
2016-09-16 19:01   ` Pedro Alves
2016-09-18 23:26     ` [pushed] gdb: Fix std::{min, max}-related build breakage on 32-bit hosts Pedro Alves
2016-09-18 23:37     ` [pushed] gdb/s390: Fix build breakage due to std::min/std::max usage without header Pedro Alves
2016-09-19 11:47     ` Ulrich Weigand [this message]
2016-09-19 13:36       ` [PATCH] gdb: Use std::max and std::min throughout Pedro Alves
2016-09-19 13:44         ` Pedro Alves
2016-09-19 14:02           ` Pedro Alves
2016-09-19 14:56         ` Ulrich Weigand
2016-09-19 15:23           ` Pedro Alves
2016-09-19 15:59             ` [pushed] gdb: Fix build breakage with GCC 4.1 and --disable-nls Pedro Alves
2016-09-19 16:18               ` Ulrich Weigand

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=20160919114724.A00EC10B7EF@oc8523832656.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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