c-decl.c (add_stmt): Add C frontend specific version.

./:	* c-decl.c (add_stmt): Add C frontend specific version.
	(stmts_are_full_exprs_p): Remove.
	* c-common.h (STMT_IS_FULL_EXPR_P): Remove.
	(stmts_are_full_exprs_p): Don't declare.
	* c-semantics.c (add_stmt): Remove.
cp/:
	* semantics.c (add_stmt): Add C++ frontend specific version.
	* cp-tree.h (STMT_IS_FULL_EXPR_P): Define.
	(stmts_are_full_exprs_p): Declare.

From-SVN: r100289
This commit is contained in:
Ian Lance Taylor 2005-05-28 01:38:11 +00:00 committed by Ian Lance Taylor
parent 5d336d6dc0
commit ed3d0b1412
7 changed files with 72 additions and 45 deletions

View File

@ -1,3 +1,11 @@
2005-05-27 Ian Lance Taylor <ian@airs.com>
* c-decl.c (add_stmt): Add C frontend specific version.
(stmts_are_full_exprs_p): Remove.
* c-common.h (STMT_IS_FULL_EXPR_P): Remove.
(stmts_are_full_exprs_p): Don't declare.
* c-semantics.c (add_stmt): Remove.
2005-05-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* config/mips/mips-protos.h (mips_declare_object): Add printf

View File

@ -31,7 +31,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
IDENTIFIER_MARKED (used by search routines).
DECL_PRETTY_FUNCTION_P (in VAR_DECL)
1: C_DECLARED_LABEL_FLAG (in LABEL_DECL)
STMT_IS_FULL_EXPR_P (in _STMT)
STATEMENT_LIST_STMT_EXPR (in STATEMENT_LIST)
2: unused
3: STATEMENT_LIST_HAS_LABEL (in STATEMENT_LIST)
@ -704,12 +703,6 @@ extern void finish_file (void);
/* These macros provide convenient access to the various _STMT nodes. */
/* Nonzero if this statement should be considered a full-expression,
i.e., if temporaries created during this statement should have
their destructors run at the end of this statement. (In C, this
will always be false, since there are no destructors.) */
#define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
/* Nonzero if a given STATEMENT_LIST represents the outermost binding
if a statement expression. */
#define STATEMENT_LIST_STMT_EXPR(NODE) \
@ -735,7 +728,6 @@ enum c_tree_code {
#undef DEFTREECODE
extern int stmts_are_full_exprs_p (void);
extern int anon_aggr_type_p (tree);
/* For a VAR_DECL that is an anonymous union, these are the various

View File

@ -418,6 +418,31 @@ static tree grokdeclarator (const struct c_declarator *,
static tree grokparms (struct c_arg_info *, bool);
static void layout_array_type (tree);
/* T is a statement. Add it to the statement-tree. This is the
C/ObjC version--C++ has a slightly different version of this
function. */
tree
add_stmt (tree t)
{
enum tree_code code = TREE_CODE (t);
if (EXPR_P (t) && code != LABEL_EXPR)
{
if (!EXPR_HAS_LOCATION (t))
SET_EXPR_LOCATION (t, input_location);
}
if (code == LABEL_EXPR || code == CASE_LABEL_EXPR)
STATEMENT_LIST_HAS_LABEL (cur_stmt_list) = 1;
/* Add T to the statement-tree. Non-side-effect statements need to be
recorded during statement expressions. */
append_to_statement_list_force (t, &cur_stmt_list);
return t;
}
/* States indicating how grokdeclarator() should handle declspecs marked
with __attribute__((deprecated)). An object declared as
__attribute__((deprecated)) suppresses warnings of uses of other
@ -6717,16 +6742,6 @@ c_dup_lang_specific_decl (tree decl)
functions are not called from anywhere in the C front end, but as
these changes continue, that will change. */
/* Returns nonzero if the current statement is a full expression,
i.e. temporaries created during that statement should be destroyed
at the end of the statement. */
int
stmts_are_full_exprs_p (void)
{
return 0;
}
/* Returns the stmt_tree (if any) to which statements are currently
being added. If there is no active statement-tree, NULL is
returned. */

View File

@ -101,33 +101,6 @@ pop_stmt_list (tree t)
return t;
}
/* T is a statement. Add it to the statement-tree. */
tree
add_stmt (tree t)
{
enum tree_code code = TREE_CODE (t);
if (EXPR_P (t) && code != LABEL_EXPR)
{
if (!EXPR_HAS_LOCATION (t))
SET_EXPR_LOCATION (t, input_location);
/* 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 (t) = stmts_are_full_exprs_p ();
}
if (code == LABEL_EXPR || code == CASE_LABEL_EXPR)
STATEMENT_LIST_HAS_LABEL (cur_stmt_list) = 1;
/* Add T to the statement-tree. Non-side-effect statements need to be
recorded during statement expressions. */
append_to_statement_list_force (t, &cur_stmt_list);
return t;
}
/* Build a generic statement based on the given type of node and
arguments. Similar to `build_nt', except that we set
EXPR_LOCATION to be the current source location. */

View File

@ -1,3 +1,9 @@
2005-05-27 Ian Lance Taylor <ian@airs.com>
* semantics.c (add_stmt): Add C++ frontend specific version.
* cp-tree.h (STMT_IS_FULL_EXPR_P): Define.
(stmts_are_full_exprs_p): Declare.
2005-05-27 Roger Sayle <roger@eyesopen.com>
Giovanni Bajo <giovannibajo@gcc.gnu.org>

View File

@ -59,6 +59,7 @@ struct diagnostic_context;
ICS_ELLIPSIS_FLAG (in _CONV)
DECL_INITIALIZED_P (in VAR_DECL)
TYPENAME_IS_CLASS_P (in TYPENAME_TYPE)
STMT_IS_FULL_EXPR_P (in _STMT)
2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE)
ICS_THIS_FLAG (in _CONV)
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
@ -259,6 +260,11 @@ typedef struct ptrmem_cst * ptrmem_cst_t;
#define STATEMENT_LIST_TRY_BLOCK(NODE) \
TREE_LANG_FLAG_2 (STATEMENT_LIST_CHECK (NODE))
/* Nonzero if this statement should be considered a full-expression,
i.e., if temporaries created during this statement should have
their destructors run at the end of this statement. */
#define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
/* Marks the result of a statement expression. */
#define EXPR_STMT_STMT_EXPR_RESULT(NODE) \
TREE_LANG_FLAG_0 (EXPR_STMT_CHECK (NODE))
@ -4063,6 +4069,7 @@ extern tree get_deferred_access_checks (void);
extern void pop_to_parent_deferring_access_checks (void);
extern void perform_deferred_access_checks (void);
extern void perform_or_defer_access_check (tree, tree);
extern int stmts_are_full_exprs_p (void);
extern void init_cp_semantics (void);
extern tree do_poplevel (tree);
extern void add_decl_expr (tree);

View File

@ -340,6 +340,32 @@ stmts_are_full_exprs_p (void)
return current_stmt_tree ()->stmts_are_full_exprs_p;
}
/* T is a statement. Add it to the statement-tree. This is the C++
version. The C/ObjC frontends have a slightly different version of
this function. */
tree
add_stmt (tree t)
{
enum tree_code code = TREE_CODE (t);
if (EXPR_P (t) && code != LABEL_EXPR)
{
if (!EXPR_HAS_LOCATION (t))
SET_EXPR_LOCATION (t, input_location);
/* 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 (t) = stmts_are_full_exprs_p ();
}
/* Add T to the statement-tree. Non-side-effect statements need to be
recorded during statement expressions. */
append_to_statement_list_force (t, &cur_stmt_list);
return t;
}
/* Returns the stmt_tree (if any) to which statements are currently
being added. If there is no active statement-tree, NULL is
returned. */