Patchwork Remove -dy and set_yydebug

login
register
mail settings
Submitter Joseph S. Myers
Date Nov. 17, 2010, 2:09 p.m.
Message ID <Pine.LNX.4.64.1011171408180.8694@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/71571/
State New
Headers show

Comments

Joseph S. Myers - Nov. 17, 2010, 2:09 p.m.
The lang_hooks.parse_file hook has a set_yydebug argument intended to
enable Bison parser debugging (-dy).  No current front end uses it to
do anything other than warn that it is not supported.  Unsupported -d
options get a warning anyway from decode_d_option; this patch removes
the -dy option and the argument to lang_hooks.parse_file.  (If any
future or out-of-tree front end should wish to have parser dumps in
some form, it can obviously have its own option for them, but a
generic option used by no in-tree front end is silly.)  The motivation
of this patch is to get rid of the set_yydebug global state set by -dy
(since it's useless, getting rid of it is better than moving it into
global_options or deferring that option processing).

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit (the non-front-end parts; the mechanical front-end changes are
preapproved)?

2010-11-17  Joseph Myers  <joseph@codesourcery.com>

	* doc/invoke.texi (-dy): Remove.
	* langhooks-def.h (lhd_do_nothing_i): Don't declare.
	(LANG_HOOKS_PARSE_FILE): Define to lhd_do_nothing.
	* langhooks.c (lhd_do_nothing_i): Remove.
	* langhooks.h (lang_hooks.parse_file): Take no arguments.
	* toplev.c (set_yydebug): Remove.
	(compile_file): Update call to lang_hooks.parse_file.
	(decode_d_option): Don't handle -dy.

ada:
2010-11-17  Joseph Myers  <joseph@codesourcery.com>

	* gcc-interface/misc.c (gnat_parse_file): Take no arguments.

c-family:
2010-11-17  Joseph Myers  <joseph@codesourcery.com>

	* c-opts.c (c_common_parse_file): Take no arguments.
	* c-common.h (c_common_parse_file): Update prototype.

fortran:
2010-11-17  Joseph Myers  <joseph@codesourcery.com>

	* f95-lang.c (gfc_be_parse_file): Take no arguments.

java:
2010-11-17  Joseph Myers  <joseph@codesourcery.com>

	* jcf-parse.c (java_parse_file): Take no arguments.
	* java-tree.h (java_parse_file): Update prototype.

lto:
2010-11-17  Joseph Myers  <joseph@codesourcery.com>

	* lto.c (lto_main): Take no arguments.
	* lto.h (lto_main): Update prototype.
Richard Guenther - Nov. 17, 2010, 2:12 p.m.
On Wed, Nov 17, 2010 at 3:09 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> The lang_hooks.parse_file hook has a set_yydebug argument intended to
> enable Bison parser debugging (-dy).  No current front end uses it to
> do anything other than warn that it is not supported.  Unsupported -d
> options get a warning anyway from decode_d_option; this patch removes
> the -dy option and the argument to lang_hooks.parse_file.  (If any
> future or out-of-tree front end should wish to have parser dumps in
> some form, it can obviously have its own option for them, but a
> generic option used by no in-tree front end is silly.)  The motivation
> of this patch is to get rid of the set_yydebug global state set by -dy
> (since it's useless, getting rid of it is better than moving it into
> global_options or deferring that option processing).
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
> commit (the non-front-end parts; the mechanical front-end changes are
> preapproved)?

Ok.

Thanks,
Richard.

