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

Patch to add new target macro: TARGET_WARN_RETURN_TYPE


Hi Guys,

  I would like to get approval for the following patch.  It adds a new
  target macro called 'TARGET_WARN_RETURN_TYPE' which can be used to
  disable the check for a non-void function returning without
  providing a return value.  This ability would be useful for the ARM
  port which supports the notion of a "naked" function whoes prologue
  and epilogue is left entirely up to the programmer to code.

Cheers
	Nick


Thu Mar 18 16:10:11 1999  Nick Clifton  <nickc@cygnus.com>

	* c-decl.c (finish_function): Check TARGET_WARN_RETURN_TYPE
	(if defined) before generating a warning message about a
	non-void function not returning a value.

	* tm.texi (TARGET_WARN_RETURN_TYPE): Docuemnt.

Index: c-decl.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/c-decl.c,v
retrieving revision 1.223
diff -p -r1.223 c-decl.c
*** c-decl.c	1999/01/15 07:57:14	1.223
- --- c-decl.c	1999/03/18 23:17:13
*************** finish_function (nested)
*** 7285,7290 ****
- --- 7285,7293 ----
    if (TREE_THIS_VOLATILE (fndecl) && current_function_returns_null)
      warning ("`noreturn' function does return");
    else if (warn_return_type && can_reach_end
+ #ifdef TARGET_WARN_RETURN_TYPE	   
+ 	   && TARGET_WARN_RETURN_TYPE
+ #endif
  	   && TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl))) != void_type_node)
      /* If this function returns non-void and control can drop through,
         complain.  */

Index: tm.texi
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/tm.texi,v
retrieving revision 1.147
diff -p -r1.147 tm.texi
*** tm.texi	1999/03/17 20:27:45	1.147
- --- tm.texi	1999/03/18 23:17:34
*************** in the system math library, or @samp{""}
*** 7689,7692 ****
- --- 7689,7697 ----
  separate math library.
  
  You need only define this macro if the default of @samp{"-lm"} is wrong.
+ 
+ @findex TARGET_WARN_RETURN_TYPE
+ @item TARGET_WARN_RETURN_TYPE
+ Define this macro if you need to control the production of warning
+ messages about control reaching the end of a non-void function.
  @end table


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