]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR preprocessor/6517 (gcc hangs on C compile with multiple "-I-")
authorNeil Booth <neil@daikokuya.demon.co.uk>
Thu, 23 May 2002 17:57:46 +0000 (17:57 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Thu, 23 May 2002 17:57:46 +0000 (17:57 +0000)
PR preprocessor/6517
* Makefile.in: Update.
* c-common.c (c_common_post_options): Add preprocessor
errors to the error count.
* c-lang.c (c_post_options): Kill.
(LANG_HOOKS_POST_OPTIONS): Use c_common_post_options.
* hooks.h: Add header guards.
* langhooks-def.h: Include hooks.h.
(LANG_HOOKS_POST_OPTIONS): Update.
* langhooks.h (struct lang_hooks): Update post_options.
* toplev.c (parse_options_and_default_flags): Update.
cp:
* cp-lang.c (LANG_HOOKS_POST_OPTIONS): Use c_common_post_options.
* cp-tree.h (cxx_post_options): Kill.
* cp-lex.c (cxx_post_options): Kill.
objc:
* objc-lang.c (objc_post_options): Kill.
(LANG_HOOKS_POST_OPTIONS): Use c_common_post_options.

From-SVN: r53797

16 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/c-common.c
gcc/c-lang.c
gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/cp/cp-lang.c
gcc/cp/cp-tree.h
gcc/cp/lex.c
gcc/hooks.c
gcc/hooks.h
gcc/langhooks-def.h
gcc/langhooks.h
gcc/objc/Make-lang.in
gcc/objc/objc-lang.c
gcc/toplev.c

index 29635944121256e4eb60058c747b2a0004c6ce2d..af365478d8810c85ab44c05237e36fb1e4ba9294 100644 (file)
@@ -1,3 +1,20 @@
+2002-05-23  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       PR preprocessor/6517
+       * Makefile.in: Update.
+       * c-common.c (c_common_post_options): Add preprocessor
+       errors to the error count.
+       * c-lang.c (c_post_options): Kill.
+       (LANG_HOOKS_POST_OPTIONS): Use c_common_post_options.
+       * hooks.h: Add header guards.
+       * langhooks-def.h: Include hooks.h.
+       (LANG_HOOKS_POST_OPTIONS): Update.
+       * langhooks.h (struct lang_hooks): Update post_options.
+       * toplev.c (parse_options_and_default_flags): Update.
+objc:
+       * objc-lang.c (objc_post_options): Kill.
+       (LANG_HOOKS_POST_OPTIONS): Use c_common_post_options.
+
 2002-05-23  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/6753
index c3593415944eec5fb3305c13fba3f30b34a34ba3..7a0161fa2f690c41cf8e078d9c460600e6d49b8b 100644 (file)
@@ -541,6 +541,7 @@ CONFIG_H = $(GCONFIG_H) insn-constants.h insn-flags.h
 TCONFIG_H = tconfig.h $(xm_file_list)
 TARGET_H = target.h
 HOOKS_H = hooks.h
+LANGHOOKS_DEF_H = langhooks.h $(HOOKS_H)
 TARGET_DEF_H = target-def.h $(HOOKS_H)
 TM_P_H = tm_p.h $(tm_p_file_list) tm-preds.h
 
@@ -1212,7 +1213,7 @@ s-under: $(GCC_PASSES)
 c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(OBSTACK_H) \
        $(C_COMMON_H) flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \
        $(EXPR_H) $(TM_P_H) builtin-types.def builtin-attrs.def $(TARGET_H) \
-       diagnostic.h tree-inline.h
+       diagnostic.h tree-inline.h $(LANGHOOKS_DEF_H)
 
 # A file used by all variants of C and some other languages.
 
@@ -1327,7 +1328,7 @@ convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h convert.h toplev.
 
 langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) toplev.h \
    tree-inline.h $(RTL_H) insn-config.h integrate.h langhooks.h \
