Which flag disables the GCC warning that there is no new line at the end of the file?

I just read this post about why there are new line warnings, but honestly, my team has people working on several different platforms and with several different editors (each uses what it imposes on them), so the warning has become widespread , and since he really shouldn’t be warned that he cares about it, he becomes a noise and makes it difficult to find serious warnings.

Many times, important warnings went unnoticed, because people got used to the fact that useless warnings were heard past them, so they obviously just stopped looking at them carefully and with the reason IMHO. We can say that in our case, the GCC cries a wolf too much for someone to take this seriously, which is a bad attitude, but its just human nature.

Right now we are compiling with -Wall, because we need warnings, but is there a counter flag to avoid newline warnings?

Note: I looked at the manual a bit, but could not find an answer anywhere, so I gave up.

Note: In response to an absolutely sensible Robert Gamble solution, our code is cross-platform and we have people and it works on Linux, Solaris and Windows, so the new line ... is not under consensus. And someone compiler will always cry. Because there are more than 40 developers and other employees who are not programmers.

+5
source share
6 answers

I don’t know, as far as I know, I have used GCC for many years.

Update: There should be no warnings related to the C ++ 11 standard. Related Q

+5
source

, - , , , . , pre-commit, , .

+5

, , ? - "" .

+4
-Wno-eof-newline

gcc bug 14331


, gcc . , .

gcc -Wno-eof-newline, -Weof-newline. ++ 11 , .


, clang : -Wnewline-eof , ++ 11 , -Wc++98-compat-pedantic.

, clang -Weverything, "" , ++ 11 -Wno-newline-eof, -Wno-c++98-compat-pedantic, .

+1

Add a binding to the source control that prevents successful code validation until a new line is added?

0
source

All Articles