Re: preprocessing directive with no new-line character

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> - 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux