X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fc-common.c;h=59dd295d3d62f0c3fb3bc18a4c6ae5f22631afc9;hb=fa09122aa24992c512e5e9e492e36fe1f3ebffd8;hp=6fa577c293af39940ceb7c58b40014e8472f4cc7;hpb=47b19b941e0899b3ec4df9868184297c43ed25c2;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/c-common.c b/gcc/c-common.c index 6fa577c293a..59dd295d3d6 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "c-pragma.h" #include "rtl.h" #include "ggc.h" -#include "expr.h" +#include "expr.h" /* For vector_mode_valid_p */ #include "c-common.h" #include "tm_p.h" #include "obstack.h" @@ -48,7 +48,6 @@ along with GCC; see the file COPYING3. If not see #include "real.h" #include "cgraph.h" #include "target-def.h" -#include "gimple.h" #include "fixed-value.h" #include "libfuncs.h" @@ -427,10 +426,6 @@ int flag_threadsafe_statics = 1; int flag_pretty_templates = 1; -/* Nonzero means warn about implicit declarations. */ - -int warn_implicit = 1; - /* Maximum template instantiation depth. This limit exists to limit the time it takes to notice infinite template instantiations; the default value of 1024 is likely to be in the next C++ standard. */ @@ -533,6 +528,7 @@ static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *); static tree handle_alloc_size_attribute (tree *, tree, tree, int, bool *); static tree handle_target_attribute (tree *, tree, tree, int, bool *); static tree handle_optimize_attribute (tree *, tree, tree, int, bool *); +static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *); static void check_function_nonnull (tree, int, tree *); static void check_nonnull_arg (void *, tree, unsigned HOST_WIDE_INT); @@ -567,6 +563,7 @@ const struct c_common_resword c_common_reswords[] = { "_Fract", RID_FRACT, D_CONLY | D_EXT }, { "_Accum", RID_ACCUM, D_CONLY | D_EXT }, { "_Sat", RID_SAT, D_CONLY | D_EXT }, + { "_Static_assert", RID_STATIC_ASSERT, D_CONLY }, { "__FUNCTION__", RID_FUNCTION_NAME, 0 }, { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 }, { "__alignof", RID_ALIGNOF, 0 }, @@ -660,6 +657,7 @@ const struct c_common_resword c_common_reswords[] = { "mutable", RID_MUTABLE, D_CXXONLY | D_CXXWARN }, { "namespace", RID_NAMESPACE, D_CXXONLY | D_CXXWARN }, { "new", RID_NEW, D_CXXONLY | D_CXXWARN }, + { "nullptr", RID_NULLPTR, D_CXXONLY | D_CXX0X | D_CXXWARN }, { "operator", RID_OPERATOR, D_CXXONLY | D_CXXWARN }, { "private", RID_PRIVATE, D_CXX_OBJC | D_CXXWARN }, { "protected", RID_PROTECTED, D_CXX_OBJC | D_CXXWARN }, @@ -832,6 +830,10 @@ const struct attribute_spec c_common_attribute_table[] = handle_target_attribute }, { "optimize", 1, -1, true, false, false, handle_optimize_attribute }, + /* 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 }, { NULL, 0, 0, false, false, false, NULL } }; @@ -5816,14 +5818,11 @@ c_init_attributes (void) identifier as an argument, so the front end shouldn't look it up. */ bool -attribute_takes_identifier_p (const_tree attr_id) +attribute_takes_identifier_p (tree attr_id) { - if (is_attribute_p ("mode", attr_id) - || is_attribute_p ("format", attr_id) - || is_attribute_p ("cleanup", attr_id)) - return true; - else - return targetm.attribute_takes_identifier_p (attr_id); + return (is_attribute_p ("mode", attr_id) + || is_attribute_p ("format", attr_id) + || is_attribute_p ("cleanup", attr_id)); } /* Attribute handlers common to C front ends. */ @@ -6695,10 +6694,12 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args, } else if (is_type) { + if ((flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) + /* OK, modify the type in place. */; /* If we have a TYPE_DECL, then copy the type, so that we don't accidentally modify a builtin type. See pushdecl. */ - if (decl && TREE_TYPE (decl) != error_mark_node - && DECL_ORIGINAL_TYPE (decl) == NULL_TREE) + else if (decl && TREE_TYPE (decl) != error_mark_node + && DECL_ORIGINAL_TYPE (decl) == NULL_TREE) { tree tt = TREE_TYPE (decl); *type = build_variant_type_copy (*type); @@ -6707,7 +6708,7 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args, TREE_USED (*type) = TREE_USED (decl); TREE_TYPE (decl) = *type; } - else if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) + else *type = build_variant_type_copy (*type); TYPE_ALIGN (*type) = (1U << i) * BITS_PER_UNIT; @@ -7139,6 +7140,20 @@ handle_alloc_size_attribute (tree *node, tree ARG_UNUSED (name), tree args, return NULL_TREE; } +/* Handle a "fn spec" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name), + tree args, int ARG_UNUSED (flags), + bool *no_add_attrs ATTRIBUTE_UNUSED) +{ + gcc_assert (args + && TREE_CODE (TREE_VALUE (args)) == STRING_CST + && !TREE_CHAIN (args)); + return NULL_TREE; +} + /* Handle a "returns_twice" attribute; arguments as in struct attribute_spec.handler. */ @@ -8762,7 +8777,6 @@ sync_resolve_params (tree orig_function, tree function, VEC(tree, gc) *params) { tree arg_types = TYPE_ARG_TYPES (TREE_TYPE (function)); tree ptype; - int number; unsigned int parmnum; /* We've declared the implementation functions to use "volatile void *" @@ -8770,7 +8784,6 @@ sync_resolve_params (tree orig_function, tree function, VEC(tree, gc) *params) call to check_function_arguments what ever type the user used. */ arg_types = TREE_CHAIN (arg_types); ptype = TREE_TYPE (TREE_TYPE (VEC_index (tree, params, 0))); - number = 2; /* For the rest of the values, we need to cast these to FTYPE, so that we don't get warnings for passing pointer types, etc. */ @@ -8795,7 +8808,6 @@ sync_resolve_params (tree orig_function, tree function, VEC(tree, gc) *params) VEC_replace (tree, params, parmnum, val); arg_types = TREE_CHAIN (arg_types); - number++; } /* The definition of these primitives is variadic, with the remaining