Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #150072

Re: Warnings/Debugger

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: Warnings/Debugger
Date 2020-02-18 08:36 -0800
Organization A noiseless patient Spider
Message-ID <86pnebettn.fsf@linuxsc.com> (permalink)
References (5 earlier) <r1ij3h$ep$1@dont-email.me> <r1jsus$t0p$1@dont-email.me> <r1lgc9$v28$1@dont-email.me> <r1rhnq$e8l$1@dont-email.me> <slrnr4310r.km3.grahn+nntp@frailea.sa.invalid>

Show all headers | View raw


Jorgen Grahn <grahn+nntp@snipabacken.se> writes:

> On Mon, 2020-02-10, Mehdi Amini wrote:
>
>> On 2/8/20 8:49 AM, James Kuyper wrote:
>
> ...
>
>>> Also, what was the 1 error message?
>>> Just to give us an idea of what's going wrong, what was the very first
>>> warning message?
>>
>> Compiler:
>> -------------- Build:  Release in Temp (compiler:  LLVM Clang Compiler 10
>> GTK Library Warnings_Disabled)---------------
>>
>> clang -pedantic -Weverything -Wall -std=c11 -pedantic -Weverything -Wall
>> -std=c11 -m64 -w -std=c11 -pthread -I/usr/include/gtk-3.0
>
> ...
>
>> #define __GTK_H__
>>          ^
>> /usr/include/gtk-3.0/gtk/gtk.h:28:9: warning: macro name is a reserved
>> identifier [-Wreserved-id-macro]
>
> You probably shouldn't use -Weverything.  I never heard of it before,
> but it seems to enable every warning anyone ever implemented, and
> that's going to generate a lot of noise, like the warning quoted
> above.

Yes.  I suppose there could be a situation where -Weverything is
called for, but this isn't one of them.

> [as to what options should be used,]
>
>   -pedantic -Wall -Wextra -std=c11
>
> is plenty,

I recommend a more incremental approach.  To start, compile with
just -pedantic-errors (and also either -std=c11 or -std=c99, as
may be preferred, but in any case an explicit choice).  Most
packages will clear this hurdle without any difficulty, but for
those that don't it's good to get an early indication of that, to
decide how to proceed further.

After clearing the -pedantic hurdle, turn on individual warnings
one or two at a time, in order of most serious type first.  One
way of doing this is to add temporarily -Wall and -Wextra, then
look through the different kinds of warnings given, pick the most
significant, and go back and add it to the list of specific
warnings options (or perhaps not, if it is deemed not important
enough).  Repeat until the set of warning options converges.

I have been following this method for fifteen or twenty years
now, and find it gives better results than turning on all the
warning options from the beginning.

> and quality libraries are written so their header files
> don't generate any of those warnings.

That is true in many cases, but there are plenty of well-regarded
libraries where using the -Wall/-Wextra options will generate
some warnings.  Also it is good to remember that -Wall/-Wextra is
a moving target:  software that clears the -Wall/-Wextra hurdle
today may very well stumble tomorrow.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Warnings/Debugger Mehdi Amini <atorrses@gmail.com> - 2020-02-03 18:38 +0330
  Re: Warnings/Debugger Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-02-03 17:44 +0000
    Re: Warnings/Debugger Mehdi Amini <atorrses@gmail.com> - 2020-02-04 17:09 +0330
      Re: Warnings/Debugger Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-02-05 01:45 +0000
        Re: Warnings/Debugger Mehdi Amini <atorrses@gmail.com> - 2020-02-06 17:03 +0330
          Re: Warnings/Debugger chad <cdalten@gmail.com> - 2020-02-06 05:51 -0800
            Re: Warnings/Debugger Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-02-06 06:57 -0800
              Re: Warnings/Debugger chad <cdalten@gmail.com> - 2020-02-06 08:15 -0800
                Re: Warnings/Debugger Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-02-06 09:01 -0800
          Re: Warnings/Debugger James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-02-06 21:47 -0500
            Re: Warnings/Debugger Mehdi Amini <atorrses@gmail.com> - 2020-02-07 18:11 +0330
              Re: Warnings/Debugger chad <cdalten@gmail.com> - 2020-02-07 07:35 -0800
              Re: Warnings/Debugger James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-02-08 00:19 -0500
                Re: Warnings/Debugger Mehdi Amini <atorrses@gmail.com> - 2020-02-10 15:49 +0330
                Re: Warnings/Debugger Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-02-10 16:26 +0000
                Re: Warnings/Debugger Mehdi Amini <atorrses@gmail.com> - 2020-02-11 17:56 +0330
                Re: Warnings/Debugger chad <cdalten@gmail.com> - 2020-02-11 06:28 -0800
                Re: Warnings/Debugger James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-02-11 22:55 -0500
                Re: Warnings/Debugger Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-02-12 07:05 +0000
                Re: Warnings/Debugger Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-02-18 08:36 -0800
                Re: Warnings/Debugger James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-02-11 08:24 -0800
                Re: Warnings/Debugger Mehdi Amini <atorrses@gmail.com> - 2020-02-12 16:11 +0330
                Re: Warnings/Debugger chad <cdalten@gmail.com> - 2020-02-12 05:39 -0800
          Re: Warnings/Debugger Ian Collins <ian-news@hotmail.com> - 2020-02-07 16:14 +1300
  Re: Warnings/Debugger James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-02-03 12:56 -0500
    Re: Warnings/Debugger Mehdi Amini <atorrses@gmail.com> - 2020-02-04 17:24 +0330
      Re: Warnings/Debugger James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-02-04 10:03 -0500
  Re: Warnings/Debugger Öö Tiib <ootiib@hot.ee> - 2020-02-03 11:41 -0800
    Re: Warnings/Debugger Mehdi Amini <atorrses@gmail.com> - 2020-02-04 17:29 +0330
      Re: Warnings/Debugger Paul <nospam@needed.invalid> - 2020-02-04 13:18 -0500
        Re: Warnings/Debugger David Brown <david.brown@hesbynett.no> - 2020-02-04 21:29 +0100
        Re: Warnings/Debugger Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-02-05 10:05 +0000
          Re: Warnings/Debugger chad <cdalten@gmail.com> - 2020-02-05 06:05 -0800
          Re: Warnings/Debugger Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-02-05 08:39 -0800
            Re: Warnings/Debugger Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-02-05 16:49 +0000
  Re: Warnings/Debugger Jens Stuckelberger <Jens_Stuckelberger@nowhere.net> - 2020-02-18 16:41 +0000

csiph-web