This is the mail archive of the gcc@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]
Other format: [Raw text]

DEFAULT_MAIN_RETURN and C99...


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


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