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]
Other format: [Raw text]

new warning for -fwhole-program


Dear All

When the -fwhole-program flag is passed, if the main function is missing, a
warning could be issued to tell the user that no function is left.

This trivial patch makes gcc emit a warning when the main is missing in
-fwhole-program mode (i.e. when all the functions compiled have been
removed).



2006-10-11  Basile Starynkevitch  <basile@starynkevitch.net>

	* cgraphunit.c (cgraph_function_and_variable_visibility): Add 
	"no function remaining in whole program" warning.

Index: gcc/cgraphunit.c
===================================================================
--- gcc/cgraphunit.c	(revision 117632)
+++ gcc/cgraphunit.c	(working copy)
@@ -1463,6 +1463,9 @@ cgraph_function_and_variable_visibility 
      now.  */
   cgraph_remove_unreachable_nodes (true, cgraph_dump_file);
 
+  if (!cgraph_nodes && flag_whole_program)
+    warning (OPT_fwhole_program, "no function remaining in whole program");
+
   if (cgraph_dump_file)
     {
       fprintf (cgraph_dump_file, "\nMarking local functions:");


-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France


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