This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: preprocessing directive with no new-line character


On 2017-07-18 17:43:50 -0600, Martin Sebor wrote:
> Yes, C requires every non-empty source file to have at least
> one line.  The C11 standard says in 5.1.1.2 Translation phases,
> p2:
> 
>   A source file that is not empty shall end in a new-line character,
>   which shall not be immediately preceded by a backslash character
>   before any such splicing takes place.

I've reported a bug for the missing warning:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81745

It was closed because

  https://gcc.gnu.org/ml/gcc-patches/2007-04/msg00504.html

"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."

However, this is not documented in the GCC manual and the preprocessor
behaves differently whether the input file ends with a backslash or
ends with a backslash-newline:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81745#c7

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


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