From 31ec7d2ff721fc2e54c80cd76564f80ffbe63244 Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Sun, 18 Jul 2004 23:57:31 +0000 Subject: [PATCH] c-common.c (c_common_truthvalue_conversion): Don't warn if TREE_NO_WARNING is set. * c-common.c (c_common_truthvalue_conversion): Don't warn if TREE_NO_WARNING is set. cp/ * cp-tree.h (C_SET_EXP_ORIGINAL_CODE): Remove. * decl2.c (grokfield): Don't check current_class_depth via unused TREE_COMPLEXITY. * semantics.c (finish_parenthesized_expr): Set TREE_NO_WARNING to avoid the missing parentheses warning. Don't set C_SET_EXP_ORIGINAL_CODE. Co-Authored-By: Joseph Myers From-SVN: r84903 --- gcc/ChangeLog | 6 ++++++ gcc/c-common.c | 4 +++- gcc/cp/ChangeLog | 10 ++++++++++ gcc/cp/cp-tree.h | 4 ---- gcc/cp/decl2.c | 11 ++--------- gcc/cp/semantics.c | 2 +- 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b62a65c4e81..fcd9dc965db 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-07-10 Steven Bosscher + Joseph S. Myers + + * c-common.c (c_common_truthvalue_conversion): Don't warn if + TREE_NO_WARNING is set. + 2004-07-18 Roger Sayle * builtins.c (simplify_builtin_memcmp, simplify_builtin_strcmp, diff --git a/gcc/c-common.c b/gcc/c-common.c index cc743cc9da8..b729fd89207 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -2365,7 +2365,9 @@ c_common_truthvalue_conversion (tree expr) break; case MODIFY_EXPR: - if (warn_parentheses && C_EXP_ORIGINAL_CODE (expr) == MODIFY_EXPR) + if (warn_parentheses + && C_EXP_ORIGINAL_CODE (expr) == MODIFY_EXPR + && !TREE_NO_WARNING (expr)) warning ("suggest parentheses around assignment used as truth value"); break; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 97da2dda020..cdbdc42a41d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2004-07-10 Steven Bosscher + Joseph S. Myers + + * cp-tree.h (C_SET_EXP_ORIGINAL_CODE): Remove. + * decl2.c (grokfield): Don't check current_class_depth via + unused TREE_COMPLEXITY. + * semantics.c (finish_parenthesized_expr): Set TREE_NO_WARNING + to avoid the missing parentheses warning. + Don't set C_SET_EXP_ORIGINAL_CODE. + 2004-07-18 Mark Mitchell * mangle.c (write_expression): Issue a sorry for zero-operand diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 7ed1d5f0de4..ca7eae30f3b 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -370,10 +370,6 @@ typedef enum cp_id_kind #define C_TYPE_FIELDS_READONLY(TYPE) \ (LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly) -/* Store a value in that field. */ -#define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \ - (TREE_COMPLEXITY (EXP) = (int)(CODE)) - /* The tokens stored in the default argument. */ #define DEFARG_TOKENS(NODE) \ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 7257f696952..ea9aa49c13c 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -816,15 +816,8 @@ grokfield (const cp_declarator *declarator, && TREE_CODE (declarator->u.id.name) == SCOPE_REF && (TREE_CODE (TREE_OPERAND (declarator->u.id.name, 1)) == IDENTIFIER_NODE)) - { - /* Access declaration */ - if (! IS_AGGR_TYPE_CODE (TREE_CODE - (TREE_OPERAND (declarator->u.id.name, 0)))) - ; - else if (TREE_COMPLEXITY (declarator->u.id.name) == current_class_depth) - pop_nested_class (); - return do_class_using_decl (declarator->u.id.name); - } + /* Access declaration */ + return do_class_using_decl (declarator->u.id.name); if (init && TREE_CODE (init) == TREE_LIST diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 6bc7e68f298..3d8c6435853 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1231,7 +1231,7 @@ finish_parenthesized_expr (tree expr) { if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr)))) /* This inhibits warnings in c_common_truthvalue_conversion. */ - C_SET_EXP_ORIGINAL_CODE (expr, ERROR_MARK); + TREE_NO_WARNING (expr) = 1; if (TREE_CODE (expr) == OFFSET_REF) /* [expr.unary.op]/3 The qualified id of a pointer-to-member must not be -- 2.30.2