Re: g++ command line checking

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

 




On 10/07/2020 09:47, Jonathan Wakely wrote:
> On Fri, 10 Jul 2020 at 08:37, Jonny Grant <jg@xxxxxxxx> wrote:
>>
>> Thank you for you reply.
>>
>> On 10/07/2020 00:58, Jonathan Wakely wrote:
>>> On Thu, 9 Jul 2020 at 23:54, Jonny Grant <jg@xxxxxxxx> wrote:
>>>>
>>>> Hello
>>>>
>>>> I noticed g++ ignores -W as I understand it that alone doesn't turn anything on?
>>>
>>> No, -W is identical to -Wextra.
>>
>> I looked but couldn't find any mention of it.
>>
>> Is it worth documenting this on the page?
>> https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
> 
> As mentioned, it's there. Search for -Wextra to find it. Searching for
> "-W " with a space doesn't find it because it's followed by a full
> stop. Searching for -W\> works though if you're reading the man page
> in a pager that supports regex searches.

Ah yes, there is is. Personally I'd be tempted to just reformat the sentence so it had a space after, to make it simpler for users to find.

("This option used to be called -W . The older name is still supported, but the newer name is more descriptive.)"


>>>> https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
>>>>
>>>> Also may I ask if specifying both -pedantic -Wpedantic be an error? They are the same as I understand. g++ doesn't reject them both being specified.
>>>
>>> They mean the same thing. It's not an error to repeat options.
>>
>> Fair enough, it doesn't help anyone remove duplicates from their warning list in makefile etc though.
> 
> So what? Why would you need to do that?
> 
>>>> Another example is -O1 -O0 -O3, the later -03 seems to be used. Maybe nice to say too many optimization options specified?
>>>
>>> No, it's common (and very useful) to append an option to the end of a
>>> command and have it override earlier options.
>>>
>>> This behaviour is documented, and relied on by many people.
>>
>> clang gives a nice helpful warning I recall.
> 
> I don't think it does.

Just checked, you're right, it doesn't, my mistake.

>> I usually just amend the optimisation earlier in the command line myself.
> 
> I don't. Lots of other people don't.
> 
>> This isn't directly related, but the main page doesn't show what version of GCC it refers to
>> https://gcc.gnu.org/onlinedocs/gcc/
>>
>> Could the page show what version it is on that page?
> 
> No version, it's the unreleased development sources.

Ah, so maybe it could say trunk or development version? Although it looks like it's the official version to me, it doesn't say "beta" or anything in the URL or at the top of the page. I had expected it to just be the latest release.

>> Took me a while to realise that this page was only introduced with GCC 10 from what I can see
>> https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html
> 
> Then you should probably be looking at the docs for your GCC version
> instead of the unreleased development sources. The docs for each
> version are available at https://gcc.gnu.org/onlinedocs/
> 
> Right at the bottom of the page is the link to the doc you've been
> using, which says "Please note that the following documentation refers
> to current development. Some information may not be applicable to any
> existing release."

The reality is, on big pages, people don't often get to the bottom of the page below 2.95.2. You're right, I missed that note down there.

Cheers, Jonny



[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