Re: missing macro usage string in error information

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

 



17.03.2018 16:52, Marc Glisse пишет:
> 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?
> 

Thanks, but this didn't work.

Can you please try to compile the following code?

    typedef struct _sfio_s _sfio_FILE;
    #define __FILE  _sfio_FILE
    
    #include <bits/types/__FILE.h>

...given that /usr/include/bits/types/__FILE.h (owned by glibc 2.26 ) exists and contains:

    #ifndef ____FILE_defined
    #define ____FILE_defined 1
    
    struct _IO_FILE;
    typedef struct _IO_FILE __FILE;
    
    #endif



[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