public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: c/8868: GCC 3.2, 3.2.1 fail to compile with <sys/stat.h> functions in C99 mode
Date: Sun, 08 Dec 2002 07:26:00 -0000	[thread overview]
Message-ID: <20021208152601.24961.qmail@sources.redhat.com> (raw)

The following reply was made to PR c/8868; it has been noted by GNATS.

From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: <theaterfire@yahoo.com>
Cc: <gcc-gnats@gcc.gnu.org>,  <gcc-bugs@gcc.gnu.org>
Subject: Re: c/8868: GCC 3.2, 3.2.1 fail to compile with <sys/stat.h> functions
 in C99 mode
Date: Sun, 8 Dec 2002 15:17:06 +0000 (GMT)

 On 8 Dec 2002 theaterfire@yahoo.com wrote:
 
 > Using struct stat, stat(), or fstat() from <sys/stat.h> causes
 > compilation to fail in gcc 3.2 under C99 mode.  In some cases, it also
 > causes errors to be reported about other functions that compile
 > properly without the introduction of <sys/stat.h> elements.
 
 This is clearly an issue with your library headers rather than with GCC.  
 If you want to claim otherwise, you'll need to provide preprocessed source
 that GCC fails to compile in C99 mode but ought to compile, or the
 collection of source files it fails to preprocess correctly in C99 mode;
 you haven't provided anything that looks like a GCC testcase.
 
 Note that, according to POSIX, this isn't a library bug either unless you
 define _POSIX_SOURCE or _POSIX_C_SOURCE to an appropriate value (depending
 on the POSIX version you want, e.g. -D_POSIX_C_SOURCE=199506L for the
 previous edition of POSIX), since -std=c99 means C standard features only,
 no POSIX features, and including <sys/stat.h> in such a mode yields
 undefined behavior.
 
 > If all <sys/stat.h> elements are removed from the sample, it will
 > properly compile in C99 mode.  Note that with the <sys/stat.h>
 > elements, gcc will also warn of implicit declaration of fileno(),
 > included from <stdio.h>.
 
 Of course.  fileno() isn't part of C99, declaring it in strict C99 mode
 (without a feature test macro such as _POSIX_C_SOURCE) isn't allowed.
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 


             reply	other threads:[~2002-12-08 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-08  7:26 Joseph S. Myers [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-12-18 12:54 ehrhardt
2002-12-07 18:26 theaterfire

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=20021208152601.24961.qmail@sources.redhat.com \
    --to=jsm28@cam.ac.uk \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /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).