This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: Problem with wchar.h, _FORTIFY_SOURCE , and -std=c99


On 2018-03-13 13:10, Ken Brown wrote:
> $ cat test.c
> #include <wchar.h>
> 
> $ gcc -std=c99 -O2 -Wp,-D_FORTIFY_SOURCE=2 -c test.c
> In file included from /usr/include/ssp/wchar.h:5:0,
>                  from /usr/include/wchar.h:336,
>                  from test.c:1:
> /usr/include/ssp/wchar.h:78:1: error: unknown type name ‘FILE’
>  __ssp_decl(wchar_t *, fgetws, (wchar_t *__restrict __buf, int __wlen,
> FILE *__restrict __fp))
>  ^
> /usr/include/ssp/wchar.h:78:1: error: unknown type name ‘FILE’
>  __ssp_decl(wchar_t *, fgetws, (wchar_t *__restrict __buf, int __wlen,
> FILE *__restrict __fp))
>  ^
> 
> If I drop '-std=c99', the problem goes away because FILE is defined in
> /usr/include/wchar.h prior to the inclusion of /usr/include/ssp/wchar.h.
> 
> If I drop '-Wp,-D_FORTIFY_SOURCE=2', the problem goes away because
> /usr/include/wchar.h doesn't use FILE; it only uses __FILE.
> 
> Should /usr/include/ssp/wchar.h be changed to similarly avoid FILE?

Yes, I checked in a patch.

-- 
Yaakov

Attachment: signature.asc
Description: OpenPGP digital signature


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