OSDN Git Service

2010-04-26 Jack Howarth <howarth@bromo.med.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / c-common.c
index 32dc21e..25ce2d7 100644 (file)
@@ -280,10 +280,14 @@ int flag_cond_mismatch;
 
 int flag_isoc94;
 
-/* Nonzero means use the ISO C99 dialect of C.  */
+/* Nonzero means use the ISO C99 (or C1X) dialect of C.  */
 
 int flag_isoc99;
 
+/* Nonzero means use the ISO C1X dialect of C.  */
+
+int flag_isoc1x;
+
 /* Nonzero means that we have builtin functions, and main is an int.  */
 
 int flag_hosted = 1;
@@ -3806,12 +3810,18 @@ pointer_int_sum (location_t loc, enum tree_code resultcode,
                                             TYPE_UNSIGNED (sizetype)), intop);
 
   /* Replace the integer argument with a suitable product by the object size.
-     Do this multiplication as signed, then convert to the appropriate
-     type for the pointer operation.  */
-  intop = convert (sizetype,
-                  build_binary_op (loc,
-                                   MULT_EXPR, intop,
-                                   convert (TREE_TYPE (intop), size_exp), 1));
+     Do this multiplication as signed, then convert to the appropriate type
+     for the pointer operation and disregard an overflow that occured only
+     because of the sign-extension change in the latter conversion.  */
+  {
+    tree t = build_binary_op (loc,
+                             MULT_EXPR, intop,
+                             convert (TREE_TYPE (intop), size_exp), 1);
+    intop = convert (sizetype, t);
+    if (TREE_OVERFLOW_P (intop) && !TREE_OVERFLOW (t))
+      intop = build_int_cst_wide (TREE_TYPE (intop), TREE_INT_CST_LOW (intop),
+                                 TREE_INT_CST_HIGH (intop));
+  }
 
   /* Create the sum or difference.  */
   if (resultcode == MINUS_EXPR)
@@ -4390,7 +4400,7 @@ c_sizeof_or_alignof_type (location_t loc,
       if (complain)
        error_at (loc, "invalid application of %qs to incomplete type %qT ",
                  op_name, type);
-      value = size_zero_node;
+      return error_mark_node;
     }
   else
     {
@@ -5803,6 +5813,17 @@ c_init_attributes (void)
 #undef DEF_ATTR_TREE_LIST
 }
 
+/* Returns TRUE iff the attribute indicated by ATTR_ID takes a plain
+   identifier as an argument, so the front end shouldn't look it up.  */
+
+bool
+attribute_takes_identifier_p (tree 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.  */
 
 /* Handle a "packed" attribute; arguments as in