This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc merrily compiles empty files
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc merrily compiles empty files
- From: Henry Sobotka <sobotka at axess dot com>
- Date: Tue, 20 Jun 2000 19:17:27 -0400
- Reply-To: sobotka at axess dot com
On OS/2, both gcc 2.81 and pgcc 2.95.2 will compile a zero-length
hello.c with the -c flag without the slightest warning or failure. Some
sort of output on that condition would seem appropriate. It's not a
problem compiling an executable, because the missing main() causes a
failure. I came across the behavior in encountering massive linkage
barf, which I tracked down to an empty .cpp file that had somehow gotten
created in an object directory, and was being compiled instead of the
real source. "Nothing to do." + exit or at least an "Empty source file"
might spare others a few hairs or headaches when this type of accident
occurs.
Henry