c-common.c (const_strip_array_types): Delete.

* c-common.c (const_strip_array_types): Delete.
	* c-common.h (const_strip_array_types): Likewise.
	* emit-rtl.c (const_next_insn, const_previous_insn,
	const_next_nonnote_insn, const_prev_nonnote_insn,
	const_next_real_insn, const_prev_real_insn,
	const_next_active_insn, const_prev_active_insn, const_next_label,
	const_prev_label): Delete.
	* gimple-low.c (block_may_fallthru): Use expr_last.
	* jump.c (reversed_comparison_code_parts): Use prev_nonnote_insn.
	* rtl.h (const_previous_insn, const_next_insn,
	const_prev_nonnote_insn, const_next_nonnote_insn,
	const_prev_real_insn, const_next_real_insn,
	const_prev_active_insn, const_next_active_insn, const_prev_label,
	const_next_label): Delete.
	* rtlanal.c (keep_with_call_p): Use next_nonnote_insn.
	* system.h (CONST_CAST): Update comment.
	* tree-cfg.c (tree_can_merge_blocks_p): Use last_stmt.
	(const_first_stmt, const_last_stmt): Delete.
	(tree_block_ends_with_condjump_p): Use last_stmt.
	* tree-flow.h (const_first_stmt, const_last_stmt): Delete.
	* tree-iterator.c (const_expr_first, const_expr_last,
	const_expr_only): Delete.
	* tree.c (const_lookup_attribute): Likewise.
	(attribute_list_contained): Use lookup_attribute.
	* tree.h (const_lookup_attribute, const_expr_first,
	const_expr_last, const_expr_only): Delete.
	
cp:
	* tree.c (pod_type_p, zero_init_p): Use strip_array_types.
	* typeck.c (cp_type_quals, cp_type_readonly, cp_has_mutable_p):
	Likewise.

From-SVN: r128014
This commit is contained in:
Kaveh R. Ghazi 2007-09-01 17:18:03 +00:00 committed by Kaveh Ghazi
parent b65e51a81f
commit 755478019a
17 changed files with 204 additions and 303 deletions

View file

@ -1,3 +1,32 @@
2007-09-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-common.c (const_strip_array_types): Delete.
* c-common.h (const_strip_array_types): Likewise.
* emit-rtl.c (const_next_insn, const_previous_insn,
const_next_nonnote_insn, const_prev_nonnote_insn,
const_next_real_insn, const_prev_real_insn,
const_next_active_insn, const_prev_active_insn, const_next_label,
const_prev_label): Delete.
* gimple-low.c (block_may_fallthru): Use expr_last.
* jump.c (reversed_comparison_code_parts): Use prev_nonnote_insn.
* rtl.h (const_previous_insn, const_next_insn,
const_prev_nonnote_insn, const_next_nonnote_insn,
const_prev_real_insn, const_next_real_insn,
const_prev_active_insn, const_next_active_insn, const_prev_label,
const_next_label): Delete.
* rtlanal.c (keep_with_call_p): Use next_nonnote_insn.
* system.h (CONST_CAST): Update comment.
* tree-cfg.c (tree_can_merge_blocks_p): Use last_stmt.
(const_first_stmt, const_last_stmt): Delete.
(tree_block_ends_with_condjump_p): Use last_stmt.
* tree-flow.h (const_first_stmt, const_last_stmt): Delete.
* tree-iterator.c (const_expr_first, const_expr_last,
const_expr_only): Delete.
* tree.c (const_lookup_attribute): Likewise.
(attribute_list_contained): Use lookup_attribute.
* tree.h (const_lookup_attribute, const_expr_first,
const_expr_last, const_expr_only): Delete.
2007-09-01 Richard Guenther <rguenther@suse.de>
* tree-ssa-alias.c (create_name_tags): Use TYPE_VOLATILE

View file

