public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Hans-Bernhard Bröker" <HBBroeker@t-online.de>
To: cygwin@cygwin.com
Subject: Re: /usr/include/ssp/wchar.h:78:1: error: unknown type name ‘FILE’ (during cygport package build)
Date: Sun, 13 May 2018 17:07:00 -0000	[thread overview]
Message-ID: <8aee8ac8-ec33-295a-bf5f-e7e001be0fc4@t-online.de> (raw)
In-Reply-To: <95ce9d0aaca770f8e88d661cac91ce5d@xs4all.nl>

Am 13.05.2018 um 18:01 schrieb waterlan:

> The C flag that triggers this option is -Wp,-D_FORTIFY_SOURCE=2.

That does look rather weird.  Why would one write that instead of just 
-D_FORTIFY_SOURCE=2 ?

Anyway, the test can be simplified quite a lot to:

hbbro@NB4 ~/tmp
$ cat twchar.c
#include <wchar.h>



$ gcc -D_FORTIFY_SOURCE=1 -fstack-protector-strong -c twchar.c -O2 
-D_XOPEN_SOURCE
In file included from /usr/include/ssp/wchar.h:5:0,
                  from /usr/include/wchar.h:336,
                  from twchar.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))


All four of the GCC options have to be there to trigger this 
(_FORTIFY_SOURCE can be set to 2, for the same result).  Basically the 
SSP additions to <wchar.h> fail to compile, but only if the feature set 
has been restricted from the default by -D_XOPEN_SOURCE.  Ultimately 
this happens because the latter disables the typedef of FILE in 
/usr/include/wchar.h line 72 ff:

#if __POSIX_VISIBLE >= 200809 || _XSI_VISIBLE
/* As in stdio.h, <sys/reent.h> defines __FILE. */
#if !defined(__FILE_defined)
typedef __FILE FILE;
# define __FILE_defined
#endif
#endif

I don't know remotely enough about this SSP stuff to judge if that's 
even supposed to work in -D_XOPEN_SOURCE mode.  But as it is, it can't.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2018-05-13 17:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-13 17:06 waterlan
2018-05-13 17:07 ` Hans-Bernhard Bröker [this message]
2018-05-13 20:04   ` Achim Gratz
2018-05-14 12:40 ` Ken Brown
2018-08-16 19:20   ` waterlan
2018-08-16 19:25     ` Ken Brown
2018-08-16 23:34       ` waterlan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8aee8ac8-ec33-295a-bf5f-e7e001be0fc4@t-online.de \
    --to=hbbroeker@t-online.de \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).