This is the mail archive of the gcc-bugs@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]

gcc merrily compiles empty files


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

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