Commit 2696a995 by Kaveh R. Ghazi Committed by Kaveh Ghazi

matrix-reorg.c (compute_offset): Avoid C++ keywords.

	* 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
parent 7e99f74b
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> 2008-08-06 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 26785 PR 26785
......
...@@ -598,7 +598,7 @@ static int resort_field_decl_cmp (const void *, const void *); ...@@ -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 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 -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. 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[] = const struct c_common_resword c_common_reswords[] =
{ {
...@@ -668,41 +668,41 @@ 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 }, { "bool", RID_BOOL, D_CXXONLY },
{ "break", RID_BREAK, 0 }, { "break", RID_BREAK, 0 },
{ "case", RID_CASE, 0 }, { "case", RID_CASE, 0 },
{ "catch", RID_CATCH, D_CXX_OBJC }, { "catch", RID_CATCH, D_CXX_OBJC | D_CXXWARN },
{ "char", RID_CHAR, 0 }, { "char", RID_CHAR, 0 },
{ "char16_t", RID_CHAR16, D_CXXONLY | D_CXX0X }, { "char16_t", RID_CHAR16, D_CXXONLY | D_CXX0X | D_CXXWARN },
{ "char32_t", RID_CHAR32, D_CXXONLY | D_CXX0X }, { "char32_t", RID_CHAR32, D_CXXONLY | D_CXX0X | D_CXXWARN },
{ "class", RID_CLASS, D_CXX_OBJC }, { "class", RID_CLASS, D_CXX_OBJC | D_CXXWARN },
{ "const", RID_CONST, 0 }, { "const", RID_CONST, 0 },
{ "const_cast", RID_CONSTCAST, D_CXXONLY | D_CXXWARN }, { "const_cast", RID_CONSTCAST, D_CXXONLY | D_CXXWARN },
{ "continue", RID_CONTINUE, 0 }, { "continue", RID_CONTINUE, 0 },
{ "decltype", RID_DECLTYPE, D_CXXONLY | D_CXX0X }, { "decltype", RID_DECLTYPE, D_CXXONLY | D_CXX0X | D_CXXWARN },
{ "default", RID_DEFAULT, 0 }, { "default", RID_DEFAULT, 0 },
{ "delete", RID_DELETE, D_CXXONLY }, { "delete", RID_DELETE, D_CXXONLY | D_CXXWARN },
{ "do", RID_DO, 0 }, { "do", RID_DO, 0 },
{ "double", RID_DOUBLE, 0 }, { "double", RID_DOUBLE, 0 },
{ "dynamic_cast", RID_DYNCAST, D_CXXONLY | D_CXXWARN }, { "dynamic_cast", RID_DYNCAST, D_CXXONLY | D_CXXWARN },
{ "else", RID_ELSE, 0 }, { "else", RID_ELSE, 0 },
{ "enum", RID_ENUM, 0 }, { "enum", RID_ENUM, 0 },
{ "explicit", RID_EXPLICIT, D_CXXONLY }, { "explicit", RID_EXPLICIT, D_CXXONLY | D_CXXWARN },
{ "export", RID_EXPORT, D_CXXONLY }, { "export", RID_EXPORT, D_CXXONLY | D_CXXWARN },
{ "extern", RID_EXTERN, 0 }, { "extern", RID_EXTERN, 0 },
{ "false", RID_FALSE, D_CXXONLY }, { "false", RID_FALSE, D_CXXONLY | D_CXXWARN },
{ "float", RID_FLOAT, 0 }, { "float", RID_FLOAT, 0 },
{ "for", RID_FOR, 0 }, { "for", RID_FOR, 0 },
{ "friend", RID_FRIEND, D_CXXONLY }, { "friend", RID_FRIEND, D_CXXONLY | D_CXXWARN },
{ "goto", RID_GOTO, 0 }, { "goto", RID_GOTO, 0 },
{ "if", RID_IF, 0 }, { "if", RID_IF, 0 },
{ "inline", RID_INLINE, D_EXT89 }, { "inline", RID_INLINE, D_EXT89 },
{ "int", RID_INT, 0 }, { "int", RID_INT, 0 },
{ "long", RID_LONG, 0 }, { "long", RID_LONG, 0 },
{ "mutable", RID_MUTABLE, D_CXXONLY | D_CXXWARN }, { "mutable", RID_MUTABLE, D_CXXONLY | D_CXXWARN },
{ "namespace", RID_NAMESPACE, D_CXXONLY }, { "namespace", RID_NAMESPACE, D_CXXONLY | D_CXXWARN },
{ "new", RID_NEW, D_CXXONLY }, { "new", RID_NEW, D_CXXONLY | D_CXXWARN },
{ "operator", RID_OPERATOR, D_CXXONLY }, { "operator", RID_OPERATOR, D_CXXONLY | D_CXXWARN },
{ "private", RID_PRIVATE, D_CXX_OBJC }, { "private", RID_PRIVATE, D_CXX_OBJC | D_CXXWARN },
{ "protected", RID_PROTECTED, D_CXX_OBJC }, { "protected", RID_PROTECTED, D_CXX_OBJC | D_CXXWARN },
{ "public", RID_PUBLIC, D_CXX_OBJC }, { "public", RID_PUBLIC, D_CXX_OBJC | D_CXXWARN },
{ "register", RID_REGISTER, 0 }, { "register", RID_REGISTER, 0 },
{ "reinterpret_cast", RID_REINTCAST, D_CXXONLY | D_CXXWARN }, { "reinterpret_cast", RID_REINTCAST, D_CXXONLY | D_CXXWARN },
{ "restrict", RID_RESTRICT, D_CONLY | D_C99 }, { "restrict", RID_RESTRICT, D_CONLY | D_C99 },
...@@ -715,19 +715,19 @@ const struct c_common_resword c_common_reswords[] = ...@@ -715,19 +715,19 @@ const struct c_common_resword c_common_reswords[] =
{ "static_cast", RID_STATCAST, D_CXXONLY | D_CXXWARN }, { "static_cast", RID_STATCAST, D_CXXONLY | D_CXXWARN },
{ "struct", RID_STRUCT, 0 }, { "struct", RID_STRUCT, 0 },
{ "switch", RID_SWITCH, 0 }, { "switch", RID_SWITCH, 0 },
{ "template", RID_TEMPLATE, D_CXXONLY }, { "template", RID_TEMPLATE, D_CXXONLY | D_CXXWARN },
{ "this", RID_THIS, D_CXXONLY }, { "this", RID_THIS, D_CXXONLY | D_CXXWARN },
{ "throw", RID_THROW, D_CXX_OBJC }, { "throw", RID_THROW, D_CXX_OBJC | D_CXXWARN },
{ "true", RID_TRUE, D_CXXONLY }, { "true", RID_TRUE, D_CXXONLY | D_CXXWARN },
{ "try", RID_TRY, D_CXX_OBJC }, { "try", RID_TRY, D_CXX_OBJC | D_CXXWARN },
{ "typedef", RID_TYPEDEF, 0 }, { "typedef", RID_TYPEDEF, 0 },
{ "typename", RID_TYPENAME, D_CXXONLY }, { "typename", RID_TYPENAME, D_CXXONLY | D_CXXWARN },
{ "typeid", RID_TYPEID, D_CXXONLY }, { "typeid", RID_TYPEID, D_CXXONLY | D_CXXWARN },
{ "typeof", RID_TYPEOF, D_ASM | D_EXT }, { "typeof", RID_TYPEOF, D_ASM | D_EXT },
{ "union", RID_UNION, 0 }, { "union", RID_UNION, 0 },
{ "unsigned", RID_UNSIGNED, 0 }, { "unsigned", RID_UNSIGNED, 0 },
{ "using", RID_USING, D_CXXONLY }, { "using", RID_USING, D_CXXONLY | D_CXXWARN },
{ "virtual", RID_VIRTUAL, D_CXXONLY }, { "virtual", RID_VIRTUAL, D_CXXONLY | D_CXXWARN },
{ "void", RID_VOID, 0 }, { "void", RID_VOID, 0 },
{ "volatile", RID_VOLATILE, 0 }, { "volatile", RID_VOLATILE, 0 },
{ "wchar_t", RID_WCHAR, D_CXXONLY }, { "wchar_t", RID_WCHAR, D_CXXONLY },
......
...@@ -1755,16 +1755,20 @@ record_all_accesses_in_func (void) ...@@ -1755,16 +1755,20 @@ record_all_accesses_in_func (void)
sbitmap_free (visited_stmts_1); 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 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; int x, y;
tree result1, ratio, log, orig_tree, new_tree; tree result1, ratio, log, orig_tree, new_tree;
x = exact_log2 (orig); x = exact_log2 (orig);
y = exact_log2 (new); y = exact_log2 (new_val);
if (x != -1 && y != -1) if (x != -1 && y != -1)
{ {
...@@ -1783,7 +1787,7 @@ compute_offset (HOST_WIDE_INT orig, HOST_WIDE_INT new, tree result) ...@@ -1783,7 +1787,7 @@ compute_offset (HOST_WIDE_INT orig, HOST_WIDE_INT new, tree result)
return result1; return result1;
} }
orig_tree = build_int_cst (TREE_TYPE (result), orig); 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); ratio = fold_build2 (TRUNC_DIV_EXPR, TREE_TYPE (result), result, orig_tree);
result1 = fold_build2 (MULT_EXPR, TREE_TYPE (result), ratio, new_tree); result1 = fold_build2 (MULT_EXPR, TREE_TYPE (result), ratio, new_tree);
......
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> 2008-08-06 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 26785 PR 26785
......
/* { dg-options "-Wc++-compat" } */ /* { dg-options "-Wc++-compat" } */
int bool; int bool;
int catch; int catch; /* { dg-warning "keyword" } */
int char16_t; int char16_t; /* { dg-warning "keyword" } */
int char32_t; int char32_t; /* { dg-warning "keyword" } */
int class; int class; /* { dg-warning "keyword" } */
int const_cast; /* { dg-warning "keyword" } */ int const_cast; /* { dg-warning "keyword" } */
int decltype; int decltype; /* { dg-warning "keyword" } */
int delete; int delete; /* { dg-warning "keyword" } */
int dynamic_cast; /* { dg-warning "keyword" } */ int dynamic_cast; /* { dg-warning "keyword" } */
int explicit; int explicit; /* { dg-warning "keyword" } */
int export; int export; /* { dg-warning "keyword" } */
int false; int false; /* { dg-warning "keyword" } */
int friend; int friend; /* { dg-warning "keyword" } */
int mutable; /* { dg-warning "keyword" } */ int mutable; /* { dg-warning "keyword" } */
int namespace; int namespace; /* { dg-warning "keyword" } */
int new; int new; /* { dg-warning "keyword" } */
int operator; int operator; /* { dg-warning "keyword" } */
int private; int private; /* { dg-warning "keyword" } */
int protected; int protected; /* { dg-warning "keyword" } */
int public; int public; /* { dg-warning "keyword" } */
int reinterpret_cast; /* { dg-warning "keyword" } */ int reinterpret_cast; /* { dg-warning "keyword" } */
int static_assert; /* { dg-warning "keyword" } */ int static_assert; /* { dg-warning "keyword" } */
int static_cast; /* { dg-warning "keyword" } */ int static_cast; /* { dg-warning "keyword" } */
int template; int template; /* { dg-warning "keyword" } */
int this; int this; /* { dg-warning "keyword" } */
int throw; int throw; /* { dg-warning "keyword" } */
int true; int true; /* { dg-warning "keyword" } */
int try; int try; /* { dg-warning "keyword" } */
int typename; int typename; /* { dg-warning "keyword" } */
int typeid; int typeid; /* { dg-warning "keyword" } */
int using; int using; /* { dg-warning "keyword" } */
int virtual; int virtual; /* { dg-warning "keyword" } */
int wchar_t; int wchar_t;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment