public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/97687] New: -Wfatal-errors prints some notes but not others
@ 2020-11-03  4:01 nick at ludocode dot com
  2024-06-26 10:06 ` [Bug c/97687] " egallager at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: nick at ludocode dot com @ 2020-11-03  4:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97687

            Bug ID: 97687
           Summary: -Wfatal-errors prints some notes but not others
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nick at ludocode dot com
  Target Milestone: ---

In file a.c:

    #define FOO foo
    typedef int FOO;
    typedef short FOO;


gcc a.c

    a.c:1:13: error: conflicting types for ‘foo’
        1 | #define FOO foo
        |             ^~~
    a.c:3:15: note: in expansion of macro ‘FOO’
        3 | typedef short FOO;
        |               ^~~
    a.c:1:13: note: previous declaration of ‘foo’ was here
        1 | #define FOO foo
        |             ^~~
    a.c:2:13: note: in expansion of macro ‘FOO’
        2 | typedef int FOO;
        |             ^~~


gcc -Wfatal-errors a.c

    a.c:1:13: error: conflicting types for ‘foo’
        1 | #define FOO foo
        |             ^~~
    a.c:3:15: note: in expansion of macro ‘FOO’
        3 | typedef short FOO;
        |               ^~~
    compilation terminated due to -Wfatal-errors.


-Wfatal-errors is printing some notes but not others. It would be much more
useful (to me) if it printed all of them, although in bugs #33952 and #37773
you claim that -Wfatal-errors is not for users, so I'm not really sure what you
want it to do here.

For what it's worth -fmax-errors=1 does the right thing and prints all three
notes, which I assume is what you want me to use. Unfortunately -fmax-errors=1
isn't supported by Clang so this makes my build system more complicated. Clang
supports -Wfatal-errors and prints all three notes.


$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-06-26 21:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03  4:01 [Bug c/97687] New: -Wfatal-errors prints some notes but not others nick at ludocode dot com
2024-06-26 10:06 ` [Bug c/97687] " egallager at gcc dot gnu.org
2024-06-26 20:23 ` dmalcolm at gcc dot gnu.org
2024-06-26 20:41 ` dmalcolm at gcc dot gnu.org
2024-06-26 20:43 ` dmalcolm at gcc dot gnu.org
2024-06-26 21:20 ` dmalcolm at gcc dot gnu.org
2024-06-26 21:21 ` dmalcolm at gcc dot gnu.org
2024-06-26 21:23 ` dmalcolm at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).