-   langhooks-def.h flags.h
+   $(LANGHOOKS_DEF_H) flags.h
 tree.o : tree.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h function.h toplev.h \
    $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) langhooks.h
 tree-dump.o: tree-dump.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \
index 8275df64be25e0cfa035b795fab2073d8ce665c8..5b8b56546268422cf631e0c589fc2105686a570c 100644 (file)
@@ -4161,6 +4161,10 @@ c_common_post_options ()
     warning ("-Wformat-security ignored without -Wformat");
   if (warn_missing_format_attribute && !warn_format)
     warning ("-Wmissing-format-attribute ignored without -Wformat");
+
+  /* If an error has occurred in cpplib, note it so we fail
+     immediately.  */
+  errorcount += cpp_errors (parse_in);
 }
 
 /* Front end initialization common to C, ObjC and C++.  */
index aa6c2ff5b41001f1f623a7e82be49e098d02d13e..2b7d4733f66fe93c05c5e9357221ca2c7fe598c4 100644 (file)
@@ -29,7 +29,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 static const char *c_init PARAMS ((const char *));
 static void c_init_options PARAMS ((void));
-static void c_post_options PARAMS ((void));
 
 /* ### When changing hooks, consider if ObjC needs changing too!! ### */
 
@@ -44,7 +43,7 @@ static void c_post_options PARAMS ((void));
 #undef LANG_HOOKS_DECODE_OPTION
 #define LANG_HOOKS_DECODE_OPTION c_decode_option
 #undef LANG_HOOKS_POST_OPTIONS
-#define LANG_HOOKS_POST_OPTIONS c_post_options
+#define LANG_HOOKS_POST_OPTIONS c_common_post_options
 #undef LANG_HOOKS_GET_ALIAS_SET
 #define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
 #undef LANG_HOOKS_SAFE_FROM_P
@@ -74,13 +73,6 @@ static void c_post_options PARAMS ((void));
 /* Each front end provides its own.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
-/* Post-switch processing.  */
-static void
-c_post_options ()
-{
-  c_common_post_options ();
-}
-
 static void
 c_init_options ()
 {
index 1aaa09f5425dd4c48d24904d1cf084c92dc22f43..6a45ea3c6f9456ee12a6490b9ad0b70aa0a62ff7 100644 (file)
@@ -1,3 +1,9 @@
+2002-05-23  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * cp-lang.c (LANG_HOOKS_POST_OPTIONS): Use c_common_post_options.
+       * cp-tree.h (cxx_post_options): Kill.
+       * cp-lex.c (cxx_post_options): Kill.
+
 2002-05-19  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        * error.c (dump_type) [TYPEOF_TYPE]: Fix parenthesis printing.
index de4a372e80c8bd13152258b4588be97f22c4cc9a..df2de35fad9dcc7350731b38a8c86dac2ecc0274 100644 (file)
@@ -251,7 +251,7 @@ cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h
 cp/lex.o: cp/lex.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h c-pragma.h \
   toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h cp/operators.def \
   $(TM_P_H)
-cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) toplev.h langhooks.h langhooks-def.h \
+cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) toplev.h langhooks.h $(LANGHOOKS_DEF_H) \
   c-common.h
 cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \
   output.h $(EXPR_H) except.h toplev.h hash.h $(GGC_H) $(RTL_H) \
