Is __USE_FIXED_PROTOTYPES__ really necessary?

Ian Lance Taylor ian@cygnus.com
Mon Oct 6 09:11:00 GMT 1997


   Date: Mon, 6 Oct 97 11:26:29 +0200
   From: Manfred Hollstein <manfred@ks.sel.alcatel.de>

   I have to build  gcc (and egcs)  on various systems including very old
   ones, where the /usr/include  files don't contain many  prototypes. My
   question now is: Is there any good reason for the prototypes generated
   by fix-header to be bracketed by

   #if defined(__USE_FIXED_PROTOTYPES__) ...
   ...
   #endif

   In  the past I removed this  particular check and  had no trouble with
   it. Would  it   be possible  to  emit   them without this   particular
   dependency? What do you think?

We discussed that a long time ago when the __USE_FIXED_PROTOTYPES__
stuff was introduced.  The consensus at the time was that causing the
functions to be declared all the time could easily break existing
programs which compiled without the declarations.

For example, many programs intended to be compiled on SunOS will
declare system functions which SunOS should have declared in the
system header files but didn't.  If gcc fixes the header files to
include declarations, then it is possible for declaration conflicts to
arise, causing the programs to fail to compile when using gcc.  For
compatibility with existing code, it is better for gcc to not declare
the functions by default.

Instead, we introduced the __USE_FIXED_PROTOTYPES__ define.  I
personally normally compile with -D__USE_FIXED_PROTOTYPES__ in CFLAGS,
so that I get the advantage of the prototypes which gcc has inserted.
Using the preprocessor macro gives the option of getting the
declarations, without breaking existing code.

Ian



More information about the Gcc mailing list