This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc merrily compiles empty files
- To: sobotka at axess dot com
- Subject: Re: gcc merrily compiles empty files
- From: Michael Meissner <meissner at cygnus dot com>
- Date: Tue, 20 Jun 2000 19:32:51 -0400
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <394FFB87.20EB@axess.com>
On Tue, Jun 20, 2000 at 07:17:27PM -0400, Henry Sobotka wrote:
> 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.
The -pedantic option warns about this (of course, it warns about lots of other
things as well). Speaking as a programmer, I can certainly imagine uses for
empty files (for example for conditional debug code).
--
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482