Re: [C++ Patch] PR 50810

2011-11-02 Thread Paolo Carlini
On 11/02/2011 09:11 PM, Jason Merrill wrote: I'm checking in this variant of your patch; mostly it just adds -Wno-narrowing to the warning options used to build GCC, though there are a few wording tweaks as well. Tested x86_64-pc-linux-gnu, applying to trunk. Thanks! Paolo.

Re: [C++ Patch] PR 50810

2011-11-02 Thread Jason Merrill
I'm checking in this variant of your patch; mostly it just adds -Wno-narrowing to the warning options used to build GCC, though there are a few wording tweaks as well. Tested x86_64-pc-linux-gnu, applying to trunk. commit 6b5380306428a3e618027b3fc7a319ae2c520b35 Author: Jason Merrill Date: T

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Gabriel Dos Reis
On Mon, Oct 24, 2011 at 2:05 PM, Jason Merrill wrote: > On 10/24/2011 02:47 PM, Gabriel Dos Reis wrote: >> >> What about (testcase) >> >>      int f(char); >>      double f(...); >> >>      const int n = sizeof f({257}); >> >> ? > > The narrowing conversion would be marked as 'bad' and therefore t

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Jason Merrill
On 10/24/2011 02:47 PM, Gabriel Dos Reis wrote: What about (testcase) int f(char); double f(...); const int n = sizeof f({257}); ? The narrowing conversion would be marked as 'bad' and therefore the second overload chosen. As before, the objective is to only change the d

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Gabriel Dos Reis
On Mon, Oct 24, 2011 at 1:17 PM, Jason Merrill wrote: > On 10/24/2011 02:13 PM, Gabriel Dos Reis wrote: >> The problem is with C++11 codes.  There is no reason for them to be >> subjected >> to the inconsistency, especially for codes in header files that are >> upgraded (beyond control of the end

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Jason Merrill
On 10/24/2011 02:13 PM, Gabriel Dos Reis wrote: yes, but how does the compiler distinguish a "legacy code" compiled under C++11 from non-legacy C++11 code? It doesn't. The problem is with C++11 codes. There is no reason for them to be subjected to the inconsistency, especially for codes in h

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Gabriel Dos Reis
On Mon, Oct 24, 2011 at 12:46 PM, Jason Merrill wrote: > On 10/24/2011 01:21 PM, Gabriel Dos Reis wrote: >> >> On Mon, Oct 24, 2011 at 9:53 AM, Jason Merrill  wrote: >> So, if you make -Wno-narrowing meaningful in C++11 mode then how can >> it not affect sfinae (case 1.b.) and still be consistent

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Jason Merrill
On 10/24/2011 01:21 PM, Gabriel Dos Reis wrote: On Mon, Oct 24, 2011 at 9:53 AM, Jason Merrill wrote: So, if you make -Wno-narrowing meaningful in C++11 mode then how can it not affect sfinae (case 1.b.) and still be consistent with the other case where a diagnostic is required the expression ac

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Gabriel Dos Reis
On Mon, Oct 24, 2011 at 9:53 AM, Jason Merrill wrote: > On 10/24/2011 10:39 AM, Gabriel Dos Reis wrote: >> >> Hmm, the narrowing semantics also affects SFINAE, not just simple >> declaration. >> If we want a flag that can also affect the outcome of overload >> resolution, it should one of the the

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Jason Merrill
On 10/24/2011 10:39 AM, Gabriel Dos Reis wrote: Hmm, the narrowing semantics also affects SFINAE, not just simple declaration. If we want a flag that can also affect the outcome of overload resolution, it should one of the the -fflags, such as -fpermissive. I don't want the option to affect SFI

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Gabriel Dos Reis
On Mon, Oct 24, 2011 at 9:10 AM, Jason Merrill wrote: > On 10/24/2011 09:49 AM, Gabriel Dos Reis wrote: >> >> On Mon, Oct 24, 2011 at 8:29 AM, Jason Merrill  wrote: >>> >>> Right, -Wno-long-long is only useful in C++03 and C90.  But it does in >>> fact >>> suppress a standard diagnostic. >> >> a d

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Jason Merrill
On 10/24/2011 09:49 AM, Gabriel Dos Reis wrote: On Mon, Oct 24, 2011 at 8:29 AM, Jason Merrill wrote: Right, -Wno-long-long is only useful in C++03 and C90. But it does in fact suppress a standard diagnostic. a diagnostic of an extension :-) I'm not going to argue semantics any further. W

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Gabriel Dos Reis
On Mon, Oct 24, 2011 at 8:29 AM, Jason Merrill wrote: > On 10/24/2011 09:26 AM, Gabriel Dos Reis wrote: >> >> On Mon, Oct 24, 2011 at 8:06 AM, Jason Merrill  wrote: > >>> No.  I added -Wno-narrowing specifically to suppress the diagnostic in >>> C++0x >>> mode; see c++/49793.  There are several di

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Paolo Carlini
.. just to let you know guys, I'm already unassigned from the PR, but today I wanted to give it one (actually 3) more try. Given the controversy, I don't feel like further following the issue, it just makes me nervous. Eventually, feel free to adjust my patches to your likes. Paolo.

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Jason Merrill
On 10/24/2011 09:26 AM, Gabriel Dos Reis wrote: On Mon, Oct 24, 2011 at 8:06 AM, Jason Merrill wrote: No. I added -Wno-narrowing specifically to suppress the diagnostic in C++0x mode; see c++/49793. There are several diagnostics required by standards that can be suppressed by -Wno- flags, s

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Gabriel Dos Reis
On Mon, Oct 24, 2011 at 8:06 AM, Jason Merrill wrote: > On 10/24/2011 07:47 AM, Paolo Carlini wrote: [...] >> and also, as >> requested by Gaby, preventing -Wno-narrowing from suppressing the >> warning in C++0x mode (if the user really needs to silence it, >> -Wno-c++0x-compat works). I also adde

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Jason Merrill
On 10/24/2011 09:06 AM, Jason Merrill wrote: On 10/24/2011 07:47 AM, Paolo Carlini wrote: the below is a new variant removing -Wc++0x-compat from -Wall (cannot be added to -Wextra either because bootstrap passes -W) I don't understand the rationale for this. If the warning is problematic for b

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Jason Merrill
On 10/24/2011 07:47 AM, Paolo Carlini wrote: the below is a new variant removing -Wc++0x-compat from -Wall (cannot be added to -Wextra either because bootstrap passes -W) I don't understand the rationale for this. If the warning is problematic for bootstrap, why not just add -Wno-narrowing to

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Gabriel Dos Reis
On Mon, Oct 24, 2011 at 7:18 AM, Paolo Carlini wrote: > Hi, >> >> On Mon, Oct 24, 2011 at 6:47 AM, Paolo Carlini >>  wrote: >>> >>> Hi, >>> >>> the below is a new variant removing -Wc++0x-compat from -Wall (cannot be >>> added to -Wextra either because bootstrap passes -W) and also, as >>> request

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Paolo Carlini
On 10/24/2011 02:18 PM, Paolo Carlini wrote: OK with a minor correction. This bit +With -std=c++0x, @option{-Wno-c++0x-compat} can be used to suppress +the diagnostic required by the standard. should not be there. It is currently an accident of implementation detail as opposed to a feature.

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Paolo Carlini
Hi, On Mon, Oct 24, 2011 at 6:47 AM, Paolo Carlini wrote: Hi, the below is a new variant removing -Wc++0x-compat from -Wall (cannot be added to -Wextra either because bootstrap passes -W) and also, as requested by Gaby, preventing -Wno-narrowing from suppressing the warning in C++0x mode (if t

Re: [C++ Patch] PR 50810 (new try)

2011-10-24 Thread Gabriel Dos Reis
On Mon, Oct 24, 2011 at 6:47 AM, Paolo Carlini wrote: > Hi, > > the below is a new variant removing -Wc++0x-compat from -Wall (cannot be > added to -Wextra either because bootstrap passes -W) and also, as requested > by Gaby, preventing -Wno-narrowing from suppressing the warning in C++0x > mode (

[C++ Patch] PR 50810 (new try)

2011-10-24 Thread Paolo Carlini
Hi, the below is a new variant removing -Wc++0x-compat from -Wall (cannot be added to -Wextra either because bootstrap passes -W) and also, as requested by Gaby, preventing -Wno-narrowing from suppressing the warning in C++0x mode (if the user really needs to silence it, -Wno-c++0x-compat wor

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Gabriel Dos Reis
On Sun, Oct 23, 2011 at 9:16 PM, Paolo Carlini wrote: > On 10/24/2011 04:10 AM, Gabriel Dos Reis wrote: >> >> Before the patch, -std=c++0x effectively put off -Wc++0x-compat because we >> are compiling c++98/c++03 code, so we can only *warn* about possible >> compatibility conflict with C++11. How

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Paolo Carlini
On 10/24/2011 04:10 AM, Gabriel Dos Reis wrote: Before the patch, -std=c++0x effectively put off -Wc++0x-compat because we are compiling c++98/c++03 code, so we can only *warn* about possible compatibility conflict with C++11. However, the narrowing diagnostic required by C++11 is NOT a warning

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Gabriel Dos Reis
On Sun, Oct 23, 2011 at 8:48 PM, Paolo Carlini wrote: > Hi, > > On 10/24/2011 03:30 AM, Gabriel Dos Reis wrote: >> >> We do not use -W or -Wno- to suppressed *required* diagnostics. So, when >> -std=c++0x, -Wno-narrowing should not have any effect. > > Personally, I have no problem with this, but

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Paolo Carlini
Hi, On 10/24/2011 03:30 AM, Gabriel Dos Reis wrote: We do not use -W or -Wno- to suppressed *required* diagnostics. So, when -std=c++0x, -Wno-narrowing should not have any effect. Personally, I have no problem with this, but note, I'm not inventing anything new here, the behavior you are discus

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Gabriel Dos Reis
On Sun, Oct 23, 2011 at 7:56 PM, Paolo Carlini wrote: > ... and the patch ;) I am bit puzzled by this: +This flag is included in @option{-Wc++0x-compat}. +With -std=c++0x, @option{-Wno-narrowing} suppresses the diagnostic +required by the standard. and this: - /* If we're allowing C++0x constr

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Paolo Carlini
... and the patch ;) Paolo. /c-family 2011-10-23 Paolo Carlini PR c++/50810 * c-opts.c (c_common_handle_option): Do not enable -Wc++0x-compat as part of -Wall; handle -Wc++0x-compat. (c_common_post_options): -std=c++0x enables -Wnarrowing.

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Paolo Carlini
Hi, Personally, I would be in favor of taking -Wc++0x-compat out of -Wall. Patch pre-approved. Thanks. It makes sense though that -Wextra implies -Wc++0x-compat. Indeed, it would. However, unfortunately, we are using -W to bootstrap (it just failed on me). Thus I'm bootstrapping and testing

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Gabriel Dos Reis
On Sun, Oct 23, 2011 at 4:28 PM, Paolo Carlini wrote: > On 10/23/2011 11:05 PM, Gabriel Dos Reis wrote: >> >> On Sun, Oct 23, 2011 at 3:45 PM, Eric Botcazou >>  wrote: Anyway, the below appears to work for me. Eric shall I commit it? >>> >>> I have other errors for config/i386/i386.c on

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Paolo Carlini
On 10/23/2011 11:05 PM, Gabriel Dos Reis wrote: On Sun, Oct 23, 2011 at 3:45 PM, Eric Botcazou wrote: Anyway, the below appears to work for me. Eric shall I commit it? I have other errors for config/i386/i386.c on my x86-64 machine. But are we sure that we want to warn on static unsigned HOS

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Gabriel Dos Reis
On Sun, Oct 23, 2011 at 3:45 PM, Eric Botcazou wrote: >> Anyway, the below appears to work for me. Eric shall I commit it? > > I have other errors for config/i386/i386.c on my x86-64 machine.  But are we > sure that we want to warn on > > static unsigned HOST_WIDE_INT unknown[4] = { -1, -1, 0, 0 }

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Eric Botcazou
> Anyway, the below appears to work for me. Eric shall I commit it? I have other errors for config/i386/i386.c on my x86-64 machine. But are we sure that we want to warn on static unsigned HOST_WIDE_INT unknown[4] = { -1, -1, 0, 0 }; with -Wall? This seems overly picky to me. -- Eric Botcaz

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Paolo Carlini
On 10/23/2011 10:25 PM, Eric Botcazou wrote: Oh my, I thought I was till using C here... Ok, I'll fix that. The base compiler is a C compiler, stage 2/3 are built with the C++ compiler. Yes, yes. Sorry about this. Anyway, the below appears to work for me. Eric shall I commit it? Thanks, Paolo

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Eric Botcazou
> Oh my, I thought I was till using C here... Ok, I'll fix that. The base compiler is a C compiler, stage 2/3 are built with the C++ compiler. -- Eric Botcazou

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Paolo Carlini
On 10/23/2011 10:19 PM, Eric Botcazou wrote: So, to be clear, this is for bootstrapping with a C++ compiler, right? Honestly, didn't try that... It's definitely possible that there are glitches in the tree wrt -Wnarrowing in C++. Bootstrapping with the C++ compiler has been the default for month

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Eric Botcazou
> So, to be clear, this is for bootstrapping with a C++ compiler, right? > Honestly, didn't try that... It's definitely possible that there are > glitches in the tree wrt -Wnarrowing in C++. Bootstrapping with the C++ compiler has been the default for months... -- Eric Botcazou

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Eric Botcazou
> The code in question is > > static unsigned HOST_WIDE_INT unknown[4] = { -1, -1, 0, 0 }; > > This is on amd64-unknown-freebsd8.0, though I am puzzled it does not > seem to trigger for other 64-bit platforms? It does trigger on Linux. I guess the patch wasn't bootstrapped. There is another pr

Re: Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Paolo Carlini
On 10/23/2011 10:07 PM, Gerald Pfeifer wrote: Is it possible that this is responsible for a bootstrap failure introduced in the last 27 hours or so? /scratch/tmp/gerald/gcc-HEAD/gcc/tree-object-size.c:44:59: error: narrowing conversion of '-0x1' from 'int' to 'long unsigned int'

Bootstrap failure in tree-object-size.c due to -Wnarrowing (was: [C++ Patch] PR 50810)

2011-10-23 Thread Gerald Pfeifer
Is it possible that this is responsible for a bootstrap failure introduced in the last 27 hours or so? /scratch/tmp/gerald/gcc-HEAD/gcc/tree-object-size.c:44:59: error: narrowing conversion of '-0x1' from 'int' to 'long unsigned int' inside { } [-Werror=narrowing] /scratch/tmp/g

Re: [C++ Patch] PR 50810

2011-10-23 Thread Jason Merrill
On 10/23/2011 11:00 AM, Paolo Carlini wrote: +With -std=c++0x, @option{-Wno-narrowing} suppresses the diagnostic +required by the standard. This flag is included in @option{-Wall} and +@option{-Wc++0x-compat}. I'd swap those two sentences. OK with that change. Jason

Re: [C++ Patch] PR 50810

2011-10-23 Thread Paolo Carlini
Hi, On 10/23/2011 07:23 AM, Paolo Carlini wrote: -@item -Wno-narrowing @r{(C++ and Objective-C++ only)} +@item -Wnarrowing @r{(C++ and Objective-C++ only)} @opindex Wnarrowing @opindex Wno-narrowing -With -std=c++0x, suppress the diagnostic required by the standard for -narrowing conversions w

Re: [C++ Patch] PR 50810

2011-10-23 Thread Jason Merrill
On 10/23/2011 07:23 AM, Paolo Carlini wrote: -@item -Wno-narrowing @r{(C++ and Objective-C++ only)} +@item -Wnarrowing @r{(C++ and Objective-C++ only)} @opindex Wnarrowing @opindex Wno-narrowing -With -std=c++0x, suppress the diagnostic required by the standard for -narrowing conversions within

[C++ Patch] PR 50810

2011-10-23 Thread Paolo Carlini
Hi, this is essentially about enabling -Wnarrowing as part of -Wc++0x-compat (see audit trail for details). Tested x86_64-linux. Ok for mainline? Thanks, Paolo. / /c-family 2011-10-23 Paolo Carlini PR c++/50810 * c-opts.c (c_common_handle_option): Enab