]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
matrix-reorg.c (compute_offset): Avoid C++ keywords.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Wed, 6 Aug 2008 17:22:05 +0000 (17:22 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Wed, 6 Aug 2008 17:22:05 +0000 (17:22 +0000)
* matrix-reorg.c (compute_offset): Avoid C++ keywords.

* c-common.c: Fix typo.
(c_common_reswords): Activate more C++ keyword warnings.

testsuite:
* gcc.dg/Wcxx-compat-2.c: Adjust test for more warnings.

From-SVN: r138817

gcc/ChangeLog
gcc/c-common.c
gcc/matrix-reorg.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wcxx-compat-2.c

index 00b3b7dabdb1b829a8a03675160832133df1cd4b..f461410957e9ab3d52c863bdc70f031474f1f221 100644 (file)
@@ -1,3 +1,10 @@
+2008-08-06  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * c-common.c: Fix typo.
+       (c_common_reswords): Activate more C++ keyword warnings.
+
+       * matrix-reorg.c (compute_offset): Avoid C++ keywords.
+
 2008-08-06  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
        
        PR 26785
index d0ff04be79d2ed8ef351897d8f53a15cf8acf571..da3dc3bc48bdef029d8b9fd85f03897e0b9049e8 100644 (file)
@@ -598,7 +598,7 @@ static int resort_field_decl_cmp (const void *, const void *);
    If -fno-asm is used, D_ASM is added to the mask.  If
    -fno-gnu-keywords is used, D_EXT is added.  If -fno-asm and C in
    C89 mode, D_EXT89 is added for both -fno-asm and -fno-gnu-keywords.
-   In C with -Wcxx-compat, we warn if D_CXXWARN is set.  */
+   In C with -Wc++-compat, we warn if D_CXXWARN is set.  */
 
 const struct c_common_resword c_common_reswords[] =
 {
@@ -668,41 +668,41 @@ const struct c_common_resword c_common_reswords[] =
   { "bool",            RID_BOOL,       D_CXXONLY },
   { "break",           RID_BREAK,      0 },
   { "case",            RID_CASE,       0 },
-  { "catch",           RID_CATCH,      D_CXX_OBJC },
+  { "catch",           RID_CATCH,      D_CXX_OBJC | D_CXXWARN },
   { "char",            RID_CHAR,       0 },
-  { "char16_t",                RID_CHAR16,     D_CXXONLY | D_CXX0X },
-  { "char32_t",                RID_CHAR32,     D_CXXONLY | D_CXX0X },
-  { "class",           RID_CLASS,      D_CXX_OBJC },
+  { "char16_t",                RID_CHAR16,     D_CXXONLY | D_CXX0X | D_CXXWARN },
+  { "char32_t",                RID_CHAR32,     D_CXXONLY | D_CXX0X | D_CXXWARN },
+  { "class",           RID_CLASS,      D_CXX_OBJC | D_CXXWARN },
   { "const",           RID_CONST,      0 },
   { "const_cast",      RID_CONSTCAST,  D_CXXONLY | D_CXXWARN },
   { "continue",                RID_CONTINUE,   0 },
-  { "decltype",         RID_DECLTYPE,   D_CXXONLY | D_CXX0X },
+  { "decltype",         RID_DECLTYPE,   D_CXXONLY | D_CXX0X | D_CXXWARN },
   { "default",         RID_DEFAULT,    0 },
-  { "delete",          RID_DELETE,     D_CXXONLY },
+  { "delete",          RID_DELETE,     D_CXXONLY | D_CXXWARN },
   { "do",              RID_DO,         0 },
   { "double",          RID_DOUBLE,     0 },
   { "dynamic_cast",    RID_DYNCAST,    D_CXXONLY | D_CXXWARN },
   { "else",            RID_ELSE,       0 },
   { "enum",            RID_ENUM,       0 },
-  { "explicit",                RID_EXPLICIT,   D_CXXONLY },
-  { "export",          RID_EXPORT,     D_CXXONLY },
+  { "explicit",                RID_EXPLICIT,   D_CXXONLY | D_CXXWARN },
+  { "export",          RID_EXPORT,     D_CXXONLY | D_CXXWARN },
   { "extern",          RID_EXTERN,     0 },
-  { "false",           RID_FALSE,      D_CXXONLY },
+  { "false",           RID_FALSE,      D_CXXONLY | D_CXXWARN },
   { "float",           RID_FLOAT,      0 },
   { "for",             RID_FOR,        0 },
-  { "friend",          RID_FRIEND,     D_CXXONLY },
+  { "friend",          RID_FRIEND,     D_CXXONLY | D_CXXWARN },
   { "goto",            RID_GOTO,       0 },
   { "if",              RID_IF,         0 },
   { "inline",          RID_INLINE,     D_EXT89 },
   { "int",             RID_INT,        0 },
   { "long",            RID_LONG,       0 },
   { "mutable",         RID_MUTABLE,    D_CXXONLY | D_CXXWARN },
-  { "namespace",       RID_NAMESPACE,  D_CXXONLY },
-  { "new",             RID_NEW,        D_CXXONLY },
-  { "operator",                RID_OPERATOR,   D_CXXONLY },
-  { "private",         RID_PRIVATE,    D_CXX_OBJC },
-  { "protected",       RID_PROTECTED,  D_CXX_OBJC },
-  { "public",          RID_PUBLIC,     D_CXX_OBJC },
+  { "namespace",       RID_NAMESPACE,  D_CXXONLY | D_CXXWARN },
+  { "new",             RID_NEW,        D_CXXONLY | 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 },
+  { "public",          RID_PUBLIC,     D_CXX_OBJC | D_CXXWARN },
   { "register",                RID_REGISTER,   0 },
   { "reinterpret_cast",        RID_REINTCAST,  D_CXXONLY | D_CXXWARN },
   { "restrict",                RID_RESTRICT,   D_CONLY | D_C99 },
@@ -715,19 +715,19 @@ const struct c_common_resword c_common_reswords[] =
   { "static_cast",     RID_STATCAST,   D_CXXONLY | D_CXXWARN },
   { "struct",          RID_STRUCT,     0 },
   { "switch",          RID_SWITCH,     0 },
-  { "template",                RID_TEMPLATE,   D_CXXONLY },
-  { "this",            RID_THIS,       D_CXXONLY },
-  { "throw",           RID_THROW,      D_CXX_OBJC },
-  { "true",            RID_TRUE,       D_CXXONLY },
-  { "try",             RID_TRY,        D_CXX_OBJC },
+  { "template",                RID_TEMPLATE,   D_CXXONLY | D_CXXWARN },
+  { "this",            RID_THIS,       D_CXXONLY | D_CXXWARN },
+  { "throw",           RID_THROW,      D_CXX_OBJC | D_CXXWARN },
+  { "true",            RID_TRUE,       D_CXXONLY | D_CXXWARN },
+  { "try",             RID_TRY,        D_CXX_OBJC | D_CXXWARN },
   { "typedef",         RID_TYPEDEF,    0 },
-  { "typename",                RID_TYPENAME,   D_CXXONLY },
-  { "typeid",          RID_TYPEID,     D_CXXONLY },
+  { "typename",                RID_TYPENAME,   D_CXXONLY | D_CXXWARN },
+  { "typeid",          RID_TYPEID,     D_CXXONLY | D_CXXWARN },
   { "typeof",          RID_TYPEOF,     D_ASM | D_EXT },
   { "union",           RID_UNION,      0 },
   { "unsigned",                RID_UNSIGNED,   0 },
-  { "using",           RID_USING,      D_CXXONLY },
-  { "virtual",         RID_VIRTUAL,    D_CXXONLY },
+  { "using",           RID_USING,      D_CXXONLY | D_CXXWARN },
+  { "virtual",         RID_VIRTUAL,    D_CXXONLY | D_CXXWARN },
   { "void",            RID_VOID,       0 },
   { "volatile",                RID_VOLATILE,   0 },
   { "wchar_t",         RID_WCHAR,      D_CXXONLY },
index 846a813898f9a13d0b87a2b173c62be07ae0da21..66145518f533221e9c1d0132e845649a3b4ecfee 100644 (file)
@@ -1755,16 +1755,20 @@ record_all_accesses_in_func (void)
   sbitmap_free (visited_stmts_1);
 }
 
-/* Used when we want to convert the expression: RESULT =  something * ORIG to RESULT = something * NEW. If ORIG and NEW are power of 2, shift operations can be done, else division and multiplication.  */
+/* Used when we want to convert the expression: RESULT = something *
+   ORIG to RESULT = something * NEW_VAL. If ORIG and NEW_VAL are power
+   of 2, shift operations can be done, else division and
+   multiplication.  */
+
 static tree
-compute_offset (HOST_WIDE_INT orig, HOST_WIDE_INT new, tree result)
+compute_offset (HOST_WIDE_INT orig, HOST_WIDE_INT new_val, tree result)
 {
 
   int x, y;
   tree result1, ratio, log, orig_tree, new_tree;
 
   x = exact_log2 (orig);
-  y = exact_log2 (new);
+  y = exact_log2 (new_val);
 
   if (x != -1 && y != -1)
     {
@@ -1783,7 +1787,7 @@ compute_offset (HOST_WIDE_INT orig, HOST_WIDE_INT new, tree result)
       return result1;
     }
   orig_tree = build_int_cst (TREE_TYPE (result), orig);
-  new_tree = build_int_cst (TREE_TYPE (result), new);
+  new_tree = build_int_cst (TREE_TYPE (result), new_val);
   ratio = fold_build2 (TRUNC_DIV_EXPR, TREE_TYPE (result), result, orig_tree);
   result1 = fold_build2 (MULT_EXPR, TREE_TYPE (result), ratio, new_tree);
 
index d1bed88f968c2f78984e4e0f131050839a420af5..e53ea0b28148ff1310e92c48c1fde620a2183554 100644 (file)
@@ -1,3 +1,7 @@
+2008-08-06  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * gcc.dg/Wcxx-compat-2.c: Adjust test for more warnings.
+
 2008-08-06  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
        PR 26785
index 5a46fbe4bd597201c8da93b7f344db25813bf2b0..43149aa6500f31c048566767cc0024b82b3d3b62 100644 (file)
@@ -1,35 +1,35 @@
 /* { dg-options "-Wc++-compat" } */
 
 int bool;
-int catch;
-int char16_t;
-int char32_t;
-int class;
+int catch;                     /* { dg-warning "keyword" } */
+int char16_t;                  /* { dg-warning "keyword" } */
+int char32_t;                  /* { dg-warning "keyword" } */
+int class;                     /* { dg-warning "keyword" } */
 int const_cast;                        /* { dg-warning "keyword" } */
-int decltype;
-int delete;
+int decltype;                  /* { dg-warning "keyword" } */
+int delete;                    /* { dg-warning "keyword" } */
 int dynamic_cast;              /* { dg-warning "keyword" } */
-int explicit;
-int export;
-int false;
-int friend;
+int explicit;                  /* { dg-warning "keyword" } */
+int export;                    /* { dg-warning "keyword" } */
+int false;                     /* { dg-warning "keyword" } */
+int friend;                    /* { dg-warning "keyword" } */
 int mutable;                   /* { dg-warning "keyword" } */
-int namespace;
-int new;
-int operator;
-int private;
-int protected;
-int public;
+int namespace;                 /* { dg-warning "keyword" } */
+int new;                       /* { dg-warning "keyword" } */
+int operator;                  /* { dg-warning "keyword" } */
+int private;                   /* { dg-warning "keyword" } */
+int protected;                 /* { dg-warning "keyword" } */
+int public;                    /* { dg-warning "keyword" } */
 int reinterpret_cast;          /* { dg-warning "keyword" } */
 int static_assert;             /* { dg-warning "keyword" } */
 int static_cast;               /* { dg-warning "keyword" } */
-int template;
-int this;
-int throw;
-int true;
-int try;
-int typename;
-int typeid;
-int using;
-int virtual;
+int template;                  /* { dg-warning "keyword" } */
+int this;                      /* { dg-warning "keyword" } */
+int throw;                     /* { dg-warning "keyword" } */
+int true;                      /* { dg-warning "keyword" } */
+int try;                       /* { dg-warning "keyword" } */
+int typename;                  /* { dg-warning "keyword" } */
+int typeid;                    /* { dg-warning "keyword" } */
+int using;                     /* { dg-warning "keyword" } */
+int virtual;                   /* { dg-warning "keyword" } */
 int wchar_t;