Re: Question on GCC 4.6 and -fpermissive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10 August 2011 09:22, Jeffrey Walton wrote:
> Hi Guys,
>
> I'm running a table drive test suite. The tables are about 250K each,
> and there are 7 of them. Each row in the table looks similar to the
> following (this particular row is consumed by a 'short'):
>
>    { 0x0001, 0x0001, <some bool> };
>
> Without '-fpermissive' the code would not compile'.

Why?  You might want to fix that.  -fpermissive is a band-aid to work
around broken code, for backwards compatibility.  You should aim to
wean yourself off it. You shouldn't write new code that relies on it.

> With
> '-fpermissive', the code compiles but produces a warning for each line
> encountered:
>
>    AdditionVerify.cpp:68:1: warning: narrowing conversion of ‘65535’
>        from ‘int’ to ‘short int’ inside { } [-fpermissive]
>
> GCC's 4.6 docs do not appear to have a [no]warning switch for
> permissive [1] (the docs for the switches don't even mention the word
> 'permissive').

It's listed in the options summary:
http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html
and here:
http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html

It's not a warning option, it alters the C++ language that's
supported, to allow non-standard constructs and things that were
"traditionally" allowed (either by pre-standard C++ compilers or by
earlier versions of G++)

If you don't want -fpermissive then don't use it.

> Taking a stab in the dark, my current CXXFLAGS looks is
> below, which has not helped.
>
>    CXXFLAGS += -std=c++0x -fpermissive -Wno-permissive \
>        -Wno-narrow -Wno-narrowing -Wno-narrow-conversion
>        -Wno-narrowing-conversion -Wno-coversion

Well no, clearly just making up options isn't going to help.

> Any ideas on how to hush the compiler for for this warning. I'm
> concerned it the volume of output might be masking more relevant
> warnings.

If you don't want warnings about narrowing then use -Wno-narrow, which
works for me.  If it doesn't work for you please provide a *working*
example, not pseudocode or one that doesn't actually demonstrate your
point.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux