aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-semantics.c
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2003-06-22 15:41:26 +0200
committerAndreas Jaeger <aj@gcc.gnu.org>2003-06-22 15:41:26 +0200
commit2f6e4e977d93c63da8811bd7d3c3e9be0d71e414 (patch)
tree25db40631432a7695af6af0b9995522fa0bf6716 /gcc/c-semantics.c
parent3346b668cadabd4e0f1679d390c999e2532a53f4 (diff)
downloadgcc-2f6e4e977d93c63da8811bd7d3c3e9be0d71e414.zip
gcc-2f6e4e977d93c63da8811bd7d3c3e9be0d71e414.tar.gz
gcc-2f6e4e977d93c63da8811bd7d3c3e9be0d71e414.tar.bz2
c-lex.c: Convert to ISO C90.
* c-lex.c: Convert to ISO C90. * c-objc-common.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.h: Likewise. * c-pretty-print.c: Likewise. * c-pretty-print.h: Likewise. * c-semantics.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. From-SVN: r68327
Diffstat (limited to 'gcc/c-semantics.c')
-rw-r--r--gcc/c-semantics.c204
1 files changed, 80 insertions, 124 deletions
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
index 374e9f1..3d747e6 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-semantics.c
@@ -1,6 +1,6 @@
/* This file contains the definitions and documentation for the common
tree codes used in the GNU C and C++ compilers (see c-common.def
- for the standard codes).
+ for the standard codes).
Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Benjamin Chelf (chelf@codesourcery.com).
@@ -43,26 +43,25 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* If non-NULL, the address of a language-specific function for
expanding statements. */
-void (*lang_expand_stmt) PARAMS ((tree));
+void (*lang_expand_stmt) (tree);
/* If non-NULL, the address of a language-specific function for
expanding a DECL_STMT. After the language-independent cases are
handled, this function will be called. If this function is not
defined, it is assumed that declarations other than those for
variables and labels do not require any RTL generation. */
-void (*lang_expand_decl_stmt) PARAMS ((tree));
+void (*lang_expand_decl_stmt) (tree);
-static tree find_reachable_label_1 PARAMS ((tree *, int *, void *));
-static tree find_reachable_label PARAMS ((tree));
-static bool expand_unreachable_if_stmt PARAMS ((tree));
-static tree expand_unreachable_stmt PARAMS ((tree, int));
-static void genrtl_do_stmt_1 PARAMS ((tree, tree));
+static tree find_reachable_label_1 (tree *, int *, void *);
+static tree find_reachable_label (tree);
+static bool expand_unreachable_if_stmt (tree);
+static tree expand_unreachable_stmt (tree, int);
+static void genrtl_do_stmt_1 (tree, tree);
/* Create an empty statement tree rooted at T. */
void
-begin_stmt_tree (t)
- tree *t;
+begin_stmt_tree (tree *t)
{
/* We create a trivial EXPR_STMT so that last_tree is never NULL in
what follows. We remove the extraneous statement in
@@ -76,8 +75,7 @@ begin_stmt_tree (t)
/* T is a statement. Add it to the statement-tree. */
tree
-add_stmt (t)
- tree t;
+add_stmt (tree t)
{
if (input_filename != last_expr_filename)
{
@@ -95,7 +93,7 @@ add_stmt (t)
/* Add T to the statement-tree. */
TREE_CHAIN (last_tree) = t;
last_tree = t;
-
+
/* When we expand a statement-tree, we must know whether or not the
statements are full-expressions. We record that fact here. */
STMT_IS_FULL_EXPR_P (last_tree) = stmts_are_full_exprs_p ();
@@ -111,14 +109,13 @@ add_stmt (t)
DECL. */
void
-add_decl_stmt (decl)
- tree decl;
+add_decl_stmt (tree decl)
{
tree decl_stmt;
/* We need the type to last until instantiation time. */
decl_stmt = build_stmt (DECL_STMT, decl);
- add_stmt (decl_stmt);
+ add_stmt (decl_stmt);
}
/* Add a scope-statement to the statement-tree. BEGIN_P indicates
@@ -132,9 +129,7 @@ add_decl_stmt (decl)
SCOPE_BEGIN_P set. */
tree
-add_scope_stmt (begin_p, partial_p)
- int begin_p;
- int partial_p;
+add_scope_stmt (int begin_p, int partial_p)
{
tree *stack_ptr = current_scope_stmt_stack ();
tree ss;
@@ -168,11 +163,10 @@ add_scope_stmt (begin_p, partial_p)
/* Finish the statement tree rooted at T. */
void
-finish_stmt_tree (t)
- tree *t;
+finish_stmt_tree (tree *t)
{
tree stmt;
-
+
/* Remove the fake extra statement added in begin_stmt_tree. */
stmt = TREE_CHAIN (*t);
*t = stmt;
@@ -200,7 +194,7 @@ build_stmt (enum tree_code code, ...)
int length;
int i;
va_list p;
-
+
va_start (p, code);
t = make_node (code);
@@ -220,23 +214,21 @@ build_stmt (enum tree_code code, ...)
as the condition is returned. Otherwise, T itself is returned. */
tree
-expand_cond (t)
- tree t;
+expand_cond (tree t)
{
if (t && TREE_CODE (t) == TREE_LIST)
{
expand_stmt (TREE_PURPOSE (t));
return TREE_VALUE (t);
}
- else
+ else
return t;
}
/* Create RTL for the local static variable DECL. */
void
-make_rtl_for_local_static (decl)
- tree decl;
+make_rtl_for_local_static (tree decl)
{
const char *asmspec = NULL;
@@ -271,8 +263,7 @@ make_rtl_for_local_static (decl)
/* Let the back-end know about DECL. */
void
-emit_local_var (decl)
- tree decl;
+emit_local_var (tree decl)
{
/* Create RTL for this variable. */
if (!DECL_RTL_SET_P (decl))
@@ -303,7 +294,7 @@ emit_local_var (decl)
/* Helper for generating the RTL at the beginning of a scope. */
void
-genrtl_do_pushlevel ()
+genrtl_do_pushlevel (void)
{
emit_line_note (input_filename, input_line);
clear_last_expr ();
@@ -312,23 +303,22 @@ genrtl_do_pushlevel ()
/* Generate the RTL for DESTINATION, which is a GOTO_STMT. */
void
-genrtl_goto_stmt (destination)
- tree destination;
+genrtl_goto_stmt (tree destination)
{
if (TREE_CODE (destination) == IDENTIFIER_NODE)
abort ();
-
+
/* We warn about unused labels with -Wunused. That means we have to
mark the used labels as used. */
if (TREE_CODE (destination) == LABEL_DECL)
TREE_USED (destination) = 1;
-
+
emit_line_note (input_filename, input_line);
-
+
if (TREE_CODE (destination) == LABEL_DECL)
{
label_rtx (destination);
- expand_goto (destination);
+ expand_goto (destination);
}
else
expand_computed_goto (destination);
@@ -339,8 +329,7 @@ genrtl_goto_stmt (destination)
used for new code. */
void
-genrtl_expr_stmt (expr)
- tree expr;
+genrtl_expr_stmt (tree expr)
{
genrtl_expr_stmt_value (expr, -1, 1);
}
@@ -352,21 +341,19 @@ genrtl_expr_stmt (expr)
MAYBE_LAST is nonzero if this EXPR_STMT might be the last statement
in expression statement. */
-void
-genrtl_expr_stmt_value (expr, want_value, maybe_last)
- tree expr;
- int want_value, maybe_last;
+void
+genrtl_expr_stmt_value (tree expr, int want_value, int maybe_last)
{
if (expr != NULL_TREE)
{
emit_line_note (input_filename, input_line);
-
+
if (stmts_are_full_exprs_p ())
expand_start_target_temps ();
-
+
if (expr != error_mark_node)
expand_expr_stmt_value (expr, want_value, maybe_last);
-
+
if (stmts_are_full_exprs_p ())
expand_end_target_temps ();
}
@@ -375,8 +362,7 @@ genrtl_expr_stmt_value (expr, want_value, maybe_last)
/* Generate the RTL for T, which is a DECL_STMT. */
void
-genrtl_decl_stmt (t)
- tree t;
+genrtl_decl_stmt (tree t)
{
tree decl;
emit_line_note (input_filename, input_line);
@@ -387,7 +373,7 @@ genrtl_decl_stmt (t)
`extern'). We don't have to handle the initialization
of those objects here; they can only be declarations,
rather than definitions. */
- if (TREE_CODE (decl) == VAR_DECL
+ if (TREE_CODE (decl) == VAR_DECL
&& !TREE_STATIC (decl)
&& !DECL_EXTERNAL (decl))
{
@@ -395,12 +381,12 @@ genrtl_decl_stmt (t)
if (!anon_aggr_type_p (TREE_TYPE (decl)))
emit_local_var (decl);
else
- expand_anon_union_decl (decl, NULL_TREE,
+ expand_anon_union_decl (decl, NULL_TREE,
DECL_ANON_UNION_ELEMS (decl));
}
else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
make_rtl_for_local_static (decl);
- else if (TREE_CODE (decl) == LABEL_DECL
+ else if (TREE_CODE (decl) == LABEL_DECL
&& C_DECLARED_LABEL_FLAG (decl))
declare_nonlocal_label (decl);
else if (lang_expand_decl_stmt)
@@ -410,8 +396,7 @@ genrtl_decl_stmt (t)
/* Generate the RTL for T, which is an IF_STMT. */
void
-genrtl_if_stmt (t)
- tree t;
+genrtl_if_stmt (tree t)
{
tree cond;
genrtl_do_pushlevel ();
@@ -421,7 +406,7 @@ genrtl_if_stmt (t)
if (THEN_CLAUSE (t))
{
tree nextt = THEN_CLAUSE (t);
-
+
if (cond && integer_zerop (cond))
nextt = expand_unreachable_stmt (nextt, warn_notreached);
expand_stmt (nextt);
@@ -441,14 +426,13 @@ genrtl_if_stmt (t)
/* Generate the RTL for T, which is a WHILE_STMT. */
void
-genrtl_while_stmt (t)
- tree t;
+genrtl_while_stmt (tree t)
{
tree cond = WHILE_COND (t);
emit_nop ();
emit_line_note (input_filename, input_line);
- expand_start_loop (1);
+ expand_start_loop (1);
genrtl_do_pushlevel ();
if (cond && !integer_nonzerop (cond))
@@ -458,7 +442,7 @@ genrtl_while_stmt (t)
expand_exit_loop_top_cond (0, cond);
genrtl_do_pushlevel ();
}
-
+
expand_stmt (WHILE_BODY (t));
expand_end_loop ();
@@ -468,8 +452,7 @@ genrtl_while_stmt (t)
body. This is reused for expanding unreachable WHILE_STMTS. */
static void
-genrtl_do_stmt_1 (cond, body)
- tree cond, body;
+genrtl_do_stmt_1 (tree cond, tree body)
{
/* Recognize the common special-case of do { ... } while (0) and do
not emit the loop widgetry in this case. In particular this
@@ -512,8 +495,7 @@ genrtl_do_stmt_1 (cond, body)
/* Generate the RTL for T, which is a DO_STMT. */
void
-genrtl_do_stmt (t)
- tree t;
+genrtl_do_stmt (tree t)
{
genrtl_do_stmt_1 (DO_COND (t), DO_BODY (t));
}
@@ -521,8 +503,7 @@ genrtl_do_stmt (t)
/* Build the node for a return statement and return it. */
tree
-build_return_stmt (expr)
- tree expr;
+build_return_stmt (tree expr)
{
return (build_stmt (RETURN_STMT, expr));
}
@@ -530,8 +511,7 @@ build_return_stmt (expr)
/* Generate the RTL for STMT, which is a RETURN_STMT. */
void
-genrtl_return_stmt (stmt)
- tree stmt;
+genrtl_return_stmt (tree stmt)
{
tree expr;
@@ -551,8 +531,7 @@ genrtl_return_stmt (stmt)
/* Generate the RTL for T, which is a FOR_STMT. */
void
-genrtl_for_stmt (t)
- tree t;
+genrtl_for_stmt (tree t)
{
tree cond = FOR_COND (t);
location_t saved_loc;
@@ -566,7 +545,7 @@ genrtl_for_stmt (t)
emit_nop ();
emit_line_note (input_filename, input_line);
if (FOR_EXPR (t))
- expand_start_loop_continue_elsewhere (1);
+ expand_start_loop_continue_elsewhere (1);
else
expand_start_loop (1);
genrtl_do_pushlevel ();
@@ -601,7 +580,7 @@ genrtl_for_stmt (t)
/* Build a break statement node and return it. */
tree
-build_break_stmt ()
+build_break_stmt (void)
{
return (build_stmt (BREAK_STMT));
}
@@ -609,7 +588,7 @@ build_break_stmt ()
/* Generate the RTL for a BREAK_STMT. */
void
-genrtl_break_stmt ()
+genrtl_break_stmt (void)
{
emit_line_note (input_filename, input_line);
if ( ! expand_exit_something ())
@@ -619,7 +598,7 @@ genrtl_break_stmt ()
/* Build a continue statement node and return it. */
tree
-build_continue_stmt ()
+build_continue_stmt (void)
{
return (build_stmt (CONTINUE_STMT));
}
@@ -627,18 +606,17 @@ build_continue_stmt ()
/* Generate the RTL for a CONTINUE_STMT. */
void
-genrtl_continue_stmt ()
+genrtl_continue_stmt (void)
{
emit_line_note (input_filename, input_line);
if (! expand_continue_loop (0))
- error ("continue statement not within a loop");
+ error ("continue statement not within a loop");
}
/* Generate the RTL for T, which is a SCOPE_STMT. */
void
-genrtl_scope_stmt (t)
- tree t;
+genrtl_scope_stmt (tree t)
{
tree block = SCOPE_STMT_BLOCK (t);
@@ -652,7 +630,7 @@ genrtl_scope_stmt (t)
else if (!SCOPE_NULLIFIED_P (t))
{
rtx note = emit_note (NULL,
- (SCOPE_BEGIN_P (t)
+ (SCOPE_BEGIN_P (t)
? NOTE_INSN_BLOCK_BEG
: NOTE_INSN_BLOCK_END));
NOTE_BLOCK (note) = block;
@@ -666,7 +644,7 @@ genrtl_scope_stmt (t)
for (fn = BLOCK_VARS (block); fn; fn = TREE_CHAIN (fn))
{
- if (TREE_CODE (fn) == FUNCTION_DECL
+ if (TREE_CODE (fn) == FUNCTION_DECL
&& DECL_CONTEXT (fn) == current_function_decl
&& DECL_SAVED_INSNS (fn)
&& !TREE_ASM_WRITTEN (fn)
@@ -683,12 +661,11 @@ genrtl_scope_stmt (t)
/* Generate the RTL for T, which is a SWITCH_STMT. */
void
-genrtl_switch_stmt (t)
- tree t;
+genrtl_switch_stmt (tree t)
{
tree cond;
genrtl_do_pushlevel ();
-
+
cond = expand_cond (SWITCH_COND (t));
if (cond == error_mark_node)
/* The code is in error, but we don't want expand_end_case to
@@ -704,10 +681,7 @@ genrtl_switch_stmt (t)
/* Create a CASE_LABEL tree node and return it. */
tree
-build_case_label (low_value, high_value, label_decl)
- tree low_value;
- tree high_value;
- tree label_decl;
+build_case_label (tree low_value, tree high_value, tree label_decl)
{
return build_stmt (CASE_LABEL, low_value, high_value, label_decl);
}
@@ -715,9 +689,8 @@ build_case_label (low_value, high_value, label_decl)
/* Generate the RTL for a CASE_LABEL. */
-void
-genrtl_case_label (case_label)
- tree case_label;
+void
+genrtl_case_label (tree case_label)
{
tree duplicate;
tree cleanup;
@@ -735,15 +708,14 @@ genrtl_case_label (case_label)
}
}
- add_case_node (CASE_LOW (case_label), CASE_HIGH (case_label),
+ add_case_node (CASE_LOW (case_label), CASE_HIGH (case_label),
CASE_LABEL_DECL (case_label), &duplicate);
}
/* Generate the RTL for T, which is a COMPOUND_STMT. */
void
-genrtl_compound_stmt (t)
- tree t;
+genrtl_compound_stmt (tree t)
{
#ifdef ENABLE_CHECKING
struct nesting *n = current_nesting_level ();
@@ -761,14 +733,8 @@ genrtl_compound_stmt (t)
/* Generate the RTL for an ASM_STMT. */
void
-genrtl_asm_stmt (cv_qualifier, string, output_operands,
- input_operands, clobbers, asm_input_p)
- tree cv_qualifier;
- tree string;
- tree output_operands;
- tree input_operands;
- tree clobbers;
- int asm_input_p;
+genrtl_asm_stmt (tree cv_qualifier, tree string, tree output_operands,
+ tree input_operands, tree clobbers, int asm_input_p)
{
if (cv_qualifier != NULL_TREE
&& cv_qualifier != ridpointers[(int) RID_VOLATILE])
@@ -782,16 +748,15 @@ genrtl_asm_stmt (cv_qualifier, string, output_operands,
if (asm_input_p)
expand_asm (string, cv_qualifier != NULL_TREE);
else
- c_expand_asm_operands (string, output_operands, input_operands,
+ c_expand_asm_operands (string, output_operands, input_operands,
clobbers, cv_qualifier != NULL_TREE,
input_filename, input_line);
}
/* Generate the RTL for a CLEANUP_STMT. */
-void
-genrtl_cleanup_stmt (t)
- tree t;
+void
+genrtl_cleanup_stmt (tree t)
{
tree decl = CLEANUP_DECL (t);
if (!decl || (DECL_SIZE (decl) && TREE_TYPE (decl) != error_mark_node))
@@ -802,8 +767,7 @@ genrtl_cleanup_stmt (t)
for the substitution. */
void
-prep_stmt (t)
- tree t;
+prep_stmt (tree t)
{
if (!STMT_LINENO_FOR_FN_P (t))
input_line = STMT_LINENO (t);
@@ -814,8 +778,7 @@ prep_stmt (t)
other statements at its nesting level. */
void
-expand_stmt (t)
- tree t;
+expand_stmt (tree t)
{
while (t && t != error_mark_node)
{
@@ -920,7 +883,7 @@ expand_stmt (t)
default:
if (lang_expand_stmt)
(*lang_expand_stmt) (t);
- else
+ else
abort ();
break;
}
@@ -938,10 +901,8 @@ expand_stmt (t)
/* If *TP is a potentially reachable label, return nonzero. */
static tree
-find_reachable_label_1 (tp, walk_subtrees, data)
- tree *tp;
- int *walk_subtrees ATTRIBUTE_UNUSED;
- void *data ATTRIBUTE_UNUSED;
+find_reachable_label_1 (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
{
switch (TREE_CODE (*tp))
{
@@ -958,8 +919,7 @@ find_reachable_label_1 (tp, walk_subtrees, data)
/* Determine whether expression EXP contains a potentially
reachable label. */
static tree
-find_reachable_label (exp)
- tree exp;
+find_reachable_label (tree exp)
{
location_t saved_loc = input_location;
tree ret = walk_tree (&exp, find_reachable_label_1, NULL, NULL);
@@ -970,11 +930,10 @@ find_reachable_label (exp)
/* Expand an unreachable if statement, T. This function returns
true if the IF_STMT contains a potentially reachable code_label. */
static bool
-expand_unreachable_if_stmt (t)
- tree t;
+expand_unreachable_if_stmt (tree t)
{
tree n;
-
+
if (find_reachable_label (IF_COND (t)) != NULL_TREE)
{
genrtl_if_stmt (t);
@@ -984,7 +943,7 @@ expand_unreachable_if_stmt (t)
if (THEN_CLAUSE (t) && ELSE_CLAUSE (t))
{
n = expand_unreachable_stmt (THEN_CLAUSE (t), 0);
-
+
if (n != NULL_TREE)
{
rtx label;
@@ -1004,9 +963,9 @@ expand_unreachable_if_stmt (t)
n = expand_unreachable_stmt (ELSE_CLAUSE (t), 0);
else
n = NULL_TREE;
-
+
expand_stmt (n);
-
+
return n != NULL_TREE;
}
@@ -1015,9 +974,7 @@ expand_unreachable_if_stmt (t)
then returns the label (or, in same cases, the statement after
one containing the label). */
static tree
-expand_unreachable_stmt (t, warn)
- tree t;
- int warn;
+expand_unreachable_stmt (tree t, int warn)
{
int saved;
@@ -1102,4 +1059,3 @@ expand_unreachable_stmt (t, warn)
}
return NULL_TREE;
}
-