This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Problem with wchar.h, _FORTIFY_SOURCE , and -std=c99
- From: Ken Brown <kbrown at cornell dot edu>
- To: newlib at sourceware dot org
- Date: Tue, 13 Mar 2018 14:10:43 -0400
- Subject: Problem with wchar.h, _FORTIFY_SOURCE , and -std=c99
- Authentication-results: sourceware.org; auth=none
$ 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?
Ken