@ -4164,15 +4164,6 @@ strip_array_types (tree type)
return type;
}
const_tree
const_strip_array_types (const_tree type)
{
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
return type;
}
/* Recursively remove any '*' or '&' operator from TYPE. */
tree
strip_pointer_operator (tree t)

View file

@ -734,7 +734,6 @@ extern void c_register_builtin_type (tree, const char*);
extern bool c_promoting_integer_type_p (const_tree);
extern int self_promoting_args_p (const_tree);
extern tree strip_array_types (tree);
extern const_tree const_strip_array_types (const_tree);
extern tree strip_pointer_operator (tree);
extern tree strip_pointer_or_array_types (tree);
extern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT);

View file

@ -1,3 +1,9 @@
2007-09-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* tree.c (pod_type_p, zero_init_p): Use strip_array_types.
* typeck.c (cp_type_quals, cp_type_readonly, cp_has_mutable_p):
Likewise.
2007-08-31 Douglas Gregor <doug.gregor@gmail.com>
PR c++/32597

View file

@ -2052,7 +2052,9 @@ is_dummy_object (const_tree ob)
int
pod_type_p (const_tree t)
{
t = const_strip_array_types (t);
/* This CONST_CAST is okay because strip_array_types returns it's
argument unmodified and we assign it to a const_tree. */
t = strip_array_types ((tree)CONST_CAST(t));
if (t == error_mark_node)
return 1;
@ -2089,7 +2091,9 @@ class_tmpl_impl_spec_p (const_tree t)
int
zero_init_p (const_tree t)
{
t = const_strip_array_types (t);
/* This CONST_CAST is okay because strip_array_types returns it's
argument unmodified and we assign it to a const_tree. */
t = strip_array_types ((tree)CONST_CAST(t));
if (t == error_mark_node)
return 1;

View file

@ -6943,7 +6943,9 @@ comp_ptr_ttypes_const (tree to, tree from)
int
cp_type_quals (const_tree type)
{
type = const_strip_array_types (type);
/* This CONST_CAST is okay because strip_array_types returns it's
argument unmodified and we assign it to a const_tree. */
type = strip_array_types ((tree)CONST_CAST(type));
if (type == error_mark_node)
return TYPE_UNQUALIFIED;
return TYPE_QUALS (type);
@ -6955,7 +6957,9 @@ cp_type_quals (const_tree type)
bool
cp_type_readonly (const_tree type)
{
type = const_strip_array_types (type);
/* This CONST_CAST is okay because strip_array_types returns it's
argument unmodified and we assign it to a const_tree. */
type = strip_array_types ((tree)CONST_CAST(type));
return TYPE_READONLY (type);
}
@ -6964,7 +6968,9 @@ cp_type_readonly (const_tree type)
bool
cp_has_mutable_p (const_tree type)
{
type = const_strip_array_types (type);
/* This CONST_CAST is okay because strip_array_types returns it's
argument unmodified and we assign it to a const_tree. */
type = strip_array_types ((tree)CONST_CAST(type));
return CLASS_TYPE_P (type) && CLASSTYPE_HAS_MUTABLE (type);
}

View file

@ -2865,169 +2865,103 @@ get_max_uid (void)
/* Return the next insn. If it is a SEQUENCE, return the first insn
of the sequence. */
#define NEXT_INSN_BODY do { \
if (insn) \
{ \
insn = NEXT_INSN (insn); \
if (insn && NONJUMP_INSN_P (insn) \
&& GET_CODE (PATTERN (insn)) == SEQUENCE) \
insn = XVECEXP (PATTERN (insn), 0, 0); \
} \
return insn; \
} while (0)
rtx
next_insn (rtx insn)
{
NEXT_INSN_BODY;
}
if (insn)
{
insn = NEXT_INSN (insn);
if (insn && NONJUMP_INSN_P (insn)
&& GET_CODE (PATTERN (insn)) == SEQUENCE)
insn = XVECEXP (PATTERN (insn), 0, 0);
}
const_rtx
const_next_insn (const_rtx insn)
{
NEXT_INSN_BODY;
return insn;
}
#undef NEXT_INSN_BODY
/* Return the previous insn. If it is a SEQUENCE, return the last insn
of the sequence. */
#define PREVIOUS_INSN_BODY do { \
if (insn) \
{ \
insn = PREV_INSN (insn); \
if (insn && NONJUMP_INSN_P (insn) \
&& GET_CODE (PATTERN (insn)) == SEQUENCE) \
insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1); \
} \
return insn; \
} while (0)
rtx
previous_insn (rtx insn)
{
PREVIOUS_INSN_BODY;
}
if (insn)
{
insn = PREV_INSN (insn);
if (insn && NONJUMP_INSN_P (insn)
&& GET_CODE (PATTERN (insn)) == SEQUENCE)
insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1);
}
const_rtx
const_previous_insn (const_rtx insn)
{
PREVIOUS_INSN_BODY;
return insn;
}
#undef PREVIOUS_INSN_BODY
/* Return the next insn after INSN that is not a NOTE. This routine does not
look inside SEQUENCEs. */
#define NEXT_NONNOTE_INSN_BODY do { \
while (insn) \
{ \
insn = NEXT_INSN (insn); \
if (insn == 0 || !NOTE_P (insn)) \
break; \
} \
return insn; \
} while (0)
rtx
next_nonnote_insn (rtx insn)
{
NEXT_NONNOTE_INSN_BODY;
}
while (insn)
{
insn = NEXT_INSN (insn);
if (insn == 0 || !NOTE_P (insn))
break;
}
const_rtx
const_next_nonnote_insn (const_rtx insn)
{
NEXT_NONNOTE_INSN_BODY;
return insn;
}
#undef NEXT_NONNOTE_INSN_BODY
/* Return the previous insn before INSN that is not a NOTE. This routine does
not look inside SEQUENCEs. */
#define PREV_NONNOTE_INSN_BODY do { \
while (insn) \
{ \
insn = PREV_INSN (insn); \
if (insn == 0 || !NOTE_P (insn)) \
break; \
} \
return insn; \
} while (0)
rtx
prev_nonnote_insn (rtx insn)
{
PREV_NONNOTE_INSN_BODY;
}
while (insn)
{
insn = PREV_INSN (insn);
if (insn == 0 || !NOTE_P (insn))
break;
}
const_rtx
const_prev_nonnote_insn (const_rtx insn)
{
PREV_NONNOTE_INSN_BODY;
return insn;
}
#undef PREV_NONNOTE_INSN_BODY
/* Return the next INSN, CALL_INSN or JUMP_INSN after INSN;
or 0, if there is none. This routine does not look inside
SEQUENCEs. */
#define NEXT_REAL_INSN_BODY do { \
while (insn) \
{ \
insn = NEXT_INSN (insn); \
if (insn == 0 || INSN_P (insn)) \
break; \
} \
return insn; \
} while (0)
rtx
next_real_insn (rtx insn)
{
NEXT_REAL_INSN_BODY;
}
while (insn)
{
insn = NEXT_INSN (insn);
if (insn == 0 || INSN_P (insn))
break;
}
const_rtx
const_next_real_insn (const_rtx insn)
{
NEXT_REAL_INSN_BODY;
return insn;
}
#undef NEXT_REAL_INSN_BODY
/* Return the last INSN, CALL_INSN or JUMP_INSN before INSN;
or 0, if there is none. This routine does not look inside
SEQUENCEs. */
#define PREV_REAL_INSN_BODY do { \
while (insn) \
{ \
insn = PREV_INSN (insn); \
if (insn == 0 || INSN_P (insn)) \
break; \
} \
return insn; \
} while (0)
rtx
prev_real_insn (rtx insn)
{
PREV_REAL_INSN_BODY;
}
while (insn)
{
insn = PREV_INSN (insn);
if (insn == 0 || INSN_P (insn))
break;
}
const_rtx
const_prev_real_insn (const_rtx insn)
{
PREV_REAL_INSN_BODY;
return insn;
}
#undef PREV_REAL_INSN_BODY
/* Return the last CALL_INSN in the current list, or 0 if there is none.
This routine does not look inside SEQUENCEs. */
@ -3058,110 +2992,66 @@ active_insn_p (const_rtx insn)
&& GET_CODE (PATTERN (insn)) != CLOBBER))));
}
#define NEXT_ACTIVE_INSN_BODY do { \
while (insn) \
{ \
insn = NEXT_INSN (insn); \
if (insn == 0 || active_insn_p (insn)) \
break; \
} \
return insn;\
} while (0)
rtx
next_active_insn (rtx insn)
{
NEXT_ACTIVE_INSN_BODY;
}
while (insn)
{
insn = NEXT_INSN (insn);
if (insn == 0 || active_insn_p (insn))
break;
}
const_rtx
const_next_active_insn (const_rtx insn)
{
NEXT_ACTIVE_INSN_BODY;
return insn;
}
#undef NEXT_ACTIVE_INSN_BODY
/* Find the last insn before INSN that really does something. This routine
does not look inside SEQUENCEs. Until reload has completed, this is the
same as prev_real_insn. */
#define PREV_ACTIVE_INSN_BODY do { \
while (insn) \
{ \
insn = PREV_INSN (insn);\
if (insn == 0 || active_insn_p (insn)) \
break; \
} \
return insn; \
} while (0)
rtx
prev_active_insn (rtx insn)
{
PREV_ACTIVE_INSN_BODY;
}
while (insn)
{
insn = PREV_INSN (insn);
if (insn == 0 || active_insn_p (insn))
break;
}
const_rtx
const_prev_active_insn (const_rtx insn)
{
PREV_ACTIVE_INSN_BODY;
return insn;
}
#undef PREV_ACTIVE_INSN_BODY
/* Return the next CODE_LABEL after the insn INSN, or 0 if there is none. */
#define NEXT_LABEL_BODY do { \
while (insn) \
{ \
insn = NEXT_INSN (insn); \
if (insn == 0 || LABEL_P (insn)) \
break; \
} \
return insn; \
} while (0)
rtx
next_label (rtx insn)
{
NEXT_LABEL_BODY;
}
while (insn)
{
insn = NEXT_INSN (insn);
if (insn == 0 || LABEL_P (insn))
break;
}
const_rtx
const_next_label (const_rtx insn)
{
NEXT_LABEL_BODY;
return insn;
}
#undef NEXT_LABEL_BODY
/* Return the last CODE_LABEL before the insn INSN, or 0 if there is none. */
#define PREV_LABEL_BODY do { \
while (insn) \
{ \
insn = PREV_INSN (insn); \
if (insn == 0 || LABEL_P (insn)) \
break; \
} \
return insn; \
} while (0)
rtx
prev_label (rtx insn)
{
PREV_LABEL_BODY;
}
while (insn)
{
insn = PREV_INSN (insn);
if (insn == 0 || LABEL_P (insn))
break;
}
const_rtx
const_prev_label (const_rtx insn)
{
PREV_LABEL_BODY;
return insn;
}
#undef PREV_LABEL_BODY
/* Return the last label to mark the same position as LABEL. Return null
if LABEL itself is null. */