index c40330bc319a39d2ecddd99a4b407262b1ecb9d4..931523e8e012e116214da381fb0bb0eb2981639c 100644 (file)
@@ -1,5 +1,5 @@
 /* Language-dependent hooks for C++.
-   Copyright 2001 Free Software Foundation, Inc.
+   Copyright 2001, 2002 Free Software Foundation, Inc.
    Contributed by Alexandre Oliva  <aoliva@redhat.com>
 
 This file is part of GNU CC.
@@ -43,7 +43,7 @@ static HOST_WIDE_INT cxx_get_alias_set PARAMS ((tree));
 #undef LANG_HOOKS_DECODE_OPTION
 #define LANG_HOOKS_DECODE_OPTION cxx_decode_option
 #undef LANG_HOOKS_POST_OPTIONS
-#define LANG_HOOKS_POST_OPTIONS cxx_post_options
+#define LANG_HOOKS_POST_OPTIONS c_common_post_options
 #undef LANG_HOOKS_GET_ALIAS_SET
 #define LANG_HOOKS_GET_ALIAS_SET cxx_get_alias_set
 #undef LANG_HOOKS_EXPAND_CONSTANT
index 73898f888c6d0a90618e6b3ad8714d64a7368403..bfc6e339bce041ddbc2b0161f334723c2e41bf84 100644 (file)
@@ -3961,7 +3961,6 @@ extern int cp_type_qual_from_rid                PARAMS ((tree));
 extern const char *cxx_init                    PARAMS ((const char *));
 extern void cxx_finish PARAMS ((void));
 extern void cxx_init_options PARAMS ((void));
-extern void cxx_post_options PARAMS ((void));
 
 /* in method.c */
 extern void init_method                                PARAMS ((void));
index 61e34a8953d444dd25886cb5aace8f62f71b9f6b..d68957a9963ee513dffddc9ce6552591dc3ff65e 100644 (file)
@@ -1,6 +1,6 @@
 /* Separate lexical analyzer for GNU C++.
    Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    Hacked by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GNU CC.
@@ -237,13 +237,6 @@ static const char *const cplus_tree_code_name[] = {
 };
 #undef DEFTREECODE
 \f
-/* Post-switch processing.  */
-void
-cxx_post_options ()
-{
-  c_common_post_options ();
-}
-
 /* Initialization before switch parsing.  */
 void
 cxx_init_options ()
index 387f4db961a8697b7af3cee8499c31385d804680..3fd876a208c042c7f08ff0294a9720ecffb6a3aa 100644 (file)
@@ -26,6 +26,12 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #include "system.h"
 #include "hooks.h"
 
+/* Generic hook that does absolutely zappo.  */
+void
+hook_void_void ()
+{
+}
+
 /* Generic hook that takes no arguments and returns false.  */
 bool
 hook_void_bool_false ()
index 7a8daa55d7fd52502e44b28eb98e6fbd5946f4a7..763ab8efc2ed888cc446be92e8865e7f820ebabf 100644 (file)
@@ -19,4 +19,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  You are forbidden to forbid anyone else to use, share and improve
  what you give them.   Help stamp out software-hoarding!  */
 
+#ifndef GCC_HOOKS_H
+#define GCC_HOOKS_H
+
 bool hook_void_bool_false PARAMS ((void));
+void hook_void_void PARAMS ((void));
+
+#endif
index be8304a320b074d70f98ebabf45118d10bd96241..bb00b501cc6ceb92aa30cbb2bf3c9ed18cecc45a 100644 (file)
@@ -22,6 +22,8 @@ Boston, MA 02111-1307, USA.  */
 #ifndef GCC_LANG_HOOKS_DEF_H
 #define GCC_LANG_HOOKS_DEF_H
 
+#include "hooks.h"
+
 /* Provide a hook routine for alias sets that always returns 1.  This is
    used by languages that haven't deal with alias sets yet.  */
 extern HOST_WIDE_INT hook_get_alias_set_0      PARAMS ((tree));
@@ -71,7 +73,7 @@ tree lhd_tree_inlining_convert_parm_for_inlining PARAMS ((tree, tree, tree));
 #define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack
 #define LANG_HOOKS_INIT_OPTIONS                lhd_do_nothing
 #define LANG_HOOKS_DECODE_OPTION       lhd_decode_option
