OSDN Git Service

Segher Boessenkool <segher@koffie.nl>
[pf3gnuchains/gcc-fork.git] / gcc / cppexp.c
index 5690436..202b2d0 100644 (file)
@@ -20,6 +20,8 @@ Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
+#include "coretypes.h"
+#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 
@@ -270,13 +272,18 @@ cpp_classify_number (pfile, token)
          return CPP_N_INVALID;
        }
 
-      /* Traditional C only accepted the 'L' suffix.  */
-      if (result != CPP_N_SMALL && result != CPP_N_MEDIUM
-         && CPP_WTRADITIONAL (pfile)
-         && ! cpp_sys_macro_p (pfile))
-       cpp_error (pfile, DL_WARNING,
-                  "traditional C rejects the \"%.*s\" suffix",
-                  (int) (limit - str), str);
+      /* Traditional C only accepted the 'L' suffix.
+         Suppress warning about 'LL' with -Wno-long-long.  */
+      if (CPP_WTRADITIONAL (pfile) && ! cpp_sys_macro_p (pfile))
+       {
+         int u_or_i = (result & (CPP_N_UNSIGNED|CPP_N_IMAGINARY));
+         int large = (result & CPP_N_WIDTH) == CPP_N_LARGE;
+
+         if (u_or_i || (large && CPP_OPTION (pfile, warn_long_long)))
+           cpp_error (pfile, DL_WARNING,
+                      "traditional C rejects the \"%.*s\" suffix",
+                      (int) (limit - str), str);
+       }
 
       if ((result & CPP_N_WIDTH) == CPP_N_LARGE
          && ! CPP_OPTION (pfile, c99)
@@ -378,7 +385,7 @@ cpp_interpret_integer (pfile, token, type)
                   "integer constant is too large for its type");
       /* If too big to be signed, consider it unsigned.  Only warn for
         decimal numbers.  Traditional numbers were always signed (but
-        we still honour an explicit U suffix); but we only have
+        we still honor an explicit U suffix); but we only have
         traditional semantics in directives.  */
       else if (!result.unsignedp
               && !(CPP_OPTION (pfile, traditional)
@@ -626,7 +633,7 @@ already on the stack.
 The remaining cases are '(' and ')'.  We handle '(' by skipping the
 reduction phase completely.  ')' is given lower priority than
 everything else, including '(', effectively forcing a reduction of the
-parenthesised expression.  If there is a matching '(', the routine
+parenthesized expression.  If there is a matching '(', the routine
 reduce() exits immediately.  If the normal exit route sees a ')', then
 there cannot have been a matching '(' and an error message is output.
 
@@ -769,7 +776,7 @@ _cpp_parse_expr (pfile)
        }
       else if (want_value)
        {
-         /* Ordering here is subtle and intended to favour the
+         /* Ordering here is subtle and intended to favor the
             missing parenthesis diagnostics over alternatives.  */
          if (op.op == CPP_CLOSE_PAREN)
            {
@@ -1441,6 +1448,7 @@ num_part_mul (lhs, rhs)
 
   result.high += HIGH_PART (middle[0]);
   result.high += HIGH_PART (middle[1]);
+  result.unsignedp = 1;
 
   return result;
 }
@@ -1546,7 +1554,7 @@ num_div_op (pfile, lhs, rhs, op)
       return lhs;
     }
 
-  /* First non-zero bit of RHS is bit I.  Do naive division by
+  /* First nonzero bit of RHS is bit I.  Do naive division by
      shifting the RHS fully left, and subtracting from LHS if LHS is
      at least as big, and then repeating but with one less shift.
      This is not very efficient, but is easy to understand.  */