View file

@ -396,7 +396,9 @@ try_catch_may_fallthru (const_tree stmt)
bool
block_may_fallthru (const_tree block)
{
const_tree stmt = const_expr_last (block);
/* This CONST_CAST is okay because expr_last returns it's argument
unmodified and we assign it to a const_tree. */
const_tree stmt = expr_last ((tree)CONST_CAST(block));
switch (stmt ? TREE_CODE (stmt) : ERROR_MARK)
{

View file

@ -299,9 +299,12 @@ reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0,
if (! insn)
return UNKNOWN;
for (prev = const_prev_nonnote_insn (insn);
/* These CONST_CAST's are okay because prev_nonnote_insn just
returns it's argument and we assign it to a const_rtx
variable. */
for (prev = prev_nonnote_insn ((rtx)(CONST_CAST(insn)));
prev != 0 && !LABEL_P (prev);
prev = const_prev_nonnote_insn (prev))
prev = prev_nonnote_insn ((rtx)(CONST_CAST(prev))))
{
const_rtx set = set_of (arg0, prev);
if (set && GET_CODE (set) == SET

View file

@ -1593,26 +1593,16 @@ extern rtx make_jump_insn_raw (rtx);
extern void add_function_usage_to (rtx, rtx);
extern rtx last_call_insn (void);
extern rtx previous_insn (rtx);
extern const_rtx const_previous_insn (const_rtx);
extern rtx next_insn (rtx);
extern const_rtx const_next_insn (const_rtx);
extern rtx prev_nonnote_insn (rtx);
extern const_rtx const_prev_nonnote_insn (const_rtx);
extern rtx next_nonnote_insn (rtx);
extern const_rtx const_next_nonnote_insn (const_rtx);
extern rtx prev_real_insn (rtx);
extern const_rtx const_prev_real_insn (const_rtx);
extern rtx next_real_insn (rtx);
extern const_rtx const_next_real_insn (const_rtx);
extern rtx prev_active_insn (rtx);
extern const_rtx const_prev_active_insn (const_rtx);
extern rtx next_active_insn (rtx);
extern const_rtx const_next_active_insn (const_rtx);
extern int active_insn_p (const_rtx);
extern rtx prev_label (rtx);
extern const_rtx const_prev_label (const_rtx);
extern rtx next_label (rtx);
extern const_rtx const_next_label (const_rtx);
extern rtx skip_consecutive_labels (rtx);
extern rtx next_cc0_user (rtx);
extern rtx prev_cc0_setter (rtx);

View file

@ -3392,7 +3392,10 @@ keep_with_call_p (const_rtx insn)
if we can break or not. */
if (SET_DEST (set) == stack_pointer_rtx)
{
const_rtx i2 = const_next_nonnote_insn (insn);
/* This CONST_CAST is okay because next_nonnote_insn just
returns it's argument and we assign it to a const_rtx
variable. */
const_rtx i2 = next_nonnote_insn ((rtx)CONST_CAST(insn));
if (i2 && keep_with_call_p (i2))
return true;
}

View file

@ -772,8 +772,15 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
the C standard definitions or prototypes force you to. E.g. if you
need to free a const object, or if you pass a const string to
execv, et al. Another valid use would be in an allocation function
that creates const objects that need to be initialized. Most other
cases should be viewed with extreme caution. */
that creates const objects that need to be initialized. In some
cases we have non-const functions that return the argument
(e.g. next_nonnote_insn). Rather than create const shadow
functions, we can cast away const-ness in calling these interfaces
if we're careful to verify that the called function does indeed not
modify its argument and the return value is only used in a const
context. (This can be somewhat dangerous as these assumptions can
change after the fact). Beyond these uses, most other cases of
using this macro should be viewed with extreme caution. */
#if defined(__GNUC__) && GCC_VERSION != 4000
/* GCC 4.0.x has a bug where it may ICE on this expression. */

View file

@ -1158,7 +1158,9 @@ tree_can_merge_blocks_p (const_basic_block a, const_basic_block b)
/* If A ends by a statement causing exceptions or something similar, we
cannot merge the blocks. */
stmt = const_last_stmt (a);
/* This CONST_CAST is okay because last_stmt doesn't modify its
argument and the return value is assign to a const_tree. */
stmt = last_stmt ((basic_block)CONST_CAST(a));
if (stmt && stmt_ends_bb_p (stmt))
return false;
@ -2592,13 +2594,6 @@ first_stmt (basic_block bb)
return !bsi_end_p (i) ? bsi_stmt (i) : NULL_TREE;
}
const_tree
const_first_stmt (const_basic_block bb)
{
const_block_stmt_iterator i = cbsi_start (bb);
return !cbsi_end_p (i) ? cbsi_stmt (i) : NULL_TREE;
}
/* Return the last statement in basic block BB. */
tree
@ -2608,13 +2603,6 @@ last_stmt (basic_block bb)
return !bsi_end_p (b) ? bsi_stmt (b) : NULL_TREE;
}
const_tree
const_last_stmt (const_basic_block bb)
{
const_block_stmt_iterator b = cbsi_last (bb);
return !cbsi_end_p (b) ? cbsi_stmt (b) : NULL_TREE;
}
/* Return the last statement of an otherwise empty block. Return NULL
if the block is totally empty, or if it contains more than one
statement. */
@ -5932,7 +5920,9 @@ tree_block_ends_with_call_p (const_basic_block bb)
static bool
tree_block_ends_with_condjump_p (const_basic_block bb)
{
const_tree stmt = const_last_stmt (bb);
/* This CONST_CAST is okay because last_stmt doesn't modify its
argument and the return value is not modified. */
const_tree stmt = last_stmt ((basic_block)CONST_CAST(bb));
return (stmt && TREE_CODE (stmt) == COND_EXPR);
}

View file

@ -740,9 +740,7 @@ extern void print_loop_ir (FILE *);
extern void cleanup_dead_labels (void);
extern void group_case_labels (void);
extern tree first_stmt (basic_block);
extern const_tree const_first_stmt (const_basic_block);
extern tree last_stmt (basic_block);
extern const_tree const_last_stmt (const_basic_block);
extern tree last_and_only_stmt (basic_block);
extern edge find_taken_edge (basic_block, tree);
extern basic_block label_to_block_fn (struct function *, tree);

View file

@ -299,29 +299,22 @@ tsi_split_statement_list_before (tree_stmt_iterator *i)
/* Return the first expression in a sequence of COMPOUND_EXPRs,
or in a STATEMENT_LIST. */
#define EXPR_FIRST_BODY do { \
if (expr == NULL_TREE) \
return expr; \
if (TREE_CODE (expr) == STATEMENT_LIST) \
{ \
struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr); \
return n ? n->stmt : NULL_TREE; \
} \
while (TREE_CODE (expr) == COMPOUND_EXPR) \
expr = TREE_OPERAND (expr, 0); \
return expr; \
} while (0)
tree
expr_first (tree expr)
{
EXPR_FIRST_BODY;
}
if (expr == NULL_TREE)
return expr;
const_tree
const_expr_first (const_tree expr)
{
EXPR_FIRST_BODY;
if (TREE_CODE (expr) == STATEMENT_LIST)
{
struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr);
return n ? n->stmt : NULL_TREE;
}
while (TREE_CODE (expr) == COMPOUND_EXPR)
expr = TREE_OPERAND (expr, 0);
return expr;
}
/* Return the last expression in a sequence of COMPOUND_EXPRs,
@ -343,45 +336,44 @@ const_expr_first (const_tree expr)
tree
expr_last (tree expr)
{
EXPR_LAST_BODY;
}
if (expr == NULL_TREE)
return expr;
const_tree
const_expr_last (const_tree expr)
{
EXPR_LAST_BODY;
if (TREE_CODE (expr) == STATEMENT_LIST)
{
struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
return n ? n->stmt : NULL_TREE;
}
while (TREE_CODE (expr) == COMPOUND_EXPR)
expr = TREE_OPERAND (expr, 1);
return expr;
}
/* If EXPR is a single statement return it. If EXPR is a
STATEMENT_LIST containing exactly one statement S, return S.
Otherwise, return NULL. */
#define EXPR_ONLY_BODY do { \
if (expr == NULL_TREE) \
return NULL_TREE; \
if (TREE_CODE (expr) == STATEMENT_LIST) \
{ \
struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr); \
if (n && STATEMENT_LIST_HEAD (expr) == n) \
return n->stmt; \
else \
return NULL_TREE; \
} \
if (TREE_CODE (expr) == COMPOUND_EXPR) \
return NULL_TREE; \
return expr; \
} while (0)
tree
expr_only (tree expr)
{
EXPR_ONLY_BODY;
}
if (expr == NULL_TREE)
return NULL_TREE;
const_tree
const_expr_only (const_tree expr)
{
EXPR_ONLY_BODY;
if (TREE_CODE (expr) == STATEMENT_LIST)
{
struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
if (n && STATEMENT_LIST_HEAD (expr) == n)
return n->stmt;
else
return NULL_TREE;
}
if (TREE_CODE (expr) == COMPOUND_EXPR)
return NULL_TREE;
return expr;
}
#include "gt-tree-iterator.h"