> 2010-11-17  Joseph Myers  <joseph@codesourcery.com>
>
>        * doc/invoke.texi (-dy): Remove.
>        * langhooks-def.h (lhd_do_nothing_i): Don't declare.
>        (LANG_HOOKS_PARSE_FILE): Define to lhd_do_nothing.
>        * langhooks.c (lhd_do_nothing_i): Remove.
>        * langhooks.h (lang_hooks.parse_file): Take no arguments.
>        * toplev.c (set_yydebug): Remove.
>        (compile_file): Update call to lang_hooks.parse_file.
>        (decode_d_option): Don't handle -dy.
>
> ada:
> 2010-11-17  Joseph Myers  <joseph@codesourcery.com>
>
>        * gcc-interface/misc.c (gnat_parse_file): Take no arguments.
>
> c-family:
> 2010-11-17  Joseph Myers  <joseph@codesourcery.com>
>
>        * c-opts.c (c_common_parse_file): Take no arguments.
>        * c-common.h (c_common_parse_file): Update prototype.
>
> fortran:
> 2010-11-17  Joseph Myers  <joseph@codesourcery.com>
>
>        * f95-lang.c (gfc_be_parse_file): Take no arguments.
>
> java:
> 2010-11-17  Joseph Myers  <joseph@codesourcery.com>
>
>        * jcf-parse.c (java_parse_file): Take no arguments.
>        * java-tree.h (java_parse_file): Update prototype.
>
> lto:
> 2010-11-17  Joseph Myers  <joseph@codesourcery.com>
>
>        * lto.c (lto_main): Take no arguments.
>        * lto.h (lto_main): Update prototype.
>
> Index: gcc/doc/invoke.texi
> ===================================================================
> --- gcc/doc/invoke.texi (revision 166795)
> +++ gcc/doc/invoke.texi (working copy)
> @@ -5275,10 +5275,6 @@ to @file{@var{file}.@var{pass}.vcg}.
>  @opindex dx
>  Just generate RTL for a function instead of compiling it.  Usually used
>  with @option{-fdump-rtl-expand}.
> -
> -@item -dy
> -@opindex dy
> -Dump debugging information during parsing, to standard error.
>  @end table
>
>  @item -fdump-noaddr
> Index: gcc/c-family/c-opts.c
> ===================================================================
> --- gcc/c-family/c-opts.c       (revision 166795)
> +++ gcc/c-family/c-opts.c       (working copy)
> @@ -1057,31 +1057,10 @@ c_common_init (void)
>  /* Initialize the integrated preprocessor after debug output has been
>    initialized; loop over each input file.  */
>  void
> -c_common_parse_file (int set_yydebug)
> +c_common_parse_file (void)
>  {
>   unsigned int i;
>
> -  if (set_yydebug)
> -    switch (c_language)
> -      {
> -      case clk_c:
> -       warning(0, "the C parser does not support -dy, option ignored");
> -       break;
> -      case clk_objc:
> -       warning(0,
> -               "the Objective-C parser does not support -dy, option ignored");
> -       break;
> -      case clk_cxx:
> -       warning(0, "the C++ parser does not support -dy, option ignored");
> -       break;
> -      case clk_objcxx:
> -       warning(0,
> -           "the Objective-C++ parser does not support -dy, option ignored");
> -       break;
> -      default:
> -       gcc_unreachable ();
> -    }
> -
>   i = 0;
>   for (;;)
>     {
> Index: gcc/c-family/c-common.h
> ===================================================================
> --- gcc/c-family/c-common.h     (revision 166795)
> +++ gcc/c-family/c-common.h     (working copy)
> @@ -771,7 +771,7 @@ extern void c_common_init_options (unsig
>  extern bool c_common_post_options (const char **);
>  extern bool c_common_init (void);
>  extern void c_common_finish (void);
> -extern void c_common_parse_file (int);
> +extern void c_common_parse_file (void);
>  extern alias_set_type c_common_get_alias_set (tree);
>  extern void c_register_builtin_type (tree, const char*);
>  extern bool c_promoting_integer_type_p (const_tree);
> Index: gcc/java/jcf-parse.c
> ===================================================================
> --- gcc/java/jcf-parse.c        (revision 166795)
> +++ gcc/java/jcf-parse.c        (working copy)
> @@ -1732,7 +1732,7 @@ java_emit_static_constructor (void)
>
>
>  void
> -java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
> +java_parse_file (void)
>  {
>   int filename_count = 0;
>   location_t save_location = input_location;
> Index: gcc/java/java-tree.h
> ===================================================================
> --- gcc/java/java-tree.h        (revision 166795)
> +++ gcc/java/java-tree.h        (working copy)
> @@ -939,7 +939,7 @@ struct GTY((variable_size)) lang_type {
>  /* Defined in java-except.h  */
>  struct eh_range;
>
> -extern void java_parse_file (int);
> +extern void java_parse_file (void);
>  extern tree java_type_for_mode (enum machine_mode, int);
>  extern tree java_type_for_size (unsigned int, int);
>  extern tree java_truthvalue_conversion (tree);
> Index: gcc/toplev.c
> ===================================================================
> --- gcc/toplev.c        (revision 166795)
> +++ gcc/toplev.c        (working copy)
> @@ -117,9 +117,6 @@ static void crash_signal (int) ATTRIBUTE
>  static void setup_core_dumping (void);
>  static void compile_file (void);
>
> -/* Nonzero to dump debug info whilst parsing (-dy option).  */
> -static int set_yydebug;
> -
>  /* True if we don't need a backend (e.g. preprocessing only).  */
>  static bool no_backend;
>
> @@ -870,7 +867,7 @@ compile_file (void)
>
>   /* Call the parser, which parses the entire file (calling
>      rest_of_compilation for each function).  */
> -  lang_hooks.parse_file (set_yydebug);
> +  lang_hooks.parse_file ();
>
>   /* Compilation is now finished except for writing
>      what's left of the symbol table output.  */
> @@ -993,9 +990,6 @@ decode_d_option (const char *arg)
>       case 'x':
>        rtl_dump_and_exit = 1;
>        break;
> -      case 'y':
> -       set_yydebug = 1;
> -       break;
>       case 'D':        /* These are handled by the preprocessor.  */
>       case 'I':
>       case 'M':
> Index: gcc/ada/gcc-interface/misc.c
> ===================================================================
> --- gcc/ada/gcc-interface/misc.c        (revision 166795)
> +++ gcc/ada/gcc-interface/misc.c        (working copy)
> @@ -77,7 +77,7 @@ extern void _ada_gnat1drv (void);
>  /* The parser for the language.  For us, we process the GNAT tree.  */
>
>  static void
> -gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
> +gnat_parse_file (void)
>  {
>   int seh[2];
>
> Index: gcc/fortran/f95-lang.c
> ===================================================================
> --- gcc/fortran/f95-lang.c      (revision 166795)
> +++ gcc/fortran/f95-lang.c      (working copy)
> @@ -93,7 +93,7 @@ static void gfc_print_identifier (FILE *
>  void do_function_end (void);
>  int global_bindings_p (void);
>  static void clear_binding_stack (void);
> -static void gfc_be_parse_file (int);
> +static void gfc_be_parse_file (void);
>  static alias_set_type gfc_get_alias_set (tree);
>  static void gfc_init_ts (void);
>
> @@ -241,7 +241,7 @@ gfc_create_decls (void)
>
>
>  static void
> -gfc_be_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
> +gfc_be_parse_file (void)
>  {
>   int errors;
>   int warnings;
> Index: gcc/langhooks.c
> ===================================================================
> --- gcc/langhooks.c     (revision 166795)
> +++ gcc/langhooks.c     (working copy)
> @@ -62,13 +62,6 @@ lhd_pass_through_t (tree t)
>   return t;
>  }
>
> -/* Do nothing (int).  */
> -
> -void
> -lhd_do_nothing_i (int ARG_UNUSED (i))
> -{
> -}
> -
>  /* Do nothing (int, int, int).  Return NULL_TREE.  */
>
>  tree
> Index: gcc/langhooks.h
> ===================================================================
> --- gcc/langhooks.h     (revision 166795)
> +++ gcc/langhooks.h     (working copy)
> @@ -317,9 +317,8 @@ struct lang_hooks
>   /* Called at the end of compilation, as a finalizer.  */
>   void (*finish) (void);
>
> -  /* Parses the entire file.  The argument is nonzero to cause bison
> -     parsers to dump debugging information during parsing.  */
> -  void (*parse_file) (int);
> +  /* Parses the entire file.  */
> +  void (*parse_file) (void);
>
>   /* Determines if it's ok for a function to have no noreturn attribute.  */
>   bool (*missing_noreturn_ok_p) (tree);
> Index: gcc/lto/lto.c
> ===================================================================
> --- gcc/lto/lto.c       (revision 166795)
> +++ gcc/lto/lto.c       (working copy)
> @@ -2437,7 +2437,7 @@ lto_process_name (void)
>      simply applies them.  */
>
>  void
> -lto_main (int debug_p ATTRIBUTE_UNUSED)
> +lto_main (void)
>  {
>   lto_process_name ();
>
> Index: gcc/lto/lto.h
> ===================================================================
> --- gcc/lto/lto.h       (revision 166795)
> +++ gcc/lto/lto.h       (working copy)
> @@ -37,7 +37,7 @@ extern const char *resolution_file_name;
>
>  /* In lto.c  */
>  extern tree lto_eh_personality (void);
> -extern void lto_main (int);
> +extern void lto_main (void);
>  extern void lto_read_all_file_options (void);
>
>  /* In lto-elf.c or lto-coff.c  */
> Index: gcc/langhooks-def.h
> ===================================================================
> --- gcc/langhooks-def.h (revision 166795)
> +++ gcc/langhooks-def.h (working copy)
> @@ -37,7 +37,6 @@ struct diagnostic_info;
>
>  extern void lhd_do_nothing (void);
>  extern void lhd_do_nothing_t (tree);
> -extern void lhd_do_nothing_i (int);
>  extern void lhd_do_nothing_f (struct function *);
>  extern tree lhd_pass_through_t (tree);
>  extern bool lhd_post_options (const char **);
> @@ -85,7 +84,7 @@ extern void lhd_omp_firstprivatize_type_
>  #define LANG_HOOKS_IDENTIFIER_SIZE     sizeof (struct lang_identifier)
>  #define LANG_HOOKS_INIT                        hook_bool_void_false
>  #define LANG_HOOKS_FINISH              lhd_do_nothing
> -#define LANG_HOOKS_PARSE_FILE          lhd_do_nothing_i
> +#define LANG_HOOKS_PARSE_FILE          lhd_do_nothing
>  #define LANG_HOOKS_OPTION_LANG_MASK    hook_uint_void_0
>  #define LANG_HOOKS_INIT_OPTIONS_STRUCT hook_void_gcc_optionsp
>  #define LANG_HOOKS_INIT_OPTIONS                lhd_init_options
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>

Patch

Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 166795)
+++ gcc/doc/invoke.texi	(working copy)
@@ -5275,10 +5275,6 @@  to @file{@var{file}.@var{pass}.vcg}.
 @opindex dx
 Just generate RTL for a function instead of compiling it.  Usually used
 with @option{-fdump-rtl-expand}.
-
-@item -dy
-@opindex dy
-Dump debugging information during parsing, to standard error.
 @end table
 
 @item -fdump-noaddr
Index: gcc/c-family/c-opts.c
===================================================================
--- gcc/c-family/c-opts.c	(revision 166795)
+++ gcc/c-family/c-opts.c	(working copy)
@@ -1057,31 +1057,10 @@  c_common_init (void)
 /* Initialize the integrated preprocessor after debug output has been
    initialized; loop over each input file.  */
 void
-c_common_parse_file (int set_yydebug)
+c_common_parse_file (void)
 {
   unsigned int i;
 
-  if (set_yydebug)
-    switch (c_language)
-      {
-      case clk_c:
-	warning(0, "the C parser does not support -dy, option ignored");
-	break;
-      case clk_objc:
-	warning(0,
-		"the Objective-C parser does not support -dy, option ignored");
-	break;
-      case clk_cxx:
-	warning(0, "the C++ parser does not support -dy, option ignored");
-	break;
-      case clk_objcxx:
-	warning(0,
-	    "the Objective-C++ parser does not support -dy, option ignored");
-	break;
-      default:
-	gcc_unreachable ();
-    }
-
   i = 0;
   for (;;)
     {
Index: gcc/c-family/c-common.h
===================================================================
--- gcc/c-family/c-common.h	(revision 166795)
+++ gcc/c-family/c-common.h	(working copy)
@@ -771,7 +771,7 @@  extern void c_common_init_options (unsig
 extern bool c_common_post_options (const char **);
 extern bool c_common_init (void);
 extern void c_common_finish (void);
-extern void c_common_parse_file (int);
+extern void c_common_parse_file (void);
 extern alias_set_type c_common_get_alias_set (tree);
 extern void c_register_builtin_type (tree, const char*);
 extern bool c_promoting_integer_type_p (const_tree);
Index: gcc/java/jcf-parse.c
===================================================================
--- gcc/java/jcf-parse.c	(revision 166795)
+++ gcc/java/jcf-parse.c	(working copy)
@@ -1732,7 +1732,7 @@  java_emit_static_constructor (void)
 
 
 void
-java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
+java_parse_file (void)
 {
   int filename_count = 0;
   location_t save_location = input_location;
Index: gcc/java/java-tree.h
===================================================================
--- gcc/java/java-tree.h	(revision 166795)
+++ gcc/java/java-tree.h	(working copy)
@@ -939,7 +939,7 @@  struct GTY((variable_size)) lang_type {
 /* Defined in java-except.h  */
 struct eh_range;
 
-extern void java_parse_file (int);
+extern void java_parse_file (void);
 extern tree java_type_for_mode (enum machine_mode, int);
 extern tree java_type_for_size (unsigned int, int);
 extern tree java_truthvalue_conversion (tree);
Index: gcc/toplev.c
===================================================================
--- gcc/toplev.c	(revision 166795)
+++ gcc/toplev.c	(working copy)
@@ -117,9 +117,6 @@  static void crash_signal (int) ATTRIBUTE
 static void setup_core_dumping (void);
 static void compile_file (void);
 
-/* Nonzero to dump debug info whilst parsing (-dy option).  */
-static int set_yydebug;
-
 /* True if we don't need a backend (e.g. preprocessing only).  */
 static bool no_backend;
 
@@ -870,7 +867,7 @@  compile_file (void)
 
   /* Call the parser, which parses the entire file (calling
      rest_of_compilation for each function).  */
-  lang_hooks.parse_file (set_yydebug);
+  lang_hooks.parse_file ();
 
   /* Compilation is now finished except for writing
      what's left of the symbol table output.  */
@@ -993,9 +990,6 @@  decode_d_option (const char *arg)
       case 'x':
 	rtl_dump_and_exit = 1;
 	break;
-      case 'y':
-	set_yydebug = 1;
-	break;
       case 'D':	/* These are handled by the preprocessor.  */
       case 'I':
       case 'M':
Index: gcc/ada/gcc-interface/misc.c
===================================================================
--- gcc/ada/gcc-interface/misc.c	(revision 166795)
+++ gcc/ada/gcc-interface/misc.c	(working copy)
@@ -77,7 +77,7 @@  extern void _ada_gnat1drv (void);
 /* The parser for the language.  For us, we process the GNAT tree.  */
 
 static void
-gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
+gnat_parse_file (void)
 {
   int seh[2];
 
Index: gcc/fortran/f95-lang.c
===================================================================
--- gcc/fortran/f95-lang.c	(revision 166795)
+++ gcc/fortran/f95-lang.c	(working copy)
@@ -93,7 +93,7 @@  static void gfc_print_identifier (FILE *
 void do_function_end (void);
 int global_bindings_p (void);
 static void clear_binding_stack (void);
-static void gfc_be_parse_file (int);
+static void gfc_be_parse_file (void);
 static alias_set_type gfc_get_alias_set (tree);
 static void gfc_init_ts (void);
 
@@ -241,7 +241,7 @@  gfc_create_decls (void)
 
 
 static void
-gfc_be_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
+gfc_be_parse_file (void)
 {
   int errors;
   int warnings;
Index: gcc/langhooks.c
===================================================================
--- gcc/langhooks.c	(revision 166795)
+++ gcc/langhooks.c	(working copy)
@@ -62,13 +62,6 @@  lhd_pass_through_t (tree t)
   return t;
 }
 
-/* Do nothing (int).  */
-
-void
-lhd_do_nothing_i (int ARG_UNUSED (i))
-{
-}
-
 /* Do nothing (int, int, int).  Return NULL_TREE.  */
 
 tree
Index: gcc/langhooks.h
===================================================================
--- gcc/langhooks.h	(revision 166795)
+++ gcc/langhooks.h	(working copy)
@@ -317,9 +317,8 @@  struct lang_hooks
   /* Called at the end of compilation, as a finalizer.  */
   void (*finish) (void);
 
-  /* Parses the entire file.  The argument is nonzero to cause bison
-     parsers to dump debugging information during parsing.  */
-  void (*parse_file) (int);
+  /* Parses the entire file.  */
+  void (*parse_file) (void);
 
   /* Determines if it's ok for a function to have no noreturn attribute.  */
   bool (*missing_noreturn_ok_p) (tree);
Index: gcc/lto/lto.c
===================================================================
--- gcc/lto/lto.c	(revision 166795)
+++ gcc/lto/lto.c	(working copy)
@@ -2437,7 +2437,7 @@  lto_process_name (void)
      simply applies them.  */
 
 void
-lto_main (int debug_p ATTRIBUTE_UNUSED)
+lto_main (void)
 {
   lto_process_name ();
 
Index: gcc/lto/lto.h
===================================================================
--- gcc/lto/lto.h	(revision 166795)
+++ gcc/lto/lto.h	(working copy)
@@ -37,7 +37,7 @@  extern const char *resolution_file_name;
 
 /* In lto.c  */
 extern tree lto_eh_personality (void);
-extern void lto_main (int);
+extern void lto_main (void);
 extern void lto_read_all_file_options (void);
 
 /* In lto-elf.c or lto-coff.c  */
Index: gcc/langhooks-def.h
===================================================================
--- gcc/langhooks-def.h	(revision 166795)
+++ gcc/langhooks-def.h	(working copy)
@@ -37,7 +37,6 @@  struct diagnostic_info;
 
 extern void lhd_do_nothing (void);
 extern void lhd_do_nothing_t (tree);
-extern void lhd_do_nothing_i (int);
 extern void lhd_do_nothing_f (struct function *);
 extern tree lhd_pass_through_t (tree);
 extern bool lhd_post_options (const char **);
@@ -85,7 +84,7 @@  extern void lhd_omp_firstprivatize_type_
 #define LANG_HOOKS_IDENTIFIER_SIZE	sizeof (struct lang_identifier)
 #define LANG_HOOKS_INIT			hook_bool_void_false
 #define LANG_HOOKS_FINISH		lhd_do_nothing
-#define LANG_HOOKS_PARSE_FILE		lhd_do_nothing_i
+#define LANG_HOOKS_PARSE_FILE		lhd_do_nothing
 #define LANG_HOOKS_OPTION_LANG_MASK	hook_uint_void_0
 #define LANG_HOOKS_INIT_OPTIONS_STRUCT	hook_void_gcc_optionsp
 #define LANG_HOOKS_INIT_OPTIONS		lhd_init_options