OSDN Git Service

* config/rs6000/rs6000.c (build_opaque_vector_type): Set
[pf3gnuchains/gcc-fork.git] / gcc / c-common.c
index 3fa1649..377db57 100644 (file)
@@ -221,7 +221,7 @@ tree c_global_trees[CTI_MAX];
 \f
 /* Switches common to the C front ends.  */
 
-/* Nonzero if prepreprocessing only.  */
+/* Nonzero if preprocessing only.  */
 
 int flag_preprocess_only;
 
@@ -360,7 +360,7 @@ int flag_gen_declaration;
 
 int print_struct_values;
 
-/* Tells the compiler what is the constant string class for Objc.  */
+/* Tells the compiler what is the constant string class for ObjC.  */
 
 const char *constant_string_class_name;
 
@@ -3072,8 +3072,7 @@ c_common_truthvalue_conversion (tree expr)
                c_common_truthvalue_conversion (TREE_OPERAND (expr, 1)),
                c_common_truthvalue_conversion (TREE_OPERAND (expr, 2)));
 
-    case CONVERT_EXPR:
-    case NOP_EXPR:
+    CASE_CONVERT:
       /* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE,
         since that affects how `default_conversion' will behave.  */
       if (TREE_CODE (TREE_TYPE (expr)) == REFERENCE_TYPE
@@ -3456,7 +3455,7 @@ c_alignof_expr (tree expr)
       tree best = t;
       int bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
 
-      while ((TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR)
+      while (CONVERT_EXPR_P (t)
             && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE)
        {
          int thisalign;
@@ -4174,18 +4173,6 @@ self_promoting_args_p (const_tree parms)
   return 1;
 }
 
-/* Recursively examines the array elements of TYPE, until a non-array
-   element type is found.  */
-
-tree
-strip_array_types (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)
@@ -4509,7 +4496,7 @@ c_do_switch_warnings (splay_tree cases, location_t switch_location,
        }
 
       /* Even though there wasn't an exact match, there might be a
-        case range which includes the enumator's value.  */
+        case range which includes the enumerator's value.  */
       node = splay_tree_predecessor (cases, (splay_tree_key) value);
       if (node && CASE_HIGH ((tree) node->value))
        {
@@ -6019,7 +6006,7 @@ handle_pure_attribute (tree *node, tree name, tree ARG_UNUSED (args),
                       int ARG_UNUSED (flags), bool *no_add_attrs)
 {
   if (TREE_CODE (*node) == FUNCTION_DECL)
-    DECL_IS_PURE (*node) = 1;
+    DECL_PURE_P (*node) = 1;
   /* ??? TODO: Support types.  */
   else
     {
@@ -6529,8 +6516,17 @@ handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
                               tree ARG_UNUSED (args), int ARG_UNUSED (flags),
                               bool * ARG_UNUSED (no_add_attrs))
 {
-  /* Ensure we have a function type, with no arguments.  */
-  gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE && ! TYPE_ARG_TYPES (*node));
+  tree params;
+  
+  /* Ensure we have a function type.  */
+  gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
+  
+  params = TYPE_ARG_TYPES (*node);
+  while (params && ! VOID_TYPE_P (TREE_VALUE (params)))
+    params = TREE_CHAIN (params);
+
+  /* Ensure we have a variadic function.  */
+  gcc_assert (!params);
 
   return NULL_TREE;
 }
@@ -6566,7 +6562,7 @@ check_function_arguments_recurse (void (*callback)
                                  void *ctx, tree param,
                                  unsigned HOST_WIDE_INT param_num)
 {
-  if ((TREE_CODE (param) == NOP_EXPR || TREE_CODE (param) == CONVERT_EXPR)
+  if (CONVERT_EXPR_P (param)
       && (TYPE_PRECISION (TREE_TYPE (param))
          == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (param, 0)))))
     {
@@ -6675,6 +6671,7 @@ check_builtin_function_arguments (tree fndecl, int nargs, tree *args)
 
     case BUILT_IN_ISFINITE:
     case BUILT_IN_ISINF:
+    case BUILT_IN_ISINF_SIGN:
     case BUILT_IN_ISNAN:
     case BUILT_IN_ISNORMAL:
       if (validate_nargs (fndecl, nargs, 1))
@@ -6712,6 +6709,29 @@ check_builtin_function_arguments (tree fndecl, int nargs, tree *args)
        }
       return false;
 
+    case BUILT_IN_FPCLASSIFY:
+      if (validate_nargs (fndecl, nargs, 6))
+       {
+         unsigned i;
+         
+         for (i=0; i<5; i++)
+           if (TREE_CODE (args[i]) != INTEGER_CST)
+             {
+               error ("non-const integer argument %u in call to function %qE",
+                      i+1, fndecl);
+               return false;
+             }
+
+         if (TREE_CODE (TREE_TYPE (args[5])) != REAL_TYPE)
+           {
+             error ("non-floating-point argument in call to function %qE",
+                    fndecl);
+             return false;
+           }
+         return true;
+       }
+      return false;
+
     default:
       return true;
     }
@@ -7452,60 +7472,6 @@ warn_array_subscript_with_type_char (tree index)
     warning (OPT_Wchar_subscripts, "array subscript has type %<char%>");
 }
 
-/* Warn about obvious array bounds errors for fixed size arrays that
-   are indexed by a constant.  This is a subset of similar checks in
-   tree-vrp.c; by doing this here we can get some level of checking
-   from non-optimized, non-vrp compilation.  Returns true if a warning
-   is issued.  */
-
-bool
-warn_array_subscript_range (const_tree array, const_tree index)
-{
-  if (skip_evaluation == 0
-      && TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE
-      && TYPE_DOMAIN (TREE_TYPE (array)) && TREE_CODE (index) == INTEGER_CST)
-    {
-      const_tree max_index;
-
-      max_index = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (array)));
-      if (max_index && TREE_CODE (max_index) == INTEGER_CST
-          && tree_int_cst_lt (max_index, index)
-          && !tree_int_cst_equal (index, max_index)
-          /* Always allow off-by-one.  */
-          && !tree_int_cst_equal (int_const_binop (PLUS_EXPR,
-                                                   max_index,
-                                                   integer_one_node,
-                                                   0),
-                                  index)
-          /* Accesses after the end of arrays of size 0 (gcc
-             extension) and 1 are likely intentional ("struct
-             hack").  Note that max_index is array dimension - 1.  */
-          && compare_tree_int (max_index, 1) >= 0)
-        {
-          warning (OPT_Warray_bounds,
-                   "array subscript is above array bounds");
-          return true;
-        }
-      else
-        {
-          const_tree min_index;
-
-          min_index = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (array)));
-          if (min_index && TREE_CODE (min_index) == INTEGER_CST
-              && tree_int_cst_lt (index, min_index))
-            {
-              warning (OPT_Warray_bounds,
-                       compare_tree_int (min_index, 0) == 0
-                           ? "array subscript is negative"
-                           : "array subscript is below array bounds");
-              return true;
-            }
-        }
-    }
-
-  return false;
-}
-
 /* Implement -Wparentheses for the unexpected C precedence rules, to
    cover cases like x + y << z which readers are likely to
    misinterpret.  We have seen an expression in which CODE is a binary