2001-09-22 15:14:40 +02:00
|
|
|
|
/* Functions dealing with attribute handling, used by most front ends.
|
2002-01-01 23:22:25 +01:00
|
|
|
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
Make-lang.in, [...]: Update copyright years.
* ada/gcc-interface/Make-lang.in, alias.c, attribs.c, auto-inc-dec.c,
basic-block.h, bb-reorder.c, calls.c, c-common.c, cgraph.h,
collect2.h, config/alpha/alpha.c, config/alpha/alpha.md,
config/alpha/predicates.md, config/arm/arm.md,
config/arm/lib1funcs.asm, config/arm/neon-schedgen.ml,
config/avr/avr.c, config/avr/avr.md, config/bfin/bfin.c,
config/darwin9.h, config/darwin.c, config/darwin.h,
config/h8300/h8300.c, config/i386/cpuid.h, config/i386/cygming.h,
config/i386/cygwin.h, config/i386/mingw32.h, config/i386/msformat-c.c,
config/i386/sol2-10.h, config/i386/xopintrin.h, config/ia64/ia64.c,
config/ia64/ia64.md, config/ia64/sync.md, config/mep/mep.c,
config/mips/mips.md, config/mn10300/mn10300.c,
config/mn10300/mn10300.h, config/pa/pa.c, config/pa/pa.md,
config/rs6000/aix.h, config/rs6000/dfp.md,
config/rs6000/rs6000-builtin.def, config/rs6000/rs6000-c.c,
config/rs6000/vector.md, config/rtems.h, config/rx/rx.md,
config/s390/s390.md, config/sol2-c.c, config/sparc/sol2-bi.h,
config/sparc/sol2-gas.h, config/sparc/sparc.h, config/sparc/sparc.md,
config/sparc/sparc-protos.h, config/spu/spu.c, config/spu/spu-c.c,
config/t-darwin, convert.c, c.opt, c-opts.c, cp/Make-lang.in,
c-pretty-print.c, c-typeck.c, df-core.c, df-scan.c, diagnostic.c,
diagnostic.h, doc/cppopts.texi, doc/cpp.texi, doc/extend.texi,
doc/gimple.texi, doc/languages.texi, doc/plugins.texi, doc/rtl.texi,
doc/standards.texi, doc/tree-ssa.texi, doc/trouble.texi, dominance.c,
fold-const.c, fortran/Make-lang.in, fwprop.c, gcc-plugin.h,
gensupport.c, gimple.h, gimple-iterator.c, graphite.c,
graphite-clast-to-gimple.c, graphite-clast-to-gimple.h,
graphite-dependences.c, graphite-poly.c, graphite-poly.h,
graphite-ppl.c, graphite-ppl.h, graphite-scop-detection.c,
graphite-sese-to-poly.c, graphite-sese-to-poly.h, ifcvt.c, intl.c,
intl.h, ipa.c, ipa-cp.c, ipa-inline.c, ipa-prop.c, ipa-prop.h,
ipa-pure-const.c, ipa-reference.c, ipa-type-escape.c, ira-color.c,
ira-conflicts.c, ira-lives.c, java/Make-lang.in, lambda-code.c,
loop-invariant.c, lto/Make-lang.in, lto-streamer.h, lto-streamer-in.c,
objc/Make-lang.in, objcp/Make-lang.in, omp-low.c, optc-gen.awk,
opt-functions.awk, opth-gen.awk, params.def, passes.c,
postreload-gcse.c, print-tree.c, recog.c, regrename.c, reload.h,
rtl.def, sched-int.h, sched-rgn.c, sel-sched-dump.c, sese.c, sese.h,
store-motion.c, stor-layout.c, tree-cfgcleanup.c, tree-chrec.c,
tree-complex.c, tree-data-ref.c, tree.def, tree-eh.c, tree-flow.h,
tree-flow-inline.h, tree.h, tree-loop-distribution.c, tree-outof-ssa.c,
tree-parloops.c, tree-pass.h, tree-predcom.c, tree-profile.c,
tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-alias.c,
tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-dce.c, tree-ssa-dom.c,
tree-ssa-dse.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c,
tree-ssa-loop-manip.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
tree-ssa-pre.c, tree-ssa-sccvn.c, tree-ssa-structalias.c,
tree-ssa-uncprop.c, tree-tailcall.c, tree-vect-data-refs.c,
tree-vect-loop.c, tree-vectorizer.h, tree-vect-slp.c, tree-vrp.c,
unwind-dw2-fde-darwin.c, varpool.c: Update copyright years.
From-SVN: r157950
2010-04-02 21:54:46 +02:00
|
|
|
|
2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
|
|
|
|
|
Free Software Foundation, Inc.
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
|
|
|
|
This file is part of GCC.
|
|
|
|
|
|
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
2007-07-26 10:37:01 +02:00
|
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
2001-09-22 15:14:40 +02:00
|
|
|
|
version.
|
|
|
|
|
|
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-07-26 10:37:01 +02:00
|
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "system.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
|
#include "coretypes.h"
|
|
|
|
|
#include "tm.h"
|
2001-09-22 15:14:40 +02:00
|
|
|
|
#include "tree.h"
|
|
|
|
|
#include "flags.h"
|
2010-07-08 06:22:54 +02:00
|
|
|
|
#include "diagnostic-core.h"
|
2001-09-22 15:14:40 +02:00
|
|
|
|
#include "ggc.h"
|
|
|
|
|
#include "tm_p.h"
|
|
|
|
|
#include "cpplib.h"
|
|
|
|
|
#include "target.h"
|
2002-03-28 00:16:17 +01:00
|
|
|
|
#include "langhooks.h"
|
2007-07-27 22:27:17 +02:00
|
|
|
|
#include "hashtab.h"
|
2009-05-14 03:38:33 +02:00
|
|
|
|
#include "plugin.h"
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
attribs.c (c_common_attribute_table): Move table and handlers to c-common.c.
* attribs.c (c_common_attribute_table): Move table and handlers
to c-common.c.
(format_attribute_table, lang_attribute_table,
lang_attribute_common): Remove.
(init_attributes): Replace NULL pointers with pointers to the
empty table.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_attribute,
handle_noinline_attribute, handle_always_inline_attribute,
handle_used_attribute, handle_unused_attribute,
handle_const_attribute, handle_transparent_union_attribute,
handle_constructor_attribute, handle_destructor_attribute,
handle_mode_attribute, handle_section_attribute,
handle_aligned_attribute, handle_weak_attribute,
handle_alias_attribute, handle_visibility_attribute,
handle_no_instrument_function_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute,
handle_deprecated_attribute, handle_vector_size_attribute,
vector_size_helper): Move to c-common.c.
* c-common.c (c_common_attribute_table,
handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_attribute,
handle_noinline_attribute, handle_always_inline_attribute,
handle_used_attribute, handle_unused_attribute,
handle_const_attribute, handle_transparent_union_attribute,
handle_constructor_attribute, handle_destructor_attribute,
handle_mode_attribute, handle_section_attribute,
handle_aligned_attribute, handle_weak_attribute,
handle_alias_attribute, handle_visibility_attribute,
handle_no_instrument_function_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute,
handle_deprecated_attribute, handle_vector_size_attribute,
vector_size_helper): Move from attribs.c.
* c-common.h (c_common_attribute_table,
c_common_format_attribute_table): New.
* c-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Redefine.
* langhooks-def.h (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE,
LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.h (struct lang_hooks): 3 new attribute hooks.
* target-def.h (TARGET_ATTRIBUTE_TABLE): Default to NULL.
* target.h: Update comment.
* tree.c (default_target_attribute_table): Remove.
* tree.h (default_target_attribute_table, format_attribute_table,
lang_attribute_table, lang_attribute_common): Remove.
ada:
* misc.c (gnat_init): Don't set lang_attribute_common.
cp:
* cp-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE):
Redefine.
* cp-tree.h (cp_attribute_table): Rename.
* decl.c (lang_attribute_table): Remove declaration.
(cxx_init_decl_processing): Don't set it.
* tree.c (cp_attribute_table): Rename.
objc:
* objc-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Redefine.
From-SVN: r52730
2002-04-24 22:41:04 +02:00
|
|
|
|
/* Table of the tables of attributes (common, language, format, machine)
|
2001-09-22 15:14:40 +02:00
|
|
|
|
searched. */
|
|
|
|
|
static const struct attribute_spec *attribute_tables[4];
|
|
|
|
|
|
2007-07-27 22:27:17 +02:00
|
|
|
|
/* Hashtable mapping names (represented as substrings) to attribute specs. */
|
|
|
|
|
static htab_t attribute_hash;
|
|
|
|
|
|
|
|
|
|
/* Substring representation. */
|
|
|
|
|
|
|
|
|
|
struct substring
|
|
|
|
|
{
|
|
|
|
|
const char *str;
|
|
|
|
|
int length;
|
|
|
|
|
};
|
|
|
|
|
|
2001-09-22 15:14:40 +02:00
|
|
|
|
static bool attributes_initialized = false;
|
|
|
|
|
|
|
|
|
|
/* Default empty table of attributes. */
|
2007-07-27 22:27:17 +02:00
|
|
|
|
|
2001-09-22 15:14:40 +02:00
|
|
|
|
static const struct attribute_spec empty_attribute_table[] =
|
|
|
|
|
{
|
2011-03-21 09:29:36 +01:00
|
|
|
|
{ NULL, 0, 0, false, false, false, NULL, false }
|
2001-09-22 15:14:40 +02:00
|
|
|
|
};
|
|
|
|
|
|
2007-07-27 22:27:17 +02:00
|
|
|
|
/* Return base name of the attribute. Ie '__attr__' is turned into 'attr'.
|
|
|
|
|
To avoid need for copying, we simply return length of the string. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
extract_attribute_substring (struct substring *str)
|
|
|
|
|
{
|
|
|
|
|
if (str->length > 4 && str->str[0] == '_' && str->str[1] == '_'
|
|
|
|
|
&& str->str[str->length - 1] == '_' && str->str[str->length - 2] == '_')
|
|
|
|
|
{
|
|
|
|
|
str->length -= 4;
|
|
|
|
|
str->str += 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Simple hash function to avoid need to scan whole string. */
|
|
|
|
|
|
|
|
|
|
static inline hashval_t
|
|
|
|
|
substring_hash (const char *str, int l)
|
|
|
|
|
{
|
|
|
|
|
return str[0] + str[l - 1] * 256 + l * 65536;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Used for attribute_hash. */
|
|
|
|
|
|
|
|
|
|
static hashval_t
|
|
|
|
|
hash_attr (const void *p)
|
|
|
|
|
{
|
attribs.c (hash_attr, [...]): Constify.
* attribs.c (hash_attr, eq_attr, init_attributes): Constify.
* builtins.c (validate_arg, builtin_mathfn_code,
validate_arglist): Likewise.
* calls.c (call_expr_flags): Likewise.
* combine.c (reg_nonzero_bits_for_combine,
reg_num_sign_bit_copies_for_combine, get_last_value,
reg_truncated_to_mode): Likewise.
* emit-rtl.c (subreg_lowpart_p): Likewise.
* expr.c (highest_pow2_factor_for_target,
categorize_ctor_elements_1, categorize_ctor_elements,
count_type_elements, contains_packed_reference,
highest_pow2_factor, highest_pow2_factor_for_target): Likewise.
* fold-const.c (may_negate_without_overflow_p, int_const_binop,
fold_convertible_p, operand_equal_p, tree_swap_operands_p,
native_encode_int, native_encode_real, native_encode_complex,
native_encode_vector, native_encode_expr, native_interpret_int,
native_interpret_real, native_interpret_complex,
native_interpret_vector, native_interpret_expr): Likewise.
* function.c (use_register_for_decl): Likewise.
* gimplify.c (get_name): Likewise.
* langhooks-def.h (lhd_return_null_const_tree): New.
(LANG_HOOKS_GET_CALLEE_FNDECL): Use it.
* langhooks.c (lhd_return_null_const_tree): New.
* langhooks.h (lang_get_callee_fndecl): Constify.
* output.h (constructor_static_from_elts_p): Likewise.
* rtl-factoring.c (gen_symbol_ref_rtx_for_label): Likewise.
* rtl.h (nonzero_bits, num_sign_bit_copies, truncated_to_mode,
subreg_lowpart_p, noop_move_p, struct rtl_hooks): Likewise.
* rtlanal.c (cached_nonzero_bits, nonzero_bits1,
cached_num_sign_bit_copies, num_sign_bit_copies1, noop_move_p,
nonzero_bits, num_sign_bit_copies, truncated_to_mode): Likewise.
* rtlhooks-def.h (reg_nonzero_bits_general,
reg_num_sign_bit_copies_general, reg_truncated_to_mode_general):
Likewise.
* rtlhooks.c (reg_num_sign_bit_copies_general,
reg_nonzero_bits_general, reg_truncated_to_mode_general):
Likewise.
* stmt.c (warn_if_unused_value, is_body_block): Likewise.
* stor-layout.c (mode_for_size_tree): Likewise.
* tree-ssa-loop-im.c (memref_eq): Likewise.
* tree-ssa-loop-ivopts.c (tree_int_cst_sign_bit): Likewise.
* tree.c (contains_placeholder_p, type_list_equal,
simple_cst_equal, get_callee_fndecl, operand_equal_for_phi_arg_p):
Likewise.
* tree.h (tree_int_cst_sign_bit, may_negate_without_overflow_p,
mode_for_size_tree, categorize_ctor_elements, count_type_elements,
contains_placeholder_p, contains_packed_reference,
get_callee_fndecl, operand_equal_for_phi_arg_p,
warn_if_unused_value, is_body_block, native_encode_expr,
native_interpret_expr, fold_convertible_p, operand_equal_p,
int_const_binop, tree_swap_operands_p, builtin_mathfn_code,
validate_arglist, simple_cst_equal, type_list_equal,
use_register_for_decl, call_expr_flags, get_name,
highest_pow2_factor): Likewise.
(const_call_expr_arg_iterator_d,
init_const_call_expr_arg_iterator, next_const_call_expr_arg,
first_const_call_expr_arg, more_const_call_expr_args_p,
FOR_EACH_CONST_CALL_EXPR_ARG): New.
* varasm.c (constructor_static_from_elts_p): Constify.
cp:
* parser.c (eof_token): Un-constify.
(cp_lexer_new_main, cp_lexer_new_from_tokens, VEC_alloc,
cp_lexer_consume_token, cp_lexer_purge_token): Remove spurious
casts.
java:
* lang.c (java_get_callee_fndecl): Constify.
objc:
* objc-act.c (objc_get_callee_fndecl): Constify.
* objc-act.h (objc_get_callee_fndecl): Likewise.
From-SVN: r127036
2007-07-29 07:43:43 +02:00
|
|
|
|
const struct attribute_spec *const spec = (const struct attribute_spec *) p;
|
|
|
|
|
const int l = strlen (spec->name);
|
2007-07-27 22:27:17 +02:00
|
|
|
|
|
|
|
|
|
return substring_hash (spec->name, l);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Used for attribute_hash. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
eq_attr (const void *p, const void *q)
|
|
|
|
|
{
|
attribs.c (hash_attr, [...]): Constify.
* attribs.c (hash_attr, eq_attr, init_attributes): Constify.
* builtins.c (validate_arg, builtin_mathfn_code,
validate_arglist): Likewise.
* calls.c (call_expr_flags): Likewise.
* combine.c (reg_nonzero_bits_for_combine,
reg_num_sign_bit_copies_for_combine, get_last_value,
reg_truncated_to_mode): Likewise.
* emit-rtl.c (subreg_lowpart_p): Likewise.
* expr.c (highest_pow2_factor_for_target,
categorize_ctor_elements_1, categorize_ctor_elements,
count_type_elements, contains_packed_reference,
highest_pow2_factor, highest_pow2_factor_for_target): Likewise.
* fold-const.c (may_negate_without_overflow_p, int_const_binop,
fold_convertible_p, operand_equal_p, tree_swap_operands_p,
native_encode_int, native_encode_real, native_encode_complex,
native_encode_vector, native_encode_expr, native_interpret_int,
native_interpret_real, native_interpret_complex,
native_interpret_vector, native_interpret_expr): Likewise.
* function.c (use_register_for_decl): Likewise.
* gimplify.c (get_name): Likewise.
* langhooks-def.h (lhd_return_null_const_tree): New.
(LANG_HOOKS_GET_CALLEE_FNDECL): Use it.
* langhooks.c (lhd_return_null_const_tree): New.
* langhooks.h (lang_get_callee_fndecl): Constify.
* output.h (constructor_static_from_elts_p): Likewise.
* rtl-factoring.c (gen_symbol_ref_rtx_for_label): Likewise.
* rtl.h (nonzero_bits, num_sign_bit_copies, truncated_to_mode,
subreg_lowpart_p, noop_move_p, struct rtl_hooks): Likewise.
* rtlanal.c (cached_nonzero_bits, nonzero_bits1,
cached_num_sign_bit_copies, num_sign_bit_copies1, noop_move_p,
nonzero_bits, num_sign_bit_copies, truncated_to_mode): Likewise.
* rtlhooks-def.h (reg_nonzero_bits_general,
reg_num_sign_bit_copies_general, reg_truncated_to_mode_general):
Likewise.
* rtlhooks.c (reg_num_sign_bit_copies_general,
reg_nonzero_bits_general, reg_truncated_to_mode_general):
Likewise.
* stmt.c (warn_if_unused_value, is_body_block): Likewise.
* stor-layout.c (mode_for_size_tree): Likewise.
* tree-ssa-loop-im.c (memref_eq): Likewise.
* tree-ssa-loop-ivopts.c (tree_int_cst_sign_bit): Likewise.
* tree.c (contains_placeholder_p, type_list_equal,
simple_cst_equal, get_callee_fndecl, operand_equal_for_phi_arg_p):
Likewise.
* tree.h (tree_int_cst_sign_bit, may_negate_without_overflow_p,
mode_for_size_tree, categorize_ctor_elements, count_type_elements,
contains_placeholder_p, contains_packed_reference,
get_callee_fndecl, operand_equal_for_phi_arg_p,
warn_if_unused_value, is_body_block, native_encode_expr,
native_interpret_expr, fold_convertible_p, operand_equal_p,
int_const_binop, tree_swap_operands_p, builtin_mathfn_code,
validate_arglist, simple_cst_equal, type_list_equal,
use_register_for_decl, call_expr_flags, get_name,
highest_pow2_factor): Likewise.
(const_call_expr_arg_iterator_d,
init_const_call_expr_arg_iterator, next_const_call_expr_arg,
first_const_call_expr_arg, more_const_call_expr_args_p,
FOR_EACH_CONST_CALL_EXPR_ARG): New.
* varasm.c (constructor_static_from_elts_p): Constify.
cp:
* parser.c (eof_token): Un-constify.
(cp_lexer_new_main, cp_lexer_new_from_tokens, VEC_alloc,
cp_lexer_consume_token, cp_lexer_purge_token): Remove spurious
casts.
java:
* lang.c (java_get_callee_fndecl): Constify.
objc:
* objc-act.c (objc_get_callee_fndecl): Constify.
* objc-act.h (objc_get_callee_fndecl): Likewise.
From-SVN: r127036
2007-07-29 07:43:43 +02:00
|
|
|
|
const struct attribute_spec *const spec = (const struct attribute_spec *) p;
|
|
|
|
|
const struct substring *const str = (const struct substring *) q;
|
2007-07-27 22:27:17 +02:00
|
|
|
|
|
|
|
|
|
return (!strncmp (spec->name, str->str, str->length) && !spec->name[str->length]);
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-22 15:14:40 +02:00
|
|
|
|
/* Initialize attribute tables, and make some sanity checks
|
|
|
|
|
if --enable-checking. */
|
|
|
|
|
|
2011-08-04 09:40:24 +02:00
|
|
|
|
void
|
2003-06-15 15:43:32 +02:00
|
|
|
|
init_attributes (void)
|
2001-09-22 15:14:40 +02:00
|
|
|
|
{
|
attribs.c (init_attributes, [...]): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof.
* attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
* i386.c (override_options, ix86_init_mmx_sse_builtins,
ix86_expand_builtin): Likewise.
* mips.c (mips_add_gc_roots): Likewise.
* mmix.c (mmix_output_condition): Likewise.
* rs6000.c (rs6000_override_options, altivec_expand_builtin,
altivec_init_builtins): Likewise.
* sparc.c (mark_ultrasparc_pipeline_state): Likewise.
* cppexp.c (Nsuff, parse_number): Likewise.
* cppinit.c (builtin_array_end): Likewise.
* gcc.c (n_default_compilers, process_command): Likewise.
* genpreds.c (output_predicate_decls): Likewise.
* ggc-page.c (NUM_EXTRA_ORDERS): Likewise.
* lcm.c (N_ENTITIES): Likewise.
* stor-layout.c (set_sizetype): Likewise.
ada:
* utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
cp:
* decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl2.c (cxx_decode_option): Likewise.
* lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise.
java:
* class.c (init_class_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl.c (java_init_decl_processing): Likewise.
* jcf-parse.c (init_jcf_parse): Likewise.
* parse.y (init_src_parse): Likewise.
From-SVN: r50255
2002-03-03 15:07:39 +01:00
|
|
|
|
size_t i;
|
2007-07-27 22:27:17 +02:00
|
|
|
|
int k;
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
2011-08-04 09:40:24 +02:00
|
|
|
|
if (attributes_initialized)
|
|
|
|
|
return;
|
|
|
|
|
|
attribs.c (c_common_attribute_table): Move table and handlers to c-common.c.
* attribs.c (c_common_attribute_table): Move table and handlers
to c-common.c.
(format_attribute_table, lang_attribute_table,
lang_attribute_common): Remove.
(init_attributes): Replace NULL pointers with pointers to the
empty table.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_attribute,
handle_noinline_attribute, handle_always_inline_attribute,
handle_used_attribute, handle_unused_attribute,
handle_const_attribute, handle_transparent_union_attribute,
handle_constructor_attribute, handle_destructor_attribute,
handle_mode_attribute, handle_section_attribute,
handle_aligned_attribute, handle_weak_attribute,
handle_alias_attribute, handle_visibility_attribute,
handle_no_instrument_function_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute,
handle_deprecated_attribute, handle_vector_size_attribute,
vector_size_helper): Move to c-common.c.
* c-common.c (c_common_attribute_table,
handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_attribute,
handle_noinline_attribute, handle_always_inline_attribute,
handle_used_attribute, handle_unused_attribute,
handle_const_attribute, handle_transparent_union_attribute,
handle_constructor_attribute, handle_destructor_attribute,
handle_mode_attribute, handle_section_attribute,
handle_aligned_attribute, handle_weak_attribute,
handle_alias_attribute, handle_visibility_attribute,
handle_no_instrument_function_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute,
handle_deprecated_attribute, handle_vector_size_attribute,
vector_size_helper): Move from attribs.c.
* c-common.h (c_common_attribute_table,
c_common_format_attribute_table): New.
* c-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Redefine.
* langhooks-def.h (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE,
LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.h (struct lang_hooks): 3 new attribute hooks.
* target-def.h (TARGET_ATTRIBUTE_TABLE): Default to NULL.
* target.h: Update comment.
* tree.c (default_target_attribute_table): Remove.
* tree.h (default_target_attribute_table, format_attribute_table,
lang_attribute_table, lang_attribute_common): Remove.
ada:
* misc.c (gnat_init): Don't set lang_attribute_common.
cp:
* cp-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE):
Redefine.
* cp-tree.h (cp_attribute_table): Rename.
* decl.c (lang_attribute_table): Remove declaration.
(cxx_init_decl_processing): Don't set it.
* tree.c (cp_attribute_table): Rename.
objc:
* objc-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Redefine.
From-SVN: r52730
2002-04-24 22:41:04 +02:00
|
|
|
|
attribute_tables[0] = lang_hooks.common_attribute_table;
|
|
|
|
|
attribute_tables[1] = lang_hooks.attribute_table;
|
|
|
|
|
attribute_tables[2] = lang_hooks.format_attribute_table;
|
2001-09-22 15:14:40 +02:00
|
|
|
|
attribute_tables[3] = targetm.attribute_table;
|
|
|
|
|
|
attribs.c (c_common_attribute_table): Move table and handlers to c-common.c.
* attribs.c (c_common_attribute_table): Move table and handlers
to c-common.c.
(format_attribute_table, lang_attribute_table,
lang_attribute_common): Remove.
(init_attributes): Replace NULL pointers with pointers to the
empty table.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_attribute,
handle_noinline_attribute, handle_always_inline_attribute,
handle_used_attribute, handle_unused_attribute,
handle_const_attribute, handle_transparent_union_attribute,
handle_constructor_attribute, handle_destructor_attribute,
handle_mode_attribute, handle_section_attribute,
handle_aligned_attribute, handle_weak_attribute,
handle_alias_attribute, handle_visibility_attribute,
handle_no_instrument_function_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute,
handle_deprecated_attribute, handle_vector_size_attribute,
vector_size_helper): Move to c-common.c.
* c-common.c (c_common_attribute_table,
handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_attribute,
handle_noinline_attribute, handle_always_inline_attribute,
handle_used_attribute, handle_unused_attribute,
handle_const_attribute, handle_transparent_union_attribute,
handle_constructor_attribute, handle_destructor_attribute,
handle_mode_attribute, handle_section_attribute,
handle_aligned_attribute, handle_weak_attribute,
handle_alias_attribute, handle_visibility_attribute,
handle_no_instrument_function_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute,
handle_deprecated_attribute, handle_vector_size_attribute,
vector_size_helper): Move from attribs.c.
* c-common.h (c_common_attribute_table,
c_common_format_attribute_table): New.
* c-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Redefine.
* langhooks-def.h (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE,
LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.h (struct lang_hooks): 3 new attribute hooks.
* target-def.h (TARGET_ATTRIBUTE_TABLE): Default to NULL.
* target.h: Update comment.
* tree.c (default_target_attribute_table): Remove.
* tree.h (default_target_attribute_table, format_attribute_table,
lang_attribute_table, lang_attribute_common): Remove.
ada:
* misc.c (gnat_init): Don't set lang_attribute_common.
cp:
* cp-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_ATTRIBUTE_TABLE):
Redefine.
* cp-tree.h (cp_attribute_table): Rename.
* decl.c (lang_attribute_table): Remove declaration.
(cxx_init_decl_processing): Don't set it.
* tree.c (cp_attribute_table): Rename.
objc:
* objc-lang.c (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE,
LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Redefine.
From-SVN: r52730
2002-04-24 22:41:04 +02:00
|
|
|
|
/* Translate NULL pointers to pointers to the empty table. */
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE (attribute_tables); i++)
|
|
|
|
|
if (attribute_tables[i] == NULL)
|
|
|
|
|
attribute_tables[i] = empty_attribute_table;
|
|
|
|
|
|
2001-09-22 15:14:40 +02:00
|
|
|
|
#ifdef ENABLE_CHECKING
|
|
|
|
|
/* Make some sanity checks on the attribute tables. */
|
attribs.c (init_attributes, [...]): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof.
* attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
* i386.c (override_options, ix86_init_mmx_sse_builtins,
ix86_expand_builtin): Likewise.
* mips.c (mips_add_gc_roots): Likewise.
* mmix.c (mmix_output_condition): Likewise.
* rs6000.c (rs6000_override_options, altivec_expand_builtin,
altivec_init_builtins): Likewise.
* sparc.c (mark_ultrasparc_pipeline_state): Likewise.
* cppexp.c (Nsuff, parse_number): Likewise.
* cppinit.c (builtin_array_end): Likewise.
* gcc.c (n_default_compilers, process_command): Likewise.
* genpreds.c (output_predicate_decls): Likewise.
* ggc-page.c (NUM_EXTRA_ORDERS): Likewise.
* lcm.c (N_ENTITIES): Likewise.
* stor-layout.c (set_sizetype): Likewise.
ada:
* utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
cp:
* decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl2.c (cxx_decode_option): Likewise.
* lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise.
java:
* class.c (init_class_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl.c (java_init_decl_processing): Likewise.
* jcf-parse.c (init_jcf_parse): Likewise.
* parse.y (init_src_parse): Likewise.
From-SVN: r50255
2002-03-03 15:07:39 +01:00
|
|
|
|
for (i = 0; i < ARRAY_SIZE (attribute_tables); i++)
|
2001-09-22 15:14:40 +02:00
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; attribute_tables[i][j].name != NULL; j++)
|
|
|
|
|
{
|
|
|
|
|
/* The name must not begin and end with __. */
|
|
|
|
|
const char *name = attribute_tables[i][j].name;
|
|
|
|
|
int len = strlen (name);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
|
alias.c (mems_in_disjoint_alias_sets_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* alias.c (mems_in_disjoint_alias_sets_p, record_alias_subset,
record_set, rtx_equal_for_memref_p, init_alias_analysis): Use
gcc_assert and gcc_unreachable instead of abort.
* alloc-pool.c (abort, fancy_abort): Remove.
(create_alloc_pool, free_alloc_pool, pool_alloc, pool_free): Use
gcc_assert or gcc_unreachable.
* attribs.c (init_attributes, decl_attributes): Likewise.
* bb-reorder.c (FREE, find_traces_1_round, copy_bb,
mark_bb_for_unlikely_executed_section,
add_labels_and_missing_jumps, fix_crossing_conditional_branches,
fix_crossing_unconditional_branches): Likewise.
* bitmap.c (bitmap_first_set_bit, bitmap_last_set_bit,
bitmap_operation): Likewise.
* bt-load.c (insn_sets_btr_p, augment_live_range,
move_btr_def): Likewise.
* builtins.c (c_readstr, expand_builtin_longjmp, apply_args_size,
apply_result_size, expand_builtin_apply, expand_builtin_mathfn,
expand_builtin_mathfn_2, expand_builtin_mathfn_3,
builtin_memcpy_read_str, expand_movstr, expand_builtin_stpcpy,
expand_builtin_memcmp, expand_builtin_args_info,
std_gimplify_va_arg_expr, expand_builtin_unop,
expand_builtin_fputs, expand_builtin_profile_func,
expand_builtin_fork_or_exec, fold_builtin_bitop,
fold_builtin_classify, fold_builtin_fputs): Likewise.
From-SVN: r86797
2004-08-30 21:13:03 +02:00
|
|
|
|
gcc_assert (!(name[0] == '_' && name[1] == '_'
|
|
|
|
|
&& name[len - 1] == '_' && name[len - 2] == '_'));
|
2006-05-19 00:16:23 +02:00
|
|
|
|
|
2001-09-22 15:14:40 +02:00
|
|
|
|
/* The minimum and maximum lengths must be consistent. */
|
alias.c (mems_in_disjoint_alias_sets_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* alias.c (mems_in_disjoint_alias_sets_p, record_alias_subset,
record_set, rtx_equal_for_memref_p, init_alias_analysis): Use
gcc_assert and gcc_unreachable instead of abort.
* alloc-pool.c (abort, fancy_abort): Remove.
(create_alloc_pool, free_alloc_pool, pool_alloc, pool_free): Use
gcc_assert or gcc_unreachable.
* attribs.c (init_attributes, decl_attributes): Likewise.
* bb-reorder.c (FREE, find_traces_1_round, copy_bb,
mark_bb_for_unlikely_executed_section,
add_labels_and_missing_jumps, fix_crossing_conditional_branches,
fix_crossing_unconditional_branches): Likewise.
* bitmap.c (bitmap_first_set_bit, bitmap_last_set_bit,
bitmap_operation): Likewise.
* bt-load.c (insn_sets_btr_p, augment_live_range,
move_btr_def): Likewise.
* builtins.c (c_readstr, expand_builtin_longjmp, apply_args_size,
apply_result_size, expand_builtin_apply, expand_builtin_mathfn,
expand_builtin_mathfn_2, expand_builtin_mathfn_3,
builtin_memcpy_read_str, expand_movstr, expand_builtin_stpcpy,
expand_builtin_memcmp, expand_builtin_args_info,
std_gimplify_va_arg_expr, expand_builtin_unop,
expand_builtin_fputs, expand_builtin_profile_func,
expand_builtin_fork_or_exec, fold_builtin_bitop,
fold_builtin_classify, fold_builtin_fputs): Likewise.
From-SVN: r86797
2004-08-30 21:13:03 +02:00
|
|
|
|
gcc_assert (attribute_tables[i][j].min_length >= 0);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
|
alias.c (mems_in_disjoint_alias_sets_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* alias.c (mems_in_disjoint_alias_sets_p, record_alias_subset,
record_set, rtx_equal_for_memref_p, init_alias_analysis): Use
gcc_assert and gcc_unreachable instead of abort.
* alloc-pool.c (abort, fancy_abort): Remove.
(create_alloc_pool, free_alloc_pool, pool_alloc, pool_free): Use
gcc_assert or gcc_unreachable.
* attribs.c (init_attributes, decl_attributes): Likewise.
* bb-reorder.c (FREE, find_traces_1_round, copy_bb,
mark_bb_for_unlikely_executed_section,
add_labels_and_missing_jumps, fix_crossing_conditional_branches,
fix_crossing_unconditional_branches): Likewise.
* bitmap.c (bitmap_first_set_bit, bitmap_last_set_bit,
bitmap_operation): Likewise.
* bt-load.c (insn_sets_btr_p, augment_live_range,
move_btr_def): Likewise.
* builtins.c (c_readstr, expand_builtin_longjmp, apply_args_size,
apply_result_size, expand_builtin_apply, expand_builtin_mathfn,
expand_builtin_mathfn_2, expand_builtin_mathfn_3,
builtin_memcpy_read_str, expand_movstr, expand_builtin_stpcpy,
expand_builtin_memcmp, expand_builtin_args_info,
std_gimplify_va_arg_expr, expand_builtin_unop,
expand_builtin_fputs, expand_builtin_profile_func,
expand_builtin_fork_or_exec, fold_builtin_bitop,
fold_builtin_classify, fold_builtin_fputs): Likewise.
From-SVN: r86797
2004-08-30 21:13:03 +02:00
|
|
|
|
gcc_assert (attribute_tables[i][j].max_length == -1
|
|
|
|
|
|| (attribute_tables[i][j].max_length
|
|
|
|
|
>= attribute_tables[i][j].min_length));
|
2006-05-19 00:16:23 +02:00
|
|
|
|
|
2001-09-22 15:14:40 +02:00
|
|
|
|
/* An attribute cannot require both a DECL and a TYPE. */
|
alias.c (mems_in_disjoint_alias_sets_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* alias.c (mems_in_disjoint_alias_sets_p, record_alias_subset,
record_set, rtx_equal_for_memref_p, init_alias_analysis): Use
gcc_assert and gcc_unreachable instead of abort.
* alloc-pool.c (abort, fancy_abort): Remove.
(create_alloc_pool, free_alloc_pool, pool_alloc, pool_free): Use
gcc_assert or gcc_unreachable.
* attribs.c (init_attributes, decl_attributes): Likewise.
* bb-reorder.c (FREE, find_traces_1_round, copy_bb,
mark_bb_for_unlikely_executed_section,
add_labels_and_missing_jumps, fix_crossing_conditional_branches,
fix_crossing_unconditional_branches): Likewise.
* bitmap.c (bitmap_first_set_bit, bitmap_last_set_bit,
bitmap_operation): Likewise.
* bt-load.c (insn_sets_btr_p, augment_live_range,
move_btr_def): Likewise.
* builtins.c (c_readstr, expand_builtin_longjmp, apply_args_size,
apply_result_size, expand_builtin_apply, expand_builtin_mathfn,
expand_builtin_mathfn_2, expand_builtin_mathfn_3,
builtin_memcpy_read_str, expand_movstr, expand_builtin_stpcpy,
expand_builtin_memcmp, expand_builtin_args_info,
std_gimplify_va_arg_expr, expand_builtin_unop,
expand_builtin_fputs, expand_builtin_profile_func,
expand_builtin_fork_or_exec, fold_builtin_bitop,
fold_builtin_classify, fold_builtin_fputs): Likewise.
From-SVN: r86797
2004-08-30 21:13:03 +02:00
|
|
|
|
gcc_assert (!attribute_tables[i][j].decl_required
|
|
|
|
|
|| !attribute_tables[i][j].type_required);
|
2006-05-19 00:16:23 +02:00
|
|
|
|
|
2001-09-22 15:14:40 +02:00
|
|
|
|
/* If an attribute requires a function type, in particular
|
|
|
|
|
it requires a type. */
|
alias.c (mems_in_disjoint_alias_sets_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* alias.c (mems_in_disjoint_alias_sets_p, record_alias_subset,
record_set, rtx_equal_for_memref_p, init_alias_analysis): Use
gcc_assert and gcc_unreachable instead of abort.
* alloc-pool.c (abort, fancy_abort): Remove.
(create_alloc_pool, free_alloc_pool, pool_alloc, pool_free): Use
gcc_assert or gcc_unreachable.
* attribs.c (init_attributes, decl_attributes): Likewise.
* bb-reorder.c (FREE, find_traces_1_round, copy_bb,
mark_bb_for_unlikely_executed_section,
add_labels_and_missing_jumps, fix_crossing_conditional_branches,
fix_crossing_unconditional_branches): Likewise.
* bitmap.c (bitmap_first_set_bit, bitmap_last_set_bit,
bitmap_operation): Likewise.
* bt-load.c (insn_sets_btr_p, augment_live_range,
move_btr_def): Likewise.
* builtins.c (c_readstr, expand_builtin_longjmp, apply_args_size,
apply_result_size, expand_builtin_apply, expand_builtin_mathfn,
expand_builtin_mathfn_2, expand_builtin_mathfn_3,
builtin_memcpy_read_str, expand_movstr, expand_builtin_stpcpy,
expand_builtin_memcmp, expand_builtin_args_info,
std_gimplify_va_arg_expr, expand_builtin_unop,
expand_builtin_fputs, expand_builtin_profile_func,
expand_builtin_fork_or_exec, fold_builtin_bitop,
fold_builtin_classify, fold_builtin_fputs): Likewise.
From-SVN: r86797
2004-08-30 21:13:03 +02:00
|
|
|
|
gcc_assert (!attribute_tables[i][j].function_type_required
|
|
|
|
|
|| attribute_tables[i][j].type_required);
|
2001-09-22 15:14:40 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check that each name occurs just once in each table. */
|
attribs.c (init_attributes, [...]): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof.
* attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
* i386.c (override_options, ix86_init_mmx_sse_builtins,
ix86_expand_builtin): Likewise.
* mips.c (mips_add_gc_roots): Likewise.
* mmix.c (mmix_output_condition): Likewise.
* rs6000.c (rs6000_override_options, altivec_expand_builtin,
altivec_init_builtins): Likewise.
* sparc.c (mark_ultrasparc_pipeline_state): Likewise.
* cppexp.c (Nsuff, parse_number): Likewise.
* cppinit.c (builtin_array_end): Likewise.
* gcc.c (n_default_compilers, process_command): Likewise.
* genpreds.c (output_predicate_decls): Likewise.
* ggc-page.c (NUM_EXTRA_ORDERS): Likewise.
* lcm.c (N_ENTITIES): Likewise.
* stor-layout.c (set_sizetype): Likewise.
ada:
* utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
cp:
* decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl2.c (cxx_decode_option): Likewise.
* lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise.
java:
* class.c (init_class_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl.c (java_init_decl_processing): Likewise.
* jcf-parse.c (init_jcf_parse): Likewise.
* parse.y (init_src_parse): Likewise.
From-SVN: r50255
2002-03-03 15:07:39 +01:00
|
|
|
|
for (i = 0; i < ARRAY_SIZE (attribute_tables); i++)
|
2001-09-22 15:14:40 +02:00
|
|
|
|
{
|
|
|
|
|
int j, k;
|
|
|
|
|
for (j = 0; attribute_tables[i][j].name != NULL; j++)
|
|
|
|
|
for (k = j + 1; attribute_tables[i][k].name != NULL; k++)
|
alias.c (mems_in_disjoint_alias_sets_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* alias.c (mems_in_disjoint_alias_sets_p, record_alias_subset,
record_set, rtx_equal_for_memref_p, init_alias_analysis): Use
gcc_assert and gcc_unreachable instead of abort.
* alloc-pool.c (abort, fancy_abort): Remove.
(create_alloc_pool, free_alloc_pool, pool_alloc, pool_free): Use
gcc_assert or gcc_unreachable.
* attribs.c (init_attributes, decl_attributes): Likewise.
* bb-reorder.c (FREE, find_traces_1_round, copy_bb,
mark_bb_for_unlikely_executed_section,
add_labels_and_missing_jumps, fix_crossing_conditional_branches,
fix_crossing_unconditional_branches): Likewise.
* bitmap.c (bitmap_first_set_bit, bitmap_last_set_bit,
bitmap_operation): Likewise.
* bt-load.c (insn_sets_btr_p, augment_live_range,
move_btr_def): Likewise.
* builtins.c (c_readstr, expand_builtin_longjmp, apply_args_size,
apply_result_size, expand_builtin_apply, expand_builtin_mathfn,
expand_builtin_mathfn_2, expand_builtin_mathfn_3,
builtin_memcpy_read_str, expand_movstr, expand_builtin_stpcpy,
expand_builtin_memcmp, expand_builtin_args_info,
std_gimplify_va_arg_expr, expand_builtin_unop,
expand_builtin_fputs, expand_builtin_profile_func,
expand_builtin_fork_or_exec, fold_builtin_bitop,
fold_builtin_classify, fold_builtin_fputs): Likewise.
From-SVN: r86797
2004-08-30 21:13:03 +02:00
|
|
|
|
gcc_assert (strcmp (attribute_tables[i][j].name,
|
|
|
|
|
attribute_tables[i][k].name));
|
2001-09-22 15:14:40 +02:00
|
|
|
|
}
|
|
|
|
|
/* Check that no name occurs in more than one table. */
|
attribs.c (init_attributes, [...]): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof.
* attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
* i386.c (override_options, ix86_init_mmx_sse_builtins,
ix86_expand_builtin): Likewise.
* mips.c (mips_add_gc_roots): Likewise.
* mmix.c (mmix_output_condition): Likewise.
* rs6000.c (rs6000_override_options, altivec_expand_builtin,
altivec_init_builtins): Likewise.
* sparc.c (mark_ultrasparc_pipeline_state): Likewise.
* cppexp.c (Nsuff, parse_number): Likewise.
* cppinit.c (builtin_array_end): Likewise.
* gcc.c (n_default_compilers, process_command): Likewise.
* genpreds.c (output_predicate_decls): Likewise.
* ggc-page.c (NUM_EXTRA_ORDERS): Likewise.
* lcm.c (N_ENTITIES): Likewise.
* stor-layout.c (set_sizetype): Likewise.
ada:
* utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
cp:
* decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl2.c (cxx_decode_option): Likewise.
* lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise.
java:
* class.c (init_class_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl.c (java_init_decl_processing): Likewise.
* jcf-parse.c (init_jcf_parse): Likewise.
* parse.y (init_src_parse): Likewise.
From-SVN: r50255
2002-03-03 15:07:39 +01:00
|
|
|
|
for (i = 0; i < ARRAY_SIZE (attribute_tables); i++)
|
2001-09-22 15:14:40 +02:00
|
|
|
|
{
|
attribs.c (init_attributes, [...]): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof.
* attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
* i386.c (override_options, ix86_init_mmx_sse_builtins,
ix86_expand_builtin): Likewise.
* mips.c (mips_add_gc_roots): Likewise.
* mmix.c (mmix_output_condition): Likewise.
* rs6000.c (rs6000_override_options, altivec_expand_builtin,
altivec_init_builtins): Likewise.
* sparc.c (mark_ultrasparc_pipeline_state): Likewise.
* cppexp.c (Nsuff, parse_number): Likewise.
* cppinit.c (builtin_array_end): Likewise.
* gcc.c (n_default_compilers, process_command): Likewise.
* genpreds.c (output_predicate_decls): Likewise.
* ggc-page.c (NUM_EXTRA_ORDERS): Likewise.
* lcm.c (N_ENTITIES): Likewise.
* stor-layout.c (set_sizetype): Likewise.
ada:
* utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
cp:
* decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl2.c (cxx_decode_option): Likewise.
* lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise.
java:
* class.c (init_class_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl.c (java_init_decl_processing): Likewise.
* jcf-parse.c (init_jcf_parse): Likewise.
* parse.y (init_src_parse): Likewise.
From-SVN: r50255
2002-03-03 15:07:39 +01:00
|
|
|
|
size_t j, k, l;
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
attribs.c (init_attributes, [...]): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof.
* attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
* i386.c (override_options, ix86_init_mmx_sse_builtins,
ix86_expand_builtin): Likewise.
* mips.c (mips_add_gc_roots): Likewise.
* mmix.c (mmix_output_condition): Likewise.
* rs6000.c (rs6000_override_options, altivec_expand_builtin,
altivec_init_builtins): Likewise.
* sparc.c (mark_ultrasparc_pipeline_state): Likewise.
* cppexp.c (Nsuff, parse_number): Likewise.
* cppinit.c (builtin_array_end): Likewise.
* gcc.c (n_default_compilers, process_command): Likewise.
* genpreds.c (output_predicate_decls): Likewise.
* ggc-page.c (NUM_EXTRA_ORDERS): Likewise.
* lcm.c (N_ENTITIES): Likewise.
* stor-layout.c (set_sizetype): Likewise.
ada:
* utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in
lieu of explicit sizeof/sizeof.
cp:
* decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl2.c (cxx_decode_option): Likewise.
* lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise.
java:
* class.c (init_class_processing): Use ARRAY_SIZE in lieu of
explicit sizeof/sizeof.
* decl.c (java_init_decl_processing): Likewise.
* jcf-parse.c (init_jcf_parse): Likewise.
* parse.y (init_src_parse): Likewise.
From-SVN: r50255
2002-03-03 15:07:39 +01:00
|
|
|
|
for (j = i + 1; j < ARRAY_SIZE (attribute_tables); j++)
|
2001-09-22 15:14:40 +02:00
|
|
|
|
for (k = 0; attribute_tables[i][k].name != NULL; k++)
|
|
|
|
|
for (l = 0; attribute_tables[j][l].name != NULL; l++)
|
alias.c (mems_in_disjoint_alias_sets_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* alias.c (mems_in_disjoint_alias_sets_p, record_alias_subset,
record_set, rtx_equal_for_memref_p, init_alias_analysis): Use
gcc_assert and gcc_unreachable instead of abort.
* alloc-pool.c (abort, fancy_abort): Remove.
(create_alloc_pool, free_alloc_pool, pool_alloc, pool_free): Use
gcc_assert or gcc_unreachable.
* attribs.c (init_attributes, decl_attributes): Likewise.
* bb-reorder.c (FREE, find_traces_1_round, copy_bb,
mark_bb_for_unlikely_executed_section,
add_labels_and_missing_jumps, fix_crossing_conditional_branches,
fix_crossing_unconditional_branches): Likewise.
* bitmap.c (bitmap_first_set_bit, bitmap_last_set_bit,
bitmap_operation): Likewise.
* bt-load.c (insn_sets_btr_p, augment_live_range,
move_btr_def): Likewise.
* builtins.c (c_readstr, expand_builtin_longjmp, apply_args_size,
apply_result_size, expand_builtin_apply, expand_builtin_mathfn,
expand_builtin_mathfn_2, expand_builtin_mathfn_3,
builtin_memcpy_read_str, expand_movstr, expand_builtin_stpcpy,
expand_builtin_memcmp, expand_builtin_args_info,
std_gimplify_va_arg_expr, expand_builtin_unop,
expand_builtin_fputs, expand_builtin_profile_func,
expand_builtin_fork_or_exec, fold_builtin_bitop,
fold_builtin_classify, fold_builtin_fputs): Likewise.
From-SVN: r86797
2004-08-30 21:13:03 +02:00
|
|
|
|
gcc_assert (strcmp (attribute_tables[i][k].name,
|
|
|
|
|
attribute_tables[j][l].name));
|
2001-09-22 15:14:40 +02:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-07-27 22:27:17 +02:00
|
|
|
|
attribute_hash = htab_create (200, hash_attr, eq_attr, NULL);
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE (attribute_tables); i++)
|
|
|
|
|
for (k = 0; attribute_tables[i][k].name != NULL; k++)
|
|
|
|
|
{
|
2009-05-14 03:38:33 +02:00
|
|
|
|
register_attribute (&attribute_tables[i][k]);
|
|
|
|
|
}
|
|
|
|
|
invoke_plugin_callbacks (PLUGIN_ATTRIBUTES, NULL);
|
|
|
|
|
attributes_initialized = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Insert a single ATTR into the attribute table. */
|
|
|
|
|
|
|
|
|
|
void
|
2009-11-25 11:55:54 +01:00
|
|
|
|
register_attribute (const struct attribute_spec *attr)
|
2009-05-14 03:38:33 +02:00
|
|
|
|
{
|
2009-05-15 01:10:50 +02:00
|
|
|
|
struct substring str;
|
2009-06-01 18:35:01 +02:00
|
|
|
|
void **slot;
|
2009-05-15 01:10:50 +02:00
|
|
|
|
|
|
|
|
|
str.str = attr->name;
|
|
|
|
|
str.length = strlen (str.str);
|
2011-06-22 11:52:55 +02:00
|
|
|
|
|
|
|
|
|
/* Attribute names in the table must be in the form 'text' and not
|
|
|
|
|
in the form '__text__'. */
|
|
|
|
|
gcc_assert (str.length > 0 && str.str[0] != '_');
|
|
|
|
|
|
2009-06-01 18:35:01 +02:00
|
|
|
|
slot = htab_find_slot_with_hash (attribute_hash, &str,
|
|
|
|
|
substring_hash (str.str, str.length),
|
|
|
|
|
INSERT);
|
2009-05-15 01:10:50 +02:00
|
|
|
|
gcc_assert (!*slot);
|
2009-06-01 18:35:01 +02:00
|
|
|
|
*slot = (void *) CONST_CAST (struct attribute_spec *, attr);
|
2001-09-22 15:14:40 +02:00
|
|
|
|
}
|
2007-09-23 04:36:34 +02:00
|
|
|
|
|
|
|
|
|
/* Return the spec for the attribute named NAME. */
|
|
|
|
|
|
|
|
|
|
const struct attribute_spec *
|
2011-03-11 23:38:58 +01:00
|
|
|
|
lookup_attribute_spec (const_tree name)
|
2007-09-23 04:36:34 +02:00
|
|
|
|
{
|
|
|
|
|
struct substring attr;
|
|
|
|
|
|
|
|
|
|
attr.str = IDENTIFIER_POINTER (name);
|
|
|
|
|
attr.length = IDENTIFIER_LENGTH (name);
|
|
|
|
|
extract_attribute_substring (&attr);
|
alias.c (record_alias_subset, [...]): Fix -Wc++-compat and/or -Wcast-qual warnings.
* alias.c (record_alias_subset, init_alias_analysis): Fix
-Wc++-compat and/or -Wcast-qual warnings.
* attribs.c (lookup_attribute_spec): Likewise.
* bb-reorder.c (find_traces, rotate_loop, find_traces_1_round,
copy_bb, connect_traces,
find_rarely_executed_basic_blocks_and_cr): Likewise.
* bt-load.c (find_btr_def_group, add_btr_def, new_btr_user,
note_btr_set, migrate_btr_defs): Likewise.
* builtins.c (result_vector, expand_builtin_memcpy,
expand_builtin_mempcpy_args, expand_builtin_strncpy,
builtin_memset_read_str, expand_builtin_printf,
fold_builtin_memchr, rewrite_call_expr, fold_builtin_printf):
Likewise.
* caller-save.c (mark_set_regs): Likewise.
* calls.c (expand_call, emit_library_call_value_1): Likewise.
* cgraph.c (cgraph_edge): Likewise.
* combine.c (likely_spilled_retval_1): Likewise.
* coverage.c (htab_counts_entry_hash, htab_counts_entry_eq,
htab_counts_entry_del, get_coverage_counts): Likewise.
* cselib.c (new_elt_list, new_elt_loc_list, entry_and_rtx_equal_p,
new_cselib_val): Likewise.
* dbgcnt.c (dbg_cnt_process_opt): Likewise.
* dbxout.c (dbxout_init, dbxout_type, output_used_types_helper):
Likewise.
* df-core.c (df_compact_blocks): Likewise.
* df-problems.c (df_grow_bb_info, df_chain_create): Likewise.
* df-scan.c (df_grow_reg_info, df_ref_create,
df_insn_create_insn_record, df_insn_rescan, df_notes_rescan,
df_ref_compare, df_ref_create_structure, df_bb_refs_record,
df_record_entry_block_defs, df_record_exit_block_uses,
df_bb_verify): Likewise.
* df.h (DF_REF_EXTRACT_WIDTH_CONST, DF_REF_EXTRACT_OFFSET_CONST,
DF_REF_EXTRACT_MODE_CONST): New.
* dominance.c (get_immediate_dominator, get_dominated_by,
nearest_common_dominator, root_of_dom_tree,
iterate_fix_dominators, first_dom_son, next_dom_son): Fix
-Wc++-compat and/or -Wcast-qual warnings.
* dse.c (clear_alias_set_lookup, get_group_info, gen_rtx_MEM,
record_store, replace_read, check_mem_read_rtx, scan_insn,
dse_step1, dse_record_singleton_alias_set): Likewise.
* dwarf2asm.c (dw2_force_const_mem): Likewise.
From-SVN: r137137
2008-06-26 02:28:15 +02:00
|
|
|
|
return (const struct attribute_spec *)
|
|
|
|
|
htab_find_with_hash (attribute_hash, &attr,
|
|
|
|
|
substring_hash (attr.str, attr.length));
|
2007-09-23 04:36:34 +02:00
|
|
|
|
}
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
|
|
|
|
/* Process the attributes listed in ATTRIBUTES and install them in *NODE,
|
|
|
|
|
which is either a DECL (including a TYPE_DECL) or a TYPE. If a DECL,
|
|
|
|
|
it should be modified in place; if a TYPE, a copy should be created
|
|
|
|
|
unless ATTR_FLAG_TYPE_IN_PLACE is set in FLAGS. FLAGS gives further
|
|
|
|
|
information, in the form of a bitwise OR of flags in enum attribute_flags
|
|
|
|
|
from tree.h. Depending on these flags, some attributes may be
|
|
|
|
|
returned to be applied at a later stage (for example, to apply
|
2003-08-04 22:44:20 +02:00
|
|
|
|
a decl attribute to the declaration rather than to its type). */
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
|
|
|
|
tree
|
2003-06-15 15:43:32 +02:00
|
|
|
|
decl_attributes (tree *node, tree attributes, int flags)
|
2001-09-22 15:14:40 +02:00
|
|
|
|
{
|
|
|
|
|
tree a;
|
|
|
|
|
tree returned_attrs = NULL_TREE;
|
|
|
|
|
|
2008-04-11 08:55:38 +02:00
|
|
|
|
if (TREE_TYPE (*node) == error_mark_node)
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
|
2001-09-22 15:14:40 +02:00
|
|
|
|
if (!attributes_initialized)
|
|
|
|
|
init_attributes ();
|
|
|
|
|
|
2008-07-23 12:28:06 +02:00
|
|
|
|
/* If this is a function and the user used #pragma GCC optimize, add the
|
|
|
|
|
options to the attribute((optimize(...))) list. */
|
|
|
|
|
if (TREE_CODE (*node) == FUNCTION_DECL && current_optimize_pragma)
|
|
|
|
|
{
|
|
|
|
|
tree cur_attr = lookup_attribute ("optimize", attributes);
|
|
|
|
|
tree opts = copy_list (current_optimize_pragma);
|
|
|
|
|
|
|
|
|
|
if (! cur_attr)
|
|
|
|
|
attributes
|
|
|
|
|
= tree_cons (get_identifier ("optimize"), opts, attributes);
|
|
|
|
|
else
|
|
|
|
|
TREE_VALUE (cur_attr) = chainon (opts, TREE_VALUE (cur_attr));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (*node) == FUNCTION_DECL
|
|
|
|
|
&& optimization_current_node != optimization_default_node
|
|
|
|
|
&& !DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node))
|
|
|
|
|
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (*node) = optimization_current_node;
|
|
|
|
|
|
2008-08-31 01:50:40 +02:00
|
|
|
|
/* If this is a function and the user used #pragma GCC target, add the
|
|
|
|
|
options to the attribute((target(...))) list. */
|
2008-07-23 12:28:06 +02:00
|
|
|
|
if (TREE_CODE (*node) == FUNCTION_DECL
|
2008-08-31 01:50:40 +02:00
|
|
|
|
&& current_target_pragma
|
2008-07-23 12:28:06 +02:00
|
|
|
|
&& targetm.target_option.valid_attribute_p (*node, NULL_TREE,
|
2008-08-31 01:50:40 +02:00
|
|
|
|
current_target_pragma, 0))
|
2008-07-23 12:28:06 +02:00
|
|
|
|
{
|
2008-08-31 01:50:40 +02:00
|
|
|
|
tree cur_attr = lookup_attribute ("target", attributes);
|
|
|
|
|
tree opts = copy_list (current_target_pragma);
|
2008-07-23 12:28:06 +02:00
|
|
|
|
|
|
|
|
|
if (! cur_attr)
|
2008-08-31 01:50:40 +02:00
|
|
|
|
attributes = tree_cons (get_identifier ("target"), opts, attributes);
|
2008-07-23 12:28:06 +02:00
|
|
|
|
else
|
|
|
|
|
TREE_VALUE (cur_attr) = chainon (opts, TREE_VALUE (cur_attr));
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-23 16:47:46 +02:00
|
|
|
|
/* A "naked" function attribute implies "noinline" and "noclone" for
|
|
|
|
|
those targets that support it. */
|
|
|
|
|
if (TREE_CODE (*node) == FUNCTION_DECL
|
2011-06-22 11:52:55 +02:00
|
|
|
|
&& attributes
|
2010-07-23 16:47:46 +02:00
|
|
|
|
&& lookup_attribute_spec (get_identifier ("naked"))
|
|
|
|
|
&& lookup_attribute ("naked", attributes) != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (lookup_attribute ("noinline", attributes) == NULL)
|
|
|
|
|
attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);
|
|
|
|
|
|
|
|
|
|
if (lookup_attribute ("noclone", attributes) == NULL)
|
|
|
|
|
attributes = tree_cons (get_identifier ("noclone"), NULL, attributes);
|
|
|
|
|
}
|
|
|
|
|
|
alias.c, [...]: Replace calls via (*targetm.foo) () with targetm.foo ().
* alias.c, attribs.c, bt-load.c, builtins.c, c-common.c,
c-decl.c, c-objc-common.c, c-typeck.c, calls.c, cfglayout.c,
cse.c, dbxout.c, dwarf2out.c, except.c, final.c,
haifa-sched.c, integrate.c, passes.c, rtlanal.c, sched-rgn.c,
sched-vis.c, simplify-rtx.c, stor-layout.c, tree.c, varasm.c,
vmsdbgout.c: Replace calls via (*targetm.foo) () with
targetm.foo ().
From-SVN: r79729
2004-03-20 05:52:59 +01:00
|
|
|
|
targetm.insert_attributes (*node, &attributes);
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
|
|
|
|
for (a = attributes; a; a = TREE_CHAIN (a))
|
|
|
|
|
{
|
|
|
|
|
tree name = TREE_PURPOSE (a);
|
|
|
|
|
tree args = TREE_VALUE (a);
|
|
|
|
|
tree *anode = node;
|
2007-09-23 04:36:34 +02:00
|
|
|
|
const struct attribute_spec *spec = lookup_attribute_spec (name);
|
2001-09-22 15:14:40 +02:00
|
|
|
|
bool no_add_attrs = 0;
|
2010-03-19 17:37:27 +01:00
|
|
|
|
int fn_ptr_quals = 0;
|
2003-08-20 14:24:18 +02:00
|
|
|
|
tree fn_ptr_tmp = NULL_TREE;
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
|
|
|
|
if (spec == NULL)
|
|
|
|
|
{
|
2009-05-05 01:44:36 +02:00
|
|
|
|
warning (OPT_Wattributes, "%qE attribute directive ignored",
|
|
|
|
|
name);
|
2001-09-22 15:14:40 +02:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else if (list_length (args) < spec->min_length
|
|
|
|
|
|| (spec->max_length >= 0
|
|
|
|
|
&& list_length (args) > spec->max_length))
|
|
|
|
|
{
|
2009-05-05 01:44:36 +02:00
|
|
|
|
error ("wrong number of arguments specified for %qE attribute",
|
|
|
|
|
name);
|
2001-09-22 15:14:40 +02:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2007-07-27 22:27:17 +02:00
|
|
|
|
gcc_assert (is_attribute_p (spec->name, name));
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
|
|
|
|
if (spec->decl_required && !DECL_P (*anode))
|
|
|
|
|
{
|
|
|
|
|
if (flags & ((int) ATTR_FLAG_DECL_NEXT
|
|
|
|
|
| (int) ATTR_FLAG_FUNCTION_NEXT
|
|
|
|
|
| (int) ATTR_FLAG_ARRAY_NEXT))
|
|
|
|
|
{
|
|
|
|
|
/* Pass on this attribute to be tried again. */
|
|
|
|
|
returned_attrs = tree_cons (name, args, returned_attrs);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-05-05 01:44:36 +02:00
|
|
|
|
warning (OPT_Wattributes, "%qE attribute does not apply to types",
|
|
|
|
|
name);
|
2001-09-22 15:14:40 +02:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-17 21:34:40 +01:00
|
|
|
|
/* If we require a type, but were passed a decl, set up to make a
|
|
|
|
|
new type and update the one in the decl. ATTR_FLAG_TYPE_IN_PLACE
|
|
|
|
|
would have applied if we'd been passed a type, but we cannot modify
|
|
|
|
|
the decl's type in place here. */
|
2001-09-22 15:14:40 +02:00
|
|
|
|
if (spec->type_required && DECL_P (*anode))
|
2002-01-17 21:34:40 +01:00
|
|
|
|
{
|
|
|
|
|
anode = &TREE_TYPE (*anode);
|
2008-02-26 19:09:02 +01:00
|
|
|
|
/* Allow ATTR_FLAG_TYPE_IN_PLACE for the type's naming decl. */
|
|
|
|
|
if (!(TREE_CODE (*anode) == TYPE_DECL
|
|
|
|
|
&& *anode == TYPE_NAME (TYPE_MAIN_VARIANT
|
|
|
|
|
(TREE_TYPE (*anode)))))
|
|
|
|
|
flags &= ~(int) ATTR_FLAG_TYPE_IN_PLACE;
|
2002-01-17 21:34:40 +01:00
|
|
|
|
}
|
2001-09-22 15:14:40 +02:00
|
|
|
|
|
|
|
|
|
if (spec->function_type_required && TREE_CODE (*anode) != FUNCTION_TYPE
|
|
|
|
|
&& TREE_CODE (*anode) != METHOD_TYPE)
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (*anode) == POINTER_TYPE
|
|
|
|
|
&& (TREE_CODE (TREE_TYPE (*anode)) == FUNCTION_TYPE
|
|
|
|
|
|| TREE_CODE (TREE_TYPE (*anode)) == METHOD_TYPE))
|
|
|
|
|
{
|
2003-08-20 14:24:18 +02:00
|
|
|
|
/* OK, this is a bit convoluted. We can't just make a copy
|
|
|
|
|
of the pointer type and modify its TREE_TYPE, because if
|
|
|
|
|
we change the attributes of the target type the pointer
|
|
|
|
|
type needs to have a different TYPE_MAIN_VARIANT. So we
|
|
|
|
|
pull out the target type now, frob it as appropriate, and
|
|
|
|
|
rebuild the pointer type later.
|
|
|
|
|
|
2006-05-19 00:16:23 +02:00
|
|
|
|
This would all be simpler if attributes were part of the
|
|
|
|
|
declarator, grumble grumble. */
|
2003-08-20 14:24:18 +02:00
|
|
|
|
fn_ptr_tmp = TREE_TYPE (*anode);
|
2010-03-19 17:37:27 +01:00
|
|
|
|
fn_ptr_quals = TYPE_QUALS (*anode);
|
2003-08-20 14:24:18 +02:00
|
|
|
|
anode = &fn_ptr_tmp;
|
|
|
|
|
flags &= ~(int) ATTR_FLAG_TYPE_IN_PLACE;
|
2001-09-22 15:14:40 +02:00
|
|
|
|
}
|
|
|
|
|
else if (flags & (int) ATTR_FLAG_FUNCTION_NEXT)
|
|
|
|
|
{
|
|
|
|
|
/* Pass on this attribute to be tried again. */
|
|
|
|
|
returned_attrs = tree_cons (name, args, returned_attrs);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (*anode) != FUNCTION_TYPE
|
|
|
|
|
&& TREE_CODE (*anode) != METHOD_TYPE)
|
|
|
|
|
{
|
2005-05-25 06:18:19 +02:00
|
|
|
|
warning (OPT_Wattributes,
|
2009-05-05 01:44:36 +02:00
|
|
|
|
"%qE attribute only applies to function types",
|
|
|
|
|
name);
|
2001-09-22 15:14:40 +02:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-06-30 03:15:56 +02:00
|
|
|
|
if (TYPE_P (*anode)
|
|
|
|
|
&& (flags & (int) ATTR_FLAG_TYPE_IN_PLACE)
|
|
|
|
|
&& TYPE_SIZE (*anode) != NULL_TREE)
|
|
|
|
|
{
|
|
|
|
|
warning (OPT_Wattributes, "type attributes ignored after type is already defined");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-22 15:14:40 +02:00
|
|
|
|
if (spec->handler != NULL)
|
|
|
|
|
returned_attrs = chainon ((*spec->handler) (anode, name, args,
|
|
|
|
|
flags, &no_add_attrs),
|
|
|
|
|
returned_attrs);
|
2001-12-07 19:49:16 +01:00
|
|
|
|
|
|
|
|
|
/* Layout the decl in case anything changed. */
|
|
|
|
|
if (spec->type_required && DECL_P (*node)
|
2002-02-25 23:38:53 +01:00
|
|
|
|
&& (TREE_CODE (*node) == VAR_DECL
|
|
|
|
|
|| TREE_CODE (*node) == PARM_DECL
|
|
|
|
|
|| TREE_CODE (*node) == RESULT_DECL))
|
2004-12-09 23:55:41 +01:00
|
|
|
|
relayout_decl (*node);
|
2001-12-07 19:49:16 +01:00
|
|
|
|
|
2001-09-22 15:14:40 +02:00
|
|
|
|
if (!no_add_attrs)
|
|
|
|
|
{
|
|
|
|
|
tree old_attrs;
|
|
|
|
|
tree a;
|
|
|
|
|
|
|
|
|
|
if (DECL_P (*anode))
|
|
|
|
|
old_attrs = DECL_ATTRIBUTES (*anode);
|
|
|
|
|
else
|
|
|
|
|
old_attrs = TYPE_ATTRIBUTES (*anode);
|
|
|
|
|
|
|
|
|
|
for (a = lookup_attribute (spec->name, old_attrs);
|
|
|
|
|
a != NULL_TREE;
|
|
|
|
|
a = lookup_attribute (spec->name, TREE_CHAIN (a)))
|
|
|
|
|
{
|
|
|
|
|
if (simple_cst_equal (TREE_VALUE (a), args) == 1)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (a == NULL_TREE)
|
|
|
|
|
{
|
|
|
|
|
/* This attribute isn't already in the list. */
|
|
|
|
|
if (DECL_P (*anode))
|
|
|
|
|
DECL_ATTRIBUTES (*anode) = tree_cons (name, args, old_attrs);
|
|
|
|
|
else if (flags & (int) ATTR_FLAG_TYPE_IN_PLACE)
|
2004-05-01 00:26:48 +02:00
|
|
|
|
{
|
|
|
|
|
TYPE_ATTRIBUTES (*anode) = tree_cons (name, args, old_attrs);
|
|
|
|
|
/* If this is the main variant, also push the attributes
|
|
|
|
|
out to the other variants. */
|
|
|
|
|
if (*anode == TYPE_MAIN_VARIANT (*anode))
|
|
|
|
|
{
|
|
|
|
|
tree variant;
|
|
|
|
|
for (variant = *anode; variant;
|
|
|
|
|
variant = TYPE_NEXT_VARIANT (variant))
|
|
|
|
|
{
|
|
|
|
|
if (TYPE_ATTRIBUTES (variant) == old_attrs)
|
|
|
|
|
TYPE_ATTRIBUTES (variant)
|
|
|
|
|
= TYPE_ATTRIBUTES (*anode);
|
|
|
|
|
else if (!lookup_attribute
|
|
|
|
|
(spec->name, TYPE_ATTRIBUTES (variant)))
|
|
|
|
|
TYPE_ATTRIBUTES (variant) = tree_cons
|
|
|
|
|
(name, args, TYPE_ATTRIBUTES (variant));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-09-22 15:14:40 +02:00
|
|
|
|
else
|
|
|
|
|
*anode = build_type_attribute_variant (*anode,
|
|
|
|
|
tree_cons (name, args,
|
|
|
|
|
old_attrs));
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-08-20 14:24:18 +02:00
|
|
|
|
|
|
|
|
|
if (fn_ptr_tmp)
|
|
|
|
|
{
|
|
|
|
|
/* Rebuild the function pointer type and put it in the
|
|
|
|
|
appropriate place. */
|
|
|
|
|
fn_ptr_tmp = build_pointer_type (fn_ptr_tmp);
|
2010-03-19 17:37:27 +01:00
|
|
|
|
if (fn_ptr_quals)
|
|
|
|
|
fn_ptr_tmp = build_qualified_type (fn_ptr_tmp, fn_ptr_quals);
|
2003-08-20 14:24:18 +02:00
|
|
|
|
if (DECL_P (*node))
|
|
|
|
|
TREE_TYPE (*node) = fn_ptr_tmp;
|
|
|
|
|
else
|
alias.c (mems_in_disjoint_alias_sets_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* alias.c (mems_in_disjoint_alias_sets_p, record_alias_subset,
record_set, rtx_equal_for_memref_p, init_alias_analysis): Use
gcc_assert and gcc_unreachable instead of abort.
* alloc-pool.c (abort, fancy_abort): Remove.
(create_alloc_pool, free_alloc_pool, pool_alloc, pool_free): Use
gcc_assert or gcc_unreachable.
* attribs.c (init_attributes, decl_attributes): Likewise.
* bb-reorder.c (FREE, find_traces_1_round, copy_bb,
mark_bb_for_unlikely_executed_section,
add_labels_and_missing_jumps, fix_crossing_conditional_branches,
fix_crossing_unconditional_branches): Likewise.
* bitmap.c (bitmap_first_set_bit, bitmap_last_set_bit,
bitmap_operation): Likewise.
* bt-load.c (insn_sets_btr_p, augment_live_range,
move_btr_def): Likewise.
* builtins.c (c_readstr, expand_builtin_longjmp, apply_args_size,
apply_result_size, expand_builtin_apply, expand_builtin_mathfn,
expand_builtin_mathfn_2, expand_builtin_mathfn_3,
builtin_memcpy_read_str, expand_movstr, expand_builtin_stpcpy,
expand_builtin_memcmp, expand_builtin_args_info,
std_gimplify_va_arg_expr, expand_builtin_unop,
expand_builtin_fputs, expand_builtin_profile_func,
expand_builtin_fork_or_exec, fold_builtin_bitop,
fold_builtin_classify, fold_builtin_fputs): Likewise.
From-SVN: r86797
2004-08-30 21:13:03 +02:00
|
|
|
|
{
|
|
|
|
|
gcc_assert (TREE_CODE (*node) == POINTER_TYPE);
|
|
|
|
|
*node = fn_ptr_tmp;
|
|
|
|
|
}
|
2003-08-20 14:24:18 +02:00
|
|
|
|
}
|
2001-09-22 15:14:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return returned_attrs;
|
|
|
|
|
}
|