View file

@ -3809,28 +3809,19 @@ is_attribute_p (const char *attr, const_tree ident)
returns the first occurrence; the TREE_CHAIN of the return value should
be passed back in if further occurrences are wanted. */
#define LOOKUP_ATTRIBUTE_BODY(TYPE) do { \
TYPE l; \
size_t attr_len = strlen (attr_name); \
for (l = list; l; l = TREE_CHAIN (l)) \
{ \
gcc_assert (TREE_CODE (TREE_PURPOSE (l)) == IDENTIFIER_NODE); \
if (is_attribute_with_length_p (attr_name, attr_len, TREE_PURPOSE (l))) \
return l; \
} \
return NULL_TREE; \
} while (0)
tree
lookup_attribute (const char *attr_name, tree list)
{
LOOKUP_ATTRIBUTE_BODY(tree);
}
tree l;
size_t attr_len = strlen (attr_name);
const_tree
const_lookup_attribute (const char *attr_name, const_tree list)
{
LOOKUP_ATTRIBUTE_BODY(const_tree);
for (l = list; l; l = TREE_CHAIN (l))
{
gcc_assert (TREE_CODE (TREE_PURPOSE (l)) == IDENTIFIER_NODE);
if (is_attribute_with_length_p (attr_name, attr_len, TREE_PURPOSE (l)))
return l;
}
return NULL_TREE;
}
/* Remove any instances of attribute ATTR_NAME in LIST and return the
@ -4800,10 +4791,14 @@ attribute_list_contained (const_tree l1, const_tree l2)
for (; t2 != 0; t2 = TREE_CHAIN (t2))
{
const_tree attr;
for (attr = const_lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), l1);
/* This CONST_CAST is okay because lookup_attribute does not
modify its argument and the return value is assigned to a
const_tree. */
for (attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
(tree)CONST_CAST(l1));
attr != NULL_TREE;
attr = const_lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
TREE_CHAIN (attr)))
attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
TREE_CHAIN (attr)))
{
if (TREE_VALUE (t2) != NULL
&& TREE_CODE (TREE_VALUE (t2)) == TREE_LIST

View file

@ -4156,7 +4156,6 @@ extern int is_attribute_p (const char *, const_tree);
of the attribute or NULL_TREE if not found. */
extern tree lookup_attribute (const char *, tree);
extern const_tree const_lookup_attribute (const char *, const_tree);
/* Remove any instances of attribute ATTR_NAME in LIST and return the
modified list. */
@ -4303,11 +4302,8 @@ extern tree non_lvalue (tree);
extern tree convert (tree, tree);
extern unsigned int expr_align (const_tree);
extern tree expr_first (tree);
extern const_tree const_expr_first (const_tree);
extern tree expr_last (tree);
extern const_tree const_expr_last (const_tree);
extern tree expr_only (tree);
extern const_tree const_expr_only (const_tree);
extern tree size_in_bytes (const_tree);
extern HOST_WIDE_INT int_size_in_bytes (const_tree);
extern HOST_WIDE_INT max_int_size_in_bytes (const_tree);