This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: missing macro usage string in error information


On Sat, 17 Mar 2018, Basin Ilya wrote:

I'm comparing the build of Korn Shell between Archlinux 2016 and 2018.

The build fails in 2018, because the ksh compat library defines the
__FILE macro, which conflicts with a typedef in
/usr/include/bits/types/__FILE.h

If I remember correctly, modern gcc should print both the macro usage
and the macro definition lines. However, gcc was really unhelpful about
the cause and never mentioned the header from above in its error
message. It only printed the macro definition, but not the usage. I
expected to see something like:

   /usr/include/bits/types/__FILE.h:5:24: error: conflicting types for ‘_sfio_FILE’
    typedef struct _IO_FILE __FILE;
                           ^~~~~~~~

but the actual output was:

   [il@arch libast]$ cc -D_BLD_DLL -fPIC -D_BLD_ast -I. -I/home/il/builds/ksh-20120801-33.el6/src/lib/libast -Icomp -I/home/il/builds/ksh-20120801-33.el6/src/lib/libast/comp -Imisc -I/home/il/builds/ksh-20120801-33.el6/src/lib/libast/misc -Iinclude -I/home/il/builds/ksh-20120801-33.el6/src/lib/libast/include -Istd -I/home/il/builds/ksh-20120801-33.el6/src/lib/libast/std -D_PACKAGE_ast -c /home/il/builds/ksh-20120801-33.el6/src/lib/libast/misc/fastfind.c
   In file included from /home/il/builds/ksh-20120801-33.el6/src/lib/libast/std/stdio.h:22:0,
                    from ./ast_wchar.h:87,
                    from /home/il/builds/ksh-20120801-33.el6/src/lib/libast/include/regex.h:39,
                    from /home/il/builds/ksh-20120801-33.el6/src/lib/libast/misc/findlib.h:35,
                    from /home/il/builds/ksh-20120801-33.el6/src/lib/libast/misc/fastfind.c:77:
   ./ast_stdio.h:82:15: error: conflicting types for ‘_sfio_FILE’
    #define FILE  _sfio_FILE
                  ^
   ./ast_stdio.h:80:24: note: previous declaration of ‘_sfio_FILE’ was here
    typedef struct _sfio_s _sfio_FILE;
                           ^~~~~~~~~~

Strangely, if I try to compile the "*.i" file created with -save-temps, gcc does print the correct location.

-Wsystem-headers maybe?

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]