-#define LANG_HOOKS_POST_OPTIONS                lhd_do_nothing
+#define LANG_HOOKS_POST_OPTIONS                hook_void_void
 #define LANG_HOOKS_GET_ALIAS_SET       lhd_get_alias_set
 #define LANG_HOOKS_EXPAND_CONSTANT     lhd_return_tree
 #define LANG_HOOKS_SAFE_FROM_P         lhd_safe_from_p
index 56b818fc574542df5d00668a67b095f0235111a6..368f47d31a55cb892a8d01072d474cf8d016ceae 100644 (file)
@@ -93,7 +93,10 @@ struct lang_hooks
   /* Called when all command line options have been parsed.  Should do
      any required consistency checks, modifications etc.  Complex
      initialization should be left to the "init" callback, since GC
-     and the identifier hashes are set up between now and then.  */
+     and the identifier hashes are set up between now and then.
+
+     If errorcount is non-zero after this call the compiler exits
+     immediately and the finish hook is not called.  */
   void (*post_options) PARAMS ((void));
 
   /* Called after post_options, to initialize the front end.  The main
index bc5f709c579d1128eeb4f0cecffaf1468c89079f..379a16cfdbb3c7918e07930121d8ff95d14594c5 100644 (file)
@@ -93,7 +93,7 @@ objc-act.o : $(srcdir)/objc/objc-act.c \
    $(srcdir)/c-tree.h $(srcdir)/c-common.h $(srcdir)/c-lex.h \
    $(srcdir)/toplev.h $(srcdir)/flags.h $(srcdir)/objc/objc-act.h \
    $(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h $(srcdir)/debug.h \
-   $(srcdir)/langhooks.h $(srcdir)/langhooks-def.h
+   $(srcdir)/langhooks.h $(LANGHOOKS_DEF_H)
        $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
        -c $(srcdir)/objc/objc-act.c
 
index 874a9c3d27681f57c46df4a8b3e313c9a91f68c9..b62aa0f71b1d616d8c52d8944721cfa22a78575b 100644 (file)
@@ -1,5 +1,5 @@
 /* Language-dependent hooks for Objective-C.
-   Copyright 2001 Free Software Foundation, Inc.
+   Copyright 2001, 2002 Free Software Foundation, Inc.
    Contributed by Ziemowit Laski  <zlaski@apple.com>
 
 This file is part of GNU CC.
@@ -30,7 +30,6 @@ Boston, MA 02111-1307, USA.  */
 #include "langhooks-def.h"
 
 static void objc_init_options                   PARAMS ((void));
-static void objc_post_options                   PARAMS ((void));
 
 #undef LANG_HOOKS_NAME
 #define LANG_HOOKS_NAME "GNU Objective-C"  
@@ -43,7 +42,7 @@ static void objc_post_options                   PARAMS ((void));
 #undef LANG_HOOKS_DECODE_OPTION
 #define LANG_HOOKS_DECODE_OPTION objc_decode_option
 #undef LANG_HOOKS_POST_OPTIONS
-#define LANG_HOOKS_POST_OPTIONS objc_post_options
+#define LANG_HOOKS_POST_OPTIONS c_common_post_options
 #undef LANG_HOOKS_STATICP
 #define LANG_HOOKS_STATICP c_staticp
 #undef LANG_HOOKS_PRINT_IDENTIFIER
@@ -72,13 +71,3 @@ objc_init_options ()
 {
   c_common_init_options (clk_objective_c);
 } 
-
-/* Post-switch processing.  */
-
-static void
-objc_post_options ()
-{
-  c_common_post_options ();
-}
-
-
index b4a9b58f1abb8f746b9b1734ca514e237233492c..8cb7ec1b15228f092b98fc105a2ea15f081cad37 100644 (file)
@@ -5226,7 +5226,7 @@ toplev_main (argc, argv)
   parse_options_and_default_flags (argc, argv);
 
   /* Exit early if we can (e.g. -help).  */
-  if (!exit_after_options)
+  if (!errorcount && !exit_after_options)
     do_compile ();
 
   if (errorcount || sorrycount)