This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/81745] missing warning with -pedantic when a C file does not end with a newline character
- From: "vincent-gcc at vinc17 dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 07 Aug 2017 00:20:11 +0000
- Subject: [Bug preprocessor/81745] missing warning with -pedantic when a C file does not end with a newline character
- Auto-submitted: auto-generated
- References: <bug-81745-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81745
Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|INVALID |FIXED
--- Comment #4 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Andrew Pinski from comment #3)
> https://gcc.gnu.org/ml/gcc-patches/2007-04/msg00504.html
>
> See that reasoning there.
"It's really not undefined at all. gcc would be still be standard
conformant if we defined all input to end with a newline, whether or
not the actual physical Unix input file did so."
OK, but this needs to be documented.
The GCC manual says:
------------------------------------------------------------------------
4.2 Environment
===============
The behavior of most of these points are dependent on the implementation
of the C library, and are not defined by GCC itself.
* 'The mapping between physical source file multibyte characters and
the source character set in translation phase 1 (C90, C99 and C11
5.1.1.2).'
------------------------------------------------------------------------
However, the fact that all input files are regarded to end with a newline is
completely specific to GCC, not part of how the C library works.