This implements the C++ overides of the langhooks I introduced.


--
Nathan Sidwell

diff --git c/gcc/cp/cp-lang.c w/gcc/cp/cp-lang.c
index 9e980bc6de9..d75fa8ab708 100644
--- c/gcc/cp/cp-lang.c
+++ w/gcc/cp/cp-lang.c
@@ -77,6 +77,16 @@ static tree cxx_enum_underlying_base_type (const_tree);
 #define LANG_HOOKS_EH_RUNTIME_TYPE build_eh_type_type
 #undef LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE
 #define LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE cxx_enum_underlying_base_type
+#undef LANG_HOOKS_PREPROCESS_MAIN_FILE
+#define LANG_HOOKS_PREPROCESS_MAIN_FILE module_begin_main_file
+#undef LANG_HOOKS_PREPROCESS_OPTIONS
+#define LANG_HOOKS_PREPROCESS_OPTIONS module_preprocess_options
+#undef LANG_HOOKS_PREPROCESS_UNDEF
+#define LANG_HOOKS_PREPROCESS_UNDEF module_cpp_undef
+#undef LANG_HOOKS_PREPROCESS_DEFERRED_MACRO
+#define LANG_HOOKS_PREPROCESS_DEFERRED_MACRO module_cpp_deferred_macro
+#undef LANG_HOOKS_PREPROCESS_TOKEN
+#define LANG_HOOKS_PREPROCESS_TOKEN module_token_pre
 
 #if CHECKING_P
 #undef LANG_HOOKS_RUN_LANG_SELFTESTS
diff --git c/gcc/cp/cp-objcp-common.c w/gcc/cp/cp-objcp-common.c
index e1397b7b710..d215fb07285 100644
--- c/gcc/cp/cp-objcp-common.c
+++ w/gcc/cp/cp-objcp-common.c
@@ -436,6 +436,9 @@ cp_register_dumps (gcc::dump_manager *dumps)
   class_dump_id = dumps->dump_register
     (".class", "lang-class", "lang-class", DK_lang, OPTGROUP_NONE, false);
 
+  module_dump_id = dumps->dump_register
+    (".module", "lang-module", "lang-module", DK_lang, OPTGROUP_NONE, false);
+
   raw_dump_id = dumps->dump_register
     (".raw", "lang-raw", "lang-raw", DK_lang, OPTGROUP_NONE, false);
 }
@@ -548,4 +551,16 @@ cp_common_init_ts (void)
   c_common_init_ts ();
 }
 
+/* Handle C++-specficic options here.  Punt to c_common otherwise.  */
+
+bool
+cp_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
+		  int kind, location_t loc,
+		  const struct cl_option_handlers *handlers)
+{
+  if (handle_module_option (unsigned (scode), arg, value))
+    return true;
+  return c_common_handle_option (scode, arg, value, kind, loc, handlers);
+}
+
 #include "gt-cp-cp-objcp-common.h"
diff --git c/gcc/cp/cp-objcp-common.h w/gcc/cp/cp-objcp-common.h
index 0936f166d5b..4b5b96fedbc 100644
--- c/gcc/cp/cp-objcp-common.h
+++ w/gcc/cp/cp-objcp-common.h
@@ -34,6 +34,8 @@ extern tree cp_unit_size_without_reusable_padding (tree);
 extern tree cp_get_global_decls ();
 extern tree cp_pushdecl (tree);
 extern void cp_register_dumps (gcc::dump_manager *);
+extern bool cp_handle_option (size_t, const char *, HOST_WIDE_INT, int,
+			      location_t, const struct cl_option_handlers *);
 extern tree cxx_make_type_hook			(tree_code);
 extern tree cxx_simulate_enum_decl (location_t, const char *,
 				    vec<string_int_pair>);
@@ -63,7 +65,7 @@ extern tree cxx_simulate_enum_decl (location_t, const char *,
 #undef LANG_HOOKS_REGISTER_DUMPS
 #define LANG_HOOKS_REGISTER_DUMPS cp_register_dumps
 #undef LANG_HOOKS_HANDLE_OPTION
-#define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
+#define LANG_HOOKS_HANDLE_OPTION cp_handle_option
 #undef LANG_HOOKS_HANDLE_FILENAME
 #define LANG_HOOKS_HANDLE_FILENAME c_common_handle_filename
 #undef LANG_HOOKS_POST_OPTIONS

Reply via email to