DEFAULT_MAIN_RETURN and C99...

Zack Weinberg zack@codesourcery.com
Wed Jun 18 21:06:00 GMT 2003


Currently we have this logic in c-decl.c:finish_function:

#ifdef DEFAULT_MAIN_RETURN
         /* Make it so that `main' always returns success by default.
         */
           DEFAULT_MAIN_RETURN;
#else
          if (flag_isoc99)
              c_expand_return (integer_zero_node);
#endif

There are two definitions of DEFAULT_MAIN_RETURN in the source tree,
in i370/i370.h and s390/s390.h.  Both definitions read

#define DEFAULT_MAIN_RETURN  c_expand_return (integer_zero_node)

I see no reason not to make this behavior unconditional and
target-independent.  In other words, for main, always call
c_expand_return (integer_zero_node) at this point.  This will suppress
the "control reaches end of non-void function" warning, but we could
fix that with a little cleverness.

Objections?

zw



More information about the Gcc mailing list