This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[mainline] PATCH to diagnostic initialization
- From: gdr at integrable-solutions dot net
- To: gcc-patches at gcc dot gnu dot org
- Date: 04 Aug 2003 00:15:21 +0200
- Subject: [mainline] PATCH to diagnostic initialization
- Organization: Integrable Solutions
This prepares for language-specific initializations of the global
diagnostic context structure. Latter patches will use this facility.
Bootstrapped and regtested on an i686-pc-linux-gnu.
-- Gaby
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.708
diff -p -r2.708 ChangeLog
*** ChangeLog 3 Aug 2003 14:31:16 -0000 2.708
--- ChangeLog 3 Aug 2003 22:09:53 -0000
***************
*** 1,3 ****
--- 1,24 ----
+ 2003-08-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * opts.c (decode_options): Do language-specific initialization for
+ the global diagnostic context.
+ * langhooks-def.h (lhd_initialize_diagnostics): Declare.
+ (LANG_HOOKS_INITIALIZE_DIAGNOSTITCS): New macro.
+ (LANG_HOOKS_INITIALIZER): Adjust.
+ * langhooks.h (struct lang_hooks): Add new field
+ initialize_diagnostics.
+ * langhooks.c (lhd_initialize_diagnostics): Define.
* builtins.def (BUILT_IN_ABS, BUILT_IN_IMAXABS, BUILT_IN_LABS,
Index: langhooks-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks-def.h,v
retrieving revision 1.58
diff -p -r1.58 langhooks-def.h
*** langhooks-def.h 31 Jul 2003 19:26:16 -0000 1.58
--- langhooks-def.h 3 Aug 2003 22:09:56 -0000
*************** extern int lhd_tree_inlining_anon_aggr_t
*** 79,84 ****
--- 79,85 ----
extern int lhd_tree_inlining_start_inlining (tree);
extern void lhd_tree_inlining_end_inlining (tree);
extern tree lhd_tree_inlining_convert_parm_for_inlining (tree, tree, tree);
+ extern void lhd_initialize_diagnostics (struct diagnostic_context *);
#define LANG_HOOKS_NAME "GNU unknown"
#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct lang_identifier)
*************** extern tree lhd_tree_inlining_convert_pa
*** 87,92 ****
--- 88,94 ----
#define LANG_HOOKS_PARSE_FILE lhd_do_nothing_i
#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack
#define LANG_HOOKS_INIT_OPTIONS hook_uint_uint_constcharptrptr_0
+ #define LANG_HOOKS_INITIALIZE_DIAGNOSTITCS lhd_initialize_diagnostics
#define LANG_HOOKS_HANDLE_OPTION hook_int_size_t_constcharptr_int_0
#define LANG_HOOKS_MISSING_ARGUMENT hook_bool_constcharptr_size_t_false
#define LANG_HOOKS_POST_OPTIONS lhd_post_options
*************** extern int lhd_tree_dump_type_quals (tre
*** 245,250 ****
--- 247,253 ----
LANG_HOOKS_IDENTIFIER_SIZE, \
LANG_HOOKS_TREE_SIZE, \
LANG_HOOKS_INIT_OPTIONS, \
+ LANG_HOOKS_INITIALIZE_DIAGNOSTITCS, \
LANG_HOOKS_HANDLE_OPTION, \
LANG_HOOKS_MISSING_ARGUMENT, \
LANG_HOOKS_POST_OPTIONS, \
Index: langhooks.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.c,v
retrieving revision 1.47
diff -p -r1.47 langhooks.c
*** langhooks.c 19 Jul 2003 14:47:07 -0000 1.47
--- langhooks.c 3 Aug 2003 22:09:56 -0000
*************** write_global_declarations (void)
*** 479,482 ****
--- 479,488 ----
free (vec);
}
+ /* Called to perform language-specific initialization of CTX. */
+ void
+ lhd_initialize_diagnostics (struct diagnostic_context *ctx ATTRIBUTE_UNUSED)
+ {
+ }
+
#include "gt-langhooks.h"
Index: langhooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.h,v
retrieving revision 1.67
diff -p -r1.67 langhooks.h
*** langhooks.h 31 Jul 2003 19:26:16 -0000 1.67
--- langhooks.h 3 Aug 2003 22:09:56 -0000
*************** struct lang_hooks
*** 202,207 ****
--- 202,211 ----
the language mask to filter the switch array with. */
unsigned int (*init_options) (unsigned int argc, const char **argv);
+ /* Callback used to perform language-specific initialization for the
+ global diagnostic context structure. */
+ void (*initialize_diagnostics) (struct diagnostic_context *);
+
/* Handle the switch CODE, which has real type enum opt_code from
options.h. If the switch takes an argument, it is passed in ARG
which points to permanent storage. The handler is responsible for
Index: opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/opts.c,v
retrieving revision 1.33
diff -p -r1.33 opts.c
*** opts.c 31 Jul 2003 19:26:16 -0000 1.33
--- opts.c 3 Aug 2003 22:09:57 -0000
*************** decode_options (unsigned int argc, const
*** 460,465 ****
--- 460,467 ----
/* Perform language-specific options initialization. */
lang_mask = (*lang_hooks.init_options) (argc, argv);
+ lang_hooks.initialize_diagnostics (global_dc);
+
/* Scan to see what optimization level has been specified. That will
determine the default value of many flags. */
for (i = 1; i < argc; i++)