1
votes

I am using Cygwin to compile c++ programs, but I need to know what command do I use to show warnings when there is no endline or new line in the program. I tried using commands like -Wall, -Pedantic, etc but nothing shows up.

Below is the current cygwin I am using.

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-7.3.0-2.x86_64/src/gcc-7.3.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-7.3.0-2.x86_64/src/gcc-7.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
Thread model: posix
gcc version 7.3.0 (GCC)
1
You mean when the *.cpp file does not end with a newline? This used to be technically illegal, but few compilers cared, and it has been legal since C++11.aschepler
Yea, when the *.cpp file does not end with a new line. I am trying to see if it can give me a warning when I don't add a newline.ek9
You will have to write a shell script to detect if your files have new lines at the end of file.Ashish Shirodkar

1 Answers

1
votes

This is an improvement made by GCC people for portability, gcc 4.3 onwards. There is no way to get this warning back.

See Here: gcc 4.3 no longer warns about missing newlines at end of files