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]

patch to enable *.cc files in gengtype


Hello All,

The attached patch (for trunk svn rev 202160) 
to gcc/gengtype.c permits files named *.cc (by adding another rule) 
to be passed to gengtype and gives a slightly meaningful fatal 
error message whan an unrecogized file name (e.g. *.cpp or something 
even more wild) is passed to gengtype. 
FWIW, this patch is imported from melt-branch svn rev 202160.


#### gcc/ChangeLog entry 

2013-09-02  Basile Starynkevitch  <basile@starynkevitch.net>

	* gengtype.c (file_rules): Added rule for *.cc files.
	(get_output_file_with_visibility): Give fatal message when no
	rules found.

###

Ok for trunk?

Cheers
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***
Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c	(revision 202160)
+++ gcc/gengtype.c	(working copy)
@@ -2004,14 +2004,21 @@
     REG_EXTENDED, NULL_REGEX,
     "gt-objc-objc-map.h", "objc/objc-map.c", NULL_FRULACT },
 
-  /* General cases.  For header *.h and source *.c files, we need
-   * special actions to handle the language.  */
+  /* General cases.  For header *.h and source *.c or *.cc files, we
+   * need special actions to handle the language.  */
 
   /* Source *.c files are using get_file_gtfilename to compute their
      output_name and get_file_basename to compute their for_name
      through the source_dot_c_frul action.  */
   { DIR_PREFIX_REGEX "([[:alnum:]_-]*)\\.c$",
     REG_EXTENDED, NULL_REGEX, "gt-$3.h", "$3.c", source_dot_c_frul},
+
+  /* Source *.cc files are using get_file_gtfilename to compute their
+     output_name and get_file_basename to compute their for_name
+     through the source_dot_c_frul action.  */
+  { DIR_PREFIX_REGEX "([[:alnum:]_-]*)\\.cc$",
+    REG_EXTENDED, NULL_REGEX, "gt-$3.h", "$3.cc", source_dot_c_frul},
+
   /* Common header files get "gtype-desc.c" as their output_name,
    * while language specific header files are handled specially.  So
    * we need the header_dot_h_frul action.  */
@@ -2269,9 +2276,9 @@
   }
   if (!output_name || !for_name)
     {
-      /* This is impossible, and could only happen if the files_rules is
-	 incomplete or buggy.  */
-      gcc_unreachable ();
+      /* This should not be possible, and could only happen if the
+	 files_rules is incomplete or buggy.  */
+      fatal ("failed to compute output name for %s", inpfname);
     }
 
   /* Look through to see if we've ever seen this output filename

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