This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[cs] patch to ansi-fy gcc/cp
- From: Per Bothner <per at bothner dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 15 Dec 2003 10:41:48 -0800
- Subject: [cs] patch to ansi-fy gcc/cp
Obvious. Checked in to the compile-server branch.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
2003-12-15 Per Bothner <pbothner@apple.com>
* decl.c (setup_globals): ANSI-fy function header.
* lex.c (lang_clear_identifier): Likewise.
* name-lookup.c (lookup_using_namespace_one): Likewise.
2003-12-11 Per Bothner <pbothner@apple.com>
* c-common.c (register_decl_dependency, reserve_fragment_binding,
reset_cpp_hashnodes, note_fragment_binding_1, note_fragment_binding_2,
note_fragment_binding_3, register_fragment_dependency, reset_hashnode,
dont_defeat_good_checking, save_fragment_bindings, cb_exit_fragment,
init_output_fragment): Change function header to ISO prototypes.
* c-common.h (alloc_include_fragment): Likewise.
* c-decl.c (lang_clear_identifier, init_c_decl_processing_eachsrc,
setup_globals): Likewise.
* c-lex.c (register_cpp_callbacks): Likewise.
* c-objc-common.c (init_c_objc_common_once): Likewise.
* c-opts.c (init_c_common_once): Likewise.
* cppfiles.c (_cpp_enter_fragment, _cpp_exit_fragment): Likewise.
* cpplib.c (_cpp_start_fragment, _cpp_note_macro): Likewise.
* toplev.c (compile_file_finish, server_loop): Likewise.
* tree.c (get_next_decl_uid): Likewise.
* c-decl.c (duplicate_decls): Mark different_tu ATTRIBUTE_UNUSED.
* c-common.c (restore_fragment, cb_exit_fragment): More statistics.
(warn_fragment_invalidation, gather_fragment_statistics): Move earlier.
* c-common.c (cb_enter_fragment): Don't restore_fragment if empty.
* c-common.c (cb_exit_fragment): Return never-executed loop.
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.438.2.18
diff -u -p -r1.438.2.18 c-common.c
--- c-common.c 11 Dec 2003 22:19:07 -0000 1.438.2.18
+++ c-common.c 12 Dec 2003 04:44:59 -0000
@@ -4332,8 +4332,7 @@ create_builtins_fragment (void)
/* Note that the current fragment depends on USED. */
void
-register_decl_dependency (used)
- tree used;
+register_decl_dependency (tree used)
{
struct c_include_fragment *fragment;
const char *file = DECL_SOURCE_FILE (used);
@@ -4425,8 +4424,7 @@ int fragment_bindings_end;
/* Reserve space in fragment_bindings_stack. */
static void
-reserve_fragment_binding (space_needed)
- int space_needed;
+reserve_fragment_binding (int space_needed)
{
if (fragment_bindings_stack == NULL_TREE)
fragment_bindings_stack = make_tree_vec (50);
@@ -4461,8 +4459,7 @@ int count_fragment_declarations;
int count_fragment_tags;
void
-note_fragment_binding_1 (tree1)
- tree tree1;
+note_fragment_binding_1 (tree tree1)
{
reserve_fragment_binding (1);
TREE_VEC_ELT (fragment_bindings_stack, fragment_bindings_end - 1) = tree1;
@@ -4470,8 +4467,7 @@ note_fragment_binding_1 (tree1)
}
void
-note_fragment_binding_2 (tree1, tree2)
- tree tree1, tree2;
+note_fragment_binding_2 (tree tree1, tree tree2)
{
reserve_fragment_binding (2);
TREE_VEC_ELT (fragment_bindings_stack, fragment_bindings_end - 2) = tree1;
@@ -4479,8 +4475,7 @@ note_fragment_binding_2 (tree1, tree2)
}
void
-note_fragment_binding_3 (tree1, tree2, tree3)
- tree tree1, tree2, tree3;
+note_fragment_binding_3 (tree tree1, tree tree2, tree tree3)
{
reserve_fragment_binding (3);
TREE_VEC_ELT (fragment_bindings_stack, fragment_bindings_end - 3) = tree1;
@@ -4492,8 +4487,7 @@ note_fragment_binding_3 (tree1, tree2, t
/* Note that the current fragment depends on (some binding from) USED. */
void
-register_fragment_dependency (used)
- struct c_include_fragment* used;
+register_fragment_dependency (struct c_include_fragment* used)
{
if (! track_dependencies)
return;
@@ -4523,6 +4517,9 @@ register_fragment_dependency (used)
}
}
+#define warn_fragment_invalidation (! quiet_flag)
+#define gather_fragment_statistics (! quiet_flag)
+
int track_dependencies;
int track_declarations;
int main_timestamp;
@@ -4532,8 +4529,7 @@ bool nonempty_fragment_reused;
int currently_nested;
void
-reset_hashnode (node)
- cpp_hashnode *node;
+reset_hashnode (cpp_hashnode *node)
{
node->flags &= ~ NODE_POISONED; /* ??? also clear NODE_DIAGNOSTIC? */
if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
@@ -4549,7 +4545,7 @@ reset_hashnode (node)
}
void
-reset_cpp_hashnodes ()
+reset_cpp_hashnodes (void)
{
#if 0
/* Reset cpplib's macros and start a new file. */
@@ -4568,6 +4564,13 @@ restore_fragment (cpp_fragment *fragment
cpp_do_macro_callbacks (parse_in, fragment);
cpp_restore_macros (parse_in, fragment);
restore_fragment_bindings (C_FRAGMENT (fragment)->bindings);
+ if (warn_fragment_invalidation)
+ {
+ int num_bind = C_FRAGMENT (fragment)->bindings == NULL_TREE ? 0
+ : TREE_VEC_LENGTH (C_FRAGMENT (fragment)->bindings);
+ fprintf (stderr, "- restoring approx %d decls and %d macros\n",
+ num_bind, fragment->macro_notes_count);
+ }
if (lang_hooks.uses_conditional_symtab)
{
asm_buf = C_FRAGMENT (fragment)->asm_buf;
@@ -4587,14 +4590,11 @@ restore_fragment (cpp_fragment *fragment
static inline bool
dont_defeat_good_checking (void);
static inline bool
-dont_defeat_good_checking ()
+dont_defeat_good_checking (void)
{
return !lang_hooks.uses_conditional_symtab;
}
-#define warn_fragment_invalidation (! quiet_flag)
-#define gather_fragment_statistics (! quiet_flag)
-
int count_new_fragments;
int count_new_empty_fragments;
int lines_new_fragments;
@@ -4738,8 +4738,8 @@ cb_enter_fragment (cpp_reader* reader, c
inform ("reusing cached fragment");
fprintf(stderr, "reuse %d lines (start:%d, end:%d)\n", fragment->end_line - fragment->start_line, fragment->start_line, fragment->end_line);
}
+ restore_fragment (fragment);
}
- restore_fragment (fragment);
}
}
if (! lang_hooks.uses_conditional_symtab)
@@ -4790,11 +4790,11 @@ cb_enter_fragment (cpp_reader* reader, c
return valid;
}
-/* Return a copy of the remebered bindings from fragment_bindings_stack,
+/* Return a copy of the remembered bindings from fragment_bindings_stack,
and clear the latter. */
tree
-save_fragment_bindings ()
+save_fragment_bindings (void)
{
int i;
tree bindings = (fragment_bindings_end == 0 ? NULL_TREE
@@ -4825,9 +4825,8 @@ xfseek (FILE *fp, long offset, int whenc
future re-use. */
void
-cb_exit_fragment (reader, fragment)
- cpp_reader *reader ATTRIBUTE_UNUSED;
- cpp_fragment *fragment;
+cb_exit_fragment (cpp_reader *reader ATTRIBUTE_UNUSED,
+ cpp_fragment *fragment)
{
struct c_include_fragment* st = C_FRAGMENT (fragment);
reader->do_note_macros = 0;
@@ -4854,10 +4853,6 @@ cb_exit_fragment (reader, fragment)
}
st->uses_fragments = uses_fragments;
current_fragment_deps_end = 0;
- for (i = 0; i < current_fragment_deps_end; i++)
- {
- ((struct c_include_fragment*) TREE_VEC_ELT (current_fragment_deps_stack, i))->used_in_current = 1;
- }
fragment->macro_notes_count = reader->macro_notes_count;
if (reader->macro_notes_count == 0)
@@ -4871,6 +4866,13 @@ cb_exit_fragment (reader, fragment)
reader->macro_notes_count = 0;
}
+ if (warn_fragment_invalidation)
+ {
+ fprintf (stderr, "- new fragment has approx %d decls, %d macros, and %d dependencies\n",
+ st->bindings ? TREE_VEC_LENGTH (st->bindings) : 0,
+ fragment->macro_notes_count, uses_fragments_count);
+ }
+
current_c_fragment = NULL;
if (gather_fragment_statistics)
{
@@ -5013,7 +5015,8 @@ end_output_fragment (void)
output_fragment = 0;
}
-void init_output_fragment ()
+void
+init_output_fragment (void)
{
output_c_fragment = 0;
}
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.194.2.12
diff -u -p -r1.194.2.12 c-common.h
--- c-common.h 11 Dec 2003 22:19:08 -0000 1.194.2.12
+++ c-common.h 12 Dec 2003 04:45:00 -0000
@@ -1415,7 +1415,7 @@ static inline struct c_include_fragment
extern GTY(()) tree include_fragments;
static inline struct c_include_fragment *
-alloc_include_fragment ()
+alloc_include_fragment (void)
{
tree f = make_node (INCLUDE_FRAGMENT);
/* We chain them all together so GC doesn't get rid of them as we
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.417.2.9
diff -u -p -r1.417.2.9 c-decl.c
--- c-decl.c 11 Dec 2003 22:19:08 -0000 1.417.2.9
+++ c-decl.c 12 Dec 2003 04:45:03 -0000
@@ -475,10 +475,9 @@ restore_fragment_bindings (tree bindings
}
int
-lang_clear_identifier (pfile, node, v)
- cpp_reader *pfile ATTRIBUTE_UNUSED;
- cpp_hashnode *node;
- void *v ATTRIBUTE_UNUSED;
+lang_clear_identifier (cpp_reader *pfile ATTRIBUTE_UNUSED,
+ cpp_hashnode *node,
+ void *v ATTRIBUTE_UNUSED)
{
tree tnode = HT_IDENT_TO_GCC_IDENT (node);
tree t;
@@ -501,7 +500,7 @@ lang_clear_identifier (pfile, node, v)
return 1;
}
-void setup_globals ()
+void setup_globals (void)
{
truly_local_externals = NULL_TREE;
@@ -515,7 +514,7 @@ void setup_globals ()
}
void
-init_c_decl_processing_eachsrc ()
+init_c_decl_processing_eachsrc (void)
{
static int c_init_decl_done = 0;
@@ -995,7 +994,7 @@ match_builtin_function_types (tree oldty
static int
duplicate_decls (tree newdecl, tree olddecl, int different_binding_level,
- int different_tu)
+ int different_tu ATTRIBUTE_UNUSED)
{
int types_match = comptypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl),
COMPARE_STRICT);
Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lex.c,v
retrieving revision 1.209.2.7
diff -u -p -r1.209.2.7 c-lex.c
--- c-lex.c 11 Dec 2003 22:19:08 -0000 1.209.2.7
+++ c-lex.c 12 Dec 2003 04:45:06 -0000
@@ -91,7 +91,7 @@ init_c_lex (void)
}
void
-register_cpp_callbacks ()
+register_cpp_callbacks (void)
{
struct cpp_callbacks *cb;
cb = cpp_get_callbacks (parse_in);
Index: c-objc-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-objc-common.c,v
retrieving revision 1.29.2.9
diff -u -p -r1.29.2.9 c-objc-common.c
--- c-objc-common.c 11 Dec 2003 22:19:08 -0000 1.29.2.9
+++ c-objc-common.c 12 Dec 2003 04:45:06 -0000
@@ -155,7 +155,7 @@ c_warn_unused_global_decl (tree decl)
/* Initialization common to C and Objective-C front ends. */
void
-init_c_objc_common_once ()
+init_c_objc_common_once (void)
{
static const enum tree_code stmt_codes[] = {
c_common_stmt_codes
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.79.2.14
diff -u -p -r1.79.2.14 c-opts.c
--- c-opts.c 11 Dec 2003 22:19:09 -0000 1.79.2.14
+++ c-opts.c 12 Dec 2003 04:45:06 -0000
@@ -1134,7 +1134,7 @@ c_common_post_options (const char **pfil
/* Front end initialization common to C, ObjC and C++. */
void
-init_c_common_once ()
+init_c_common_once (void)
{
/* Set up preprocessor arithmetic. Must be done after call to
c_common_nodes_and_builtins for type nodes to be good. */
Index: cppfiles.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppfiles.c,v
retrieving revision 1.177.2.16
diff -u -p -r1.177.2.16 cppfiles.c
--- cppfiles.c 11 Dec 2003 22:19:16 -0000 1.177.2.16
+++ cppfiles.c 12 Dec 2003 04:45:06 -0000
@@ -681,9 +681,7 @@ read_file (cpp_reader *pfile, _cpp_file
}
void
-_cpp_enter_fragment (pfile, fragment)
- cpp_reader *pfile;
- cpp_fragment *fragment;
+_cpp_enter_fragment (cpp_reader *pfile, cpp_fragment *fragment)
{
if (pfile->cb.enter_fragment != NULL)
{
@@ -705,9 +703,7 @@ _cpp_enter_fragment (pfile, fragment)
}
void
-_cpp_exit_fragment (pfile, fragment)
- cpp_reader *pfile;
- cpp_fragment *fragment;
+_cpp_exit_fragment (cpp_reader *pfile, cpp_fragment *fragment)
{
if (pfile->cb.exit_fragment != NULL
&& ! pfile->state.skipping
Index: cpplib.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpplib.c,v
retrieving revision 1.348.2.7
diff -u -p -r1.348.2.7 cpplib.c
--- cpplib.c 11 Dec 2003 22:19:18 -0000 1.348.2.7
+++ cpplib.c 12 Dec 2003 04:45:07 -0000
@@ -266,8 +266,7 @@ end_directive (cpp_reader *pfile, int sk
/* Called at the beginning of a "fragment". */
void
-_cpp_start_fragment (pfile)
- cpp_reader *pfile;
+_cpp_start_fragment (cpp_reader *pfile)
{
cpp_fragment *fragment;
if ((fragment = pfile->current_fragment) != NULL
@@ -646,10 +645,8 @@ cpp_restore_macros (cpp_reader *pfile AT
}
void
-_cpp_note_macro (pfile, node, macro)
- cpp_reader *pfile;
- cpp_hashnode *node;
- struct cpp_macro *macro;
+_cpp_note_macro (cpp_reader *pfile, cpp_hashnode *node,
+ struct cpp_macro *macro)
{
int count, alloc;
if (! pfile->do_note_macros)
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.344.2.4
diff -u -p -r1.344.2.4 emit-rtl.c
--- emit-rtl.c 11 Dec 2003 22:19:19 -0000 1.344.2.4
+++ emit-rtl.c 12 Dec 2003 04:45:09 -0000
@@ -2405,17 +2405,6 @@ set_new_first_and_last_insn (rtx first,
cur_insn_uid++;
}
-/* Set the range of label numbers found in the current function.
- This is used when belatedly compiling an inline function. */
-
-void
-set_new_first_and_last_label_num (int first, int last)
-{
- base_label_num = label_num;
- first_label_num = first;
- last_label_num = last;
-}
-
/* Set the last label number found in the current function.
This is used when belatedly compiling an inline function. */
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.430.2.4
diff -u -p -r1.430.2.4 rtl.h
--- rtl.h 11 Dec 2003 22:19:33 -0000 1.430.2.4
+++ rtl.h 12 Dec 2003 04:45:11 -0000
@@ -2050,7 +2050,6 @@ extern void pop_topmost_sequence (void);
extern int subreg_realpart_p (rtx);
extern void reverse_comparison (rtx);
extern void set_new_first_and_last_insn (rtx, rtx);
-extern void set_new_first_and_last_label_num (int, int);
extern void set_new_last_label_num (int);
extern void unshare_all_rtl_again (rtx);
extern void unshare_all_rtl_in_chain (rtx);
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.813.2.15
diff -u -p -r1.813.2.15 toplev.c
--- toplev.c 11 Dec 2003 22:19:35 -0000 1.813.2.15
+++ toplev.c 12 Dec 2003 04:45:14 -0000
@@ -1850,7 +1850,7 @@ compile_file_parse (void)
Only called once for each output file, even for many input files. */
static void
-compile_file_finish ()
+compile_file_finish (void)
{
if (flag_syntax_only)
return;
@@ -5102,7 +5102,7 @@ static int server_argc;
Read a server command and process it. */
static void
-server_loop ()
+server_loop (void)
{
int blen = 200;
char *command_buffer = xmalloc (blen);
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.321.2.3
diff -u -p -r1.321.2.3 tree.c
--- tree.c 11 Dec 2003 22:19:35 -0000 1.321.2.3
+++ tree.c 12 Dec 2003 04:45:16 -0000
@@ -127,7 +127,7 @@ init_ttree (void)
int
-get_next_decl_uid ()
+get_next_decl_uid (void)
{
return next_decl_uid;
}
Index: ada/misc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/misc.c,v
retrieving revision 1.63.4.1
diff -u -p -r1.63.4.1 misc.c
--- ada/misc.c 11 Dec 2003 22:20:07 -0000 1.63.4.1
+++ ada/misc.c 12 Dec 2003 04:45:17 -0000
@@ -86,6 +86,7 @@ unsigned int largest_move_alignment;
static size_t gnat_tree_size (enum tree_code);
static bool gnat_init (void);
+static bool gnat_init_eachsrc (void);
static void gnat_finish_incomplete_decl (tree);
static unsigned int gnat_init_options (unsigned int, const char **);
static int gnat_handle_option (size_t, const char *, int);
@@ -109,7 +110,9 @@ static void gnat_adjust_rli (record_lay
#undef LANG_HOOKS_TREE_SIZE
#define LANG_HOOKS_TREE_SIZE gnat_tree_size
#undef LANG_HOOKS_INIT
-#define LANG_HOOKS_INIT gnat_init
+#define LANG_HOOKS_INIT gnat_init_eachsrc
+#undef LANG_HOOKS_INIT_ONCE
+#define LANG_HOOKS_INIT_ONCE gnat_init_once
#undef LANG_HOOKS_INIT_OPTIONS
#define LANG_HOOKS_INIT_OPTIONS gnat_init_options
#undef LANG_HOOKS_HANDLE_OPTION
@@ -365,12 +368,16 @@ gnat_tree_size (enum tree_code code)
/* Perform all the initialization steps that are language-specific. */
static bool
-gnat_init (void)
+gnat_init_once (void)
{
/* Performs whatever initialization steps needed by the language-dependent
lexical analyzer. */
gnat_init_decl_processing ();
+}
+static bool
+gnat_init_eachsrc ()
+{
/* Add the input filename as the last argument. */
gnat_argv[gnat_argc] = (char *) main_input_filename;
gnat_argc++;