diff options
Diffstat (limited to 'gcc/c-family/c-attribs.c')
-rw-r--r-- | gcc/c-family/c-attribs.c | 393 |
1 files changed, 193 insertions, 200 deletions
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index 186df05..2625f87 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -245,236 +245,229 @@ static const struct attribute_spec::exclusions attr_const_pure_exclusions[] = Current list of processed common attributes: nonnull. */ const struct attribute_spec c_common_attribute_table[] = { - /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler, - affects_type_identity } */ - { "packed", 0, 0, false, false, false, - handle_packed_attribute, false, + /* { name, min_len, max_len, decl_req, type_req, fn_type_req, + affects_type_identity, handler, exclude } */ + { "packed", 0, 0, false, false, false, false, + handle_packed_attribute, attr_aligned_exclusions }, - { "nocommon", 0, 0, true, false, false, - handle_nocommon_attribute, false, + { "nocommon", 0, 0, true, false, false, false, + handle_nocommon_attribute, attr_common_exclusions }, - { "common", 0, 0, true, false, false, - handle_common_attribute, false, + { "common", 0, 0, true, false, false, false, + handle_common_attribute, attr_common_exclusions }, /* FIXME: logically, noreturn attributes should be listed as "false, true, true" and apply to function types. But implementing this would require all the places in the compiler that use TREE_THIS_VOLATILE on a decl to identify non-returning functions to be located and fixed to check the function type instead. */ - { "noreturn", 0, 0, true, false, false, - handle_noreturn_attribute, false, + { "noreturn", 0, 0, true, false, false, false, + handle_noreturn_attribute, attr_noreturn_exclusions }, - { "volatile", 0, 0, true, false, false, - handle_noreturn_attribute, false, NULL }, - { "stack_protect", 0, 0, true, false, false, - handle_stack_protect_attribute, false, NULL }, - { "noinline", 0, 0, true, false, false, - handle_noinline_attribute, false, + { "volatile", 0, 0, true, false, false, false, + handle_noreturn_attribute, NULL }, + { "stack_protect", 0, 0, true, false, false, false, + handle_stack_protect_attribute, NULL }, + { "noinline", 0, 0, true, false, false, false, + handle_noinline_attribute, attr_noinline_exclusions }, - { "noclone", 0, 0, true, false, false, - handle_noclone_attribute, false, NULL }, - { "no_icf", 0, 0, true, false, false, - handle_noicf_attribute, false, NULL }, - { "noipa", 0, 0, true, false, false, - handle_noipa_attribute, false, NULL }, - { "leaf", 0, 0, true, false, false, - handle_leaf_attribute, false, NULL }, - { "always_inline", 0, 0, true, false, false, - handle_always_inline_attribute, false, + { "noclone", 0, 0, true, false, false, false, + handle_noclone_attribute, NULL }, + { "no_icf", 0, 0, true, false, false, false, + handle_noicf_attribute, NULL }, + { "noipa", 0, 0, true, false, false, false, + handle_noipa_attribute, NULL }, + { "leaf", 0, 0, true, false, false, false, + handle_leaf_attribute, NULL }, + { "always_inline", 0, 0, true, false, false, false, + handle_always_inline_attribute, attr_inline_exclusions }, - { "gnu_inline", 0, 0, true, false, false, - handle_gnu_inline_attribute, false, + { "gnu_inline", 0, 0, true, false, false, false, + handle_gnu_inline_attribute, attr_inline_exclusions }, - { "artificial", 0, 0, true, false, false, - handle_artificial_attribute, false, NULL }, - { "flatten", 0, 0, true, false, false, - handle_flatten_attribute, false, NULL }, - { "used", 0, 0, true, false, false, - handle_used_attribute, false, NULL }, - { "unused", 0, 0, false, false, false, - handle_unused_attribute, false, NULL }, - { "externally_visible", 0, 0, true, false, false, - handle_externally_visible_attribute, false, NULL }, - { "no_reorder", 0, 0, true, false, false, - handle_no_reorder_attribute, false, NULL }, + { "artificial", 0, 0, true, false, false, false, + handle_artificial_attribute, NULL }, + { "flatten", 0, 0, true, false, false, false, + handle_flatten_attribute, NULL }, + { "used", 0, 0, true, false, false, false, + handle_used_attribute, NULL }, + { "unused", 0, 0, false, false, false, false, + handle_unused_attribute, NULL }, + { "externally_visible", 0, 0, true, false, false, false, + handle_externally_visible_attribute, NULL }, + { "no_reorder", 0, 0, true, false, false, false, + handle_no_reorder_attribute, NULL }, /* The same comments as for noreturn attributes apply to const ones. */ - { "const", 0, 0, true, false, false, - handle_const_attribute, false, + { "const", 0, 0, true, false, false, false, + handle_const_attribute, attr_const_pure_exclusions }, - { "scalar_storage_order", 1, 1, false, false, false, - handle_scalar_storage_order_attribute, false, NULL }, - { "transparent_union", 0, 0, false, false, false, - handle_transparent_union_attribute, false, NULL }, - { "constructor", 0, 1, true, false, false, - handle_constructor_attribute, false, NULL }, - { "destructor", 0, 1, true, false, false, - handle_destructor_attribute, false, NULL }, - { "mode", 1, 1, false, true, false, - handle_mode_attribute, false, NULL }, - { "section", 1, 1, true, false, false, - handle_section_attribute, false, NULL }, - { "aligned", 0, 1, false, false, false, - handle_aligned_attribute, false, + { "scalar_storage_order", 1, 1, false, false, false, false, + handle_scalar_storage_order_attribute, NULL }, + { "transparent_union", 0, 0, false, false, false, false, + handle_transparent_union_attribute, NULL }, + { "constructor", 0, 1, true, false, false, false, + handle_constructor_attribute, NULL }, + { "destructor", 0, 1, true, false, false, false, + handle_destructor_attribute, NULL }, + { "mode", 1, 1, false, true, false, false, + handle_mode_attribute, NULL }, + { "section", 1, 1, true, false, false, false, + handle_section_attribute, NULL }, + { "aligned", 0, 1, false, false, false, false, + handle_aligned_attribute, attr_aligned_exclusions }, - { "warn_if_not_aligned", 0, 1, false, false, false, - handle_warn_if_not_aligned_attribute, - false, NULL }, - { "weak", 0, 0, true, false, false, - handle_weak_attribute, false, NULL }, - { "noplt", 0, 0, true, false, false, - handle_noplt_attribute, false, NULL }, - { "ifunc", 1, 1, true, false, false, - handle_ifunc_attribute, false, NULL }, - { "alias", 1, 1, true, false, false, - handle_alias_attribute, false, NULL }, - { "weakref", 0, 1, true, false, false, - handle_weakref_attribute, false, NULL }, - { "no_instrument_function", 0, 0, true, false, false, + { "warn_if_not_aligned", 0, 1, false, false, false, false, + handle_warn_if_not_aligned_attribute, NULL }, + { "weak", 0, 0, true, false, false, false, + handle_weak_attribute, NULL }, + { "noplt", 0, 0, true, false, false, false, + handle_noplt_attribute, NULL }, + { "ifunc", 1, 1, true, false, false, false, + handle_ifunc_attribute, NULL }, + { "alias", 1, 1, true, false, false, false, + handle_alias_attribute, NULL }, + { "weakref", 0, 1, true, false, false, false, + handle_weakref_attribute, NULL }, + { "no_instrument_function", 0, 0, true, false, false, false, handle_no_instrument_function_attribute, - false, NULL }, - { "no_profile_instrument_function", 0, 0, true, false, false, + NULL }, + { "no_profile_instrument_function", 0, 0, true, false, false, false, handle_no_profile_instrument_function_attribute, - false, NULL }, - { "malloc", 0, 0, true, false, false, - handle_malloc_attribute, false, - attr_alloc_exclusions }, - { "returns_twice", 0, 0, true, false, false, - handle_returns_twice_attribute, false, + NULL }, + { "malloc", 0, 0, true, false, false, false, + handle_malloc_attribute, attr_alloc_exclusions }, + { "returns_twice", 0, 0, true, false, false, false, + handle_returns_twice_attribute, attr_returns_twice_exclusions }, - { "no_stack_limit", 0, 0, true, false, false, - handle_no_limit_stack_attribute, false, NULL }, - { "pure", 0, 0, true, false, false, - handle_pure_attribute, false, + { "no_stack_limit", 0, 0, true, false, false, false, + handle_no_limit_stack_attribute, NULL }, + { "pure", 0, 0, true, false, false, false, + handle_pure_attribute, attr_const_pure_exclusions }, - { "transaction_callable", 0, 0, false, true, false, - handle_tm_attribute, false, NULL }, - { "transaction_unsafe", 0, 0, false, true, false, - handle_tm_attribute, true, NULL }, - { "transaction_safe", 0, 0, false, true, false, - handle_tm_attribute, true, NULL }, - { "transaction_safe_dynamic", 0, 0, true, false, false, - handle_tm_attribute, false, NULL }, - { "transaction_may_cancel_outer", 0, 0, false, true, false, - handle_tm_attribute, false, NULL }, + { "transaction_callable", 0, 0, false, true, false, false, + handle_tm_attribute, NULL }, + { "transaction_unsafe", 0, 0, false, true, false, true, + handle_tm_attribute, NULL }, + { "transaction_safe", 0, 0, false, true, false, true, + handle_tm_attribute, NULL }, + { "transaction_safe_dynamic", 0, 0, true, false, false, false, + handle_tm_attribute, NULL }, + { "transaction_may_cancel_outer", 0, 0, false, true, false, false, + handle_tm_attribute, NULL }, /* ??? These two attributes didn't make the transition from the Intel language document to the multi-vendor language document. */ - { "transaction_pure", 0, 0, false, true, false, - handle_tm_attribute, false, NULL }, - { "transaction_wrap", 1, 1, true, false, false, - handle_tm_wrap_attribute, false, NULL }, + { "transaction_pure", 0, 0, false, true, false, false, + handle_tm_attribute, NULL }, + { "transaction_wrap", 1, 1, true, false, false, false, + handle_tm_wrap_attribute, NULL }, /* For internal use (marking of builtins) only. The name contains space to prevent its usage in source code. */ - { "no vops", 0, 0, true, false, false, - handle_novops_attribute, false, NULL }, - { "deprecated", 0, 1, false, false, false, - handle_deprecated_attribute, false, NULL }, - { "vector_size", 1, 1, false, true, false, - handle_vector_size_attribute, true, NULL }, - { "visibility", 1, 1, false, false, false, - handle_visibility_attribute, false, NULL }, - { "tls_model", 1, 1, true, false, false, - handle_tls_model_attribute, false, NULL }, - { "nonnull", 0, -1, false, true, true, - handle_nonnull_attribute, false, NULL }, - { "nonstring", 0, 0, true, false, false, - handle_nonstring_attribute, false, NULL }, - { "nothrow", 0, 0, true, false, false, - handle_nothrow_attribute, false, NULL }, - { "may_alias", 0, 0, false, true, false, NULL, false, NULL }, - { "cleanup", 1, 1, true, false, false, - handle_cleanup_attribute, false, NULL }, - { "warn_unused_result", 0, 0, false, true, true, - handle_warn_unused_result_attribute, false, + { "no vops", 0, 0, true, false, false, false, + handle_novops_attribute, NULL }, + { "deprecated", 0, 1, false, false, false, false, + handle_deprecated_attribute, NULL }, + { "vector_size", 1, 1, false, true, false, true, + handle_vector_size_attribute, NULL }, + { "visibility", 1, 1, false, false, false, false, + handle_visibility_attribute, NULL }, + { "tls_model", 1, 1, true, false, false, false, + handle_tls_model_attribute, NULL }, + { "nonnull", 0, -1, false, true, true, false, + handle_nonnull_attribute, NULL }, + { "nonstring", 0, 0, true, false, false, false, + handle_nonstring_attribute, NULL }, + { "nothrow", 0, 0, true, false, false, false, + handle_nothrow_attribute, NULL }, + { "may_alias", 0, 0, false, true, false, false, NULL, NULL }, + { "cleanup", 1, 1, true, false, false, false, + handle_cleanup_attribute, NULL }, + { "warn_unused_result", 0, 0, false, true, true, false, + handle_warn_unused_result_attribute, attr_warn_unused_result_exclusions }, - { "sentinel", 0, 1, false, true, true, - handle_sentinel_attribute, false, NULL }, + { "sentinel", 0, 1, false, true, true, false, + handle_sentinel_attribute, NULL }, /* For internal use (marking of builtins) only. The name contains space to prevent its usage in source code. */ - { "type generic", 0, 0, false, true, true, - handle_type_generic_attribute, false, NULL }, - { "alloc_size", 1, 2, false, true, true, - handle_alloc_size_attribute, false, + { "type generic", 0, 0, false, true, true, false, + handle_type_generic_attribute, NULL }, + { "alloc_size", 1, 2, false, true, true, false, + handle_alloc_size_attribute, attr_alloc_exclusions }, - { "cold", 0, 0, true, false, false, - handle_cold_attribute, false, + { "cold", 0, 0, true, false, false, false, + handle_cold_attribute, attr_cold_hot_exclusions }, - { "hot", 0, 0, true, false, false, - handle_hot_attribute, false, + { "hot", 0, 0, true, false, false, false, + handle_hot_attribute, attr_cold_hot_exclusions }, { "no_address_safety_analysis", - 0, 0, true, false, false, + 0, 0, true, false, false, false, handle_no_address_safety_analysis_attribute, - false, NULL }, - { "no_sanitize", 1, 1, true, false, false, - handle_no_sanitize_attribute, - false, NULL }, - { "no_sanitize_address", 0, 0, true, false, false, - handle_no_sanitize_address_attribute, - false, NULL }, - { "no_sanitize_thread", 0, 0, true, false, false, - handle_no_sanitize_thread_attribute, - false, NULL }, - { "no_sanitize_undefined", 0, 0, true, false, false, - handle_no_sanitize_undefined_attribute, - false, NULL }, - { "asan odr indicator", 0, 0, true, false, false, - handle_asan_odr_indicator_attribute, - false, NULL }, - { "warning", 1, 1, true, false, false, - handle_error_attribute, false, NULL }, - { "error", 1, 1, true, false, false, - handle_error_attribute, false, NULL }, - { "target", 1, -1, true, false, false, - handle_target_attribute, false, NULL }, - { "target_clones", 1, -1, true, false, false, - handle_target_clones_attribute, false, NULL }, - { "optimize", 1, -1, true, false, false, - handle_optimize_attribute, false, NULL }, + NULL }, + { "no_sanitize", 1, 1, true, false, false, false, + handle_no_sanitize_attribute, NULL }, + { "no_sanitize_address", 0, 0, true, false, false, false, + handle_no_sanitize_address_attribute, NULL }, + { "no_sanitize_thread", 0, 0, true, false, false, false, + handle_no_sanitize_thread_attribute, NULL }, + { "no_sanitize_undefined", 0, 0, true, false, false, false, + handle_no_sanitize_undefined_attribute, NULL }, + { "asan odr indicator", 0, 0, true, false, false, false, + handle_asan_odr_indicator_attribute, NULL }, + { "warning", 1, 1, true, false, false, false, + handle_error_attribute, NULL }, + { "error", 1, 1, true, false, false, false, + handle_error_attribute, NULL }, + { "target", 1, -1, true, false, false, false, + handle_target_attribute, NULL }, + { "target_clones", 1, -1, true, false, false, false, + handle_target_clones_attribute, NULL }, + { "optimize", 1, -1, true, false, false, false, + handle_optimize_attribute, NULL }, /* For internal use only. The leading '*' both prevents its usage in source code and signals that it may be overridden by machine tables. */ - { "*tm regparm", 0, 0, false, true, true, - ignore_attribute, false, NULL }, - { "no_split_stack", 0, 0, true, false, false, - handle_no_split_stack_attribute, false, NULL }, + { "*tm regparm", 0, 0, false, true, true, false, + ignore_attribute, NULL }, + { "no_split_stack", 0, 0, true, false, false, false, + handle_no_split_stack_attribute, NULL }, /* For internal use (marking of builtins and runtime functions) only. The name contains space to prevent its usage in source code. */ - { "fn spec", 1, 1, false, true, true, - handle_fnspec_attribute, false, NULL }, - { "warn_unused", 0, 0, false, false, false, - handle_warn_unused_attribute, false, NULL }, - { "returns_nonnull", 0, 0, false, true, true, - handle_returns_nonnull_attribute, false, NULL }, - { "omp declare simd", 0, -1, true, false, false, - handle_omp_declare_simd_attribute, false, NULL }, - { "cilk simd function", 0, -1, true, false, false, - handle_omp_declare_simd_attribute, false, NULL }, - { "simd", 0, 1, true, false, false, - handle_simd_attribute, false, NULL }, - { "omp declare target", 0, 0, true, false, false, - handle_omp_declare_target_attribute, false, NULL }, - { "omp declare target link", 0, 0, true, false, false, - handle_omp_declare_target_attribute, false, NULL }, - { "alloc_align", 1, 1, false, true, true, - handle_alloc_align_attribute, false, + { "fn spec", 1, 1, false, true, true, false, + handle_fnspec_attribute, NULL }, + { "warn_unused", 0, 0, false, false, false, false, + handle_warn_unused_attribute, NULL }, + { "returns_nonnull", 0, 0, false, true, true, false, + handle_returns_nonnull_attribute, NULL }, + { "omp declare simd", 0, -1, true, false, false, false, + handle_omp_declare_simd_attribute, NULL }, + { "cilk simd function", 0, -1, true, false, false, false, + handle_omp_declare_simd_attribute, NULL }, + { "simd", 0, 1, true, false, false, false, + handle_simd_attribute, NULL }, + { "omp declare target", 0, 0, true, false, false, false, + handle_omp_declare_target_attribute, NULL }, + { "omp declare target link", 0, 0, true, false, false, false, + handle_omp_declare_target_attribute, NULL }, + { "alloc_align", 1, 1, false, true, true, false, + handle_alloc_align_attribute, attr_alloc_exclusions }, - { "assume_aligned", 1, 2, false, true, true, - handle_assume_aligned_attribute, false, NULL }, - { "designated_init", 0, 0, false, true, false, - handle_designated_init_attribute, false, NULL }, - { "bnd_variable_size", 0, 0, true, false, false, - handle_bnd_variable_size_attribute, false, NULL }, - { "bnd_legacy", 0, 0, true, false, false, - handle_bnd_legacy, false, NULL }, - { "bnd_instrument", 0, 0, true, false, false, - handle_bnd_instrument, false, NULL }, - { "fallthrough", 0, 0, false, false, false, - handle_fallthrough_attribute, false, NULL }, - { "patchable_function_entry", 1, 2, true, false, false, + { "assume_aligned", 1, 2, false, true, true, false, + handle_assume_aligned_attribute, NULL }, + { "designated_init", 0, 0, false, true, false, false, + handle_designated_init_attribute, NULL }, + { "bnd_variable_size", 0, 0, true, false, false, false, + handle_bnd_variable_size_attribute, NULL }, + { "bnd_legacy", 0, 0, true, false, false, false, + handle_bnd_legacy, NULL }, + { "bnd_instrument", 0, 0, true, false, false, false, + handle_bnd_instrument, NULL }, + { "fallthrough", 0, 0, false, false, false, false, + handle_fallthrough_attribute, NULL }, + { "patchable_function_entry", 1, 2, true, false, false, false, handle_patchable_function_entry_attribute, - false, NULL }, - { "nocf_check", 0, 0, false, true, true, - handle_nocf_check_attribute, true, NULL }, - { NULL, 0, 0, false, false, false, NULL, false, NULL } + NULL }, + { "nocf_check", 0, 0, false, true, true, true, + handle_nocf_check_attribute, NULL }, + { NULL, 0, 0, false, false, false, false, NULL, NULL } }; /* Give the specifications for the format attributes, used by C and all @@ -486,13 +479,13 @@ const struct attribute_spec c_common_attribute_table[] = Current list of processed format attributes: format, format_arg. */ const struct attribute_spec c_common_format_attribute_table[] = { - /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler, - affects_type_identity } */ - { "format", 3, 3, false, true, true, - handle_format_attribute, false, NULL }, - { "format_arg", 1, 1, false, true, true, - handle_format_arg_attribute, false, NULL }, - { NULL, 0, 0, false, false, false, NULL, false, NULL } + /* { name, min_len, max_len, decl_req, type_req, fn_type_req, + affects_type_identity, handler, exclude } */ + { "format", 3, 3, false, true, true, false, + handle_format_attribute, NULL }, + { "format_arg", 1, 1, false, true, true, false, + handle_format_arg_attribute, NULL }, + { NULL, 0, 0, false, false, false, false, NULL, NULL } }; /* Returns TRUE iff the attribute indicated by ATTR_ID takes a plain |