diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-11 00:45:37 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-11 00:45:37 +0000 |
commit | a7b87e06a19a85fe04e6c1e381956ac37f4e0a15 (patch) | |
tree | 26f4e3c863b37caa9087dacc7142426e458ede8e /gcc/c-decl.c | |
parent | d6b9b86fbee44dff513dd7b4375486115ba97f14 (diff) | |
download | gcc-a7b87e06a19a85fe04e6c1e381956ac37f4e0a15.tar.gz |
PR c/14517
* c-decl.c (grokdeclarator): Don't warn for duplicate qualifiers
except for pedantic c90 mode.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79286 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c296bb9c8af..e59789b7386 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3372,7 +3372,7 @@ grokdeclarator (tree declarator, tree declspecs, { if (i == RID_CONST || i == RID_VOLATILE || i == RID_RESTRICT) { - if (!flag_isoc99) + if (pedantic && !flag_isoc99) pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id)); } else @@ -3629,12 +3629,15 @@ grokdeclarator (tree declarator, tree declspecs, volatilep = !! (specbits & 1 << (int) RID_VOLATILE) + TYPE_VOLATILE (element_type); inlinep = !! (specbits & (1 << (int) RID_INLINE)); - if (constp > 1 && ! flag_isoc99) - pedwarn ("duplicate `const'"); - if (restrictp > 1 && ! flag_isoc99) - pedwarn ("duplicate `restrict'"); - if (volatilep > 1 && ! flag_isoc99) - pedwarn ("duplicate `volatile'"); + if (pedantic && !flag_isoc99) + { + if (constp > 1) + pedwarn ("duplicate `const'"); + if (restrictp > 1) + pedwarn ("duplicate `restrict'"); + if (volatilep > 1) + pedwarn ("duplicate `volatile'"); + } if (! flag_gen_aux_info && (TYPE_QUALS (type))) type = TYPE_MAIN_VARIANT (type); type_quals = ((constp ? TYPE_QUAL_CONST : 0) @@ -4087,12 +4090,15 @@ grokdeclarator (tree declarator, tree declspecs, if (erred) error ("invalid type modifier within pointer declarator"); - if (constp > 1 && ! flag_isoc99) - pedwarn ("duplicate `const'"); - if (volatilep > 1 && ! flag_isoc99) - pedwarn ("duplicate `volatile'"); - if (restrictp > 1 && ! flag_isoc99) - pedwarn ("duplicate `restrict'"); + if (pedantic && !flag_isoc99) + { + if (constp > 1) + pedwarn ("duplicate `const'"); + if (volatilep > 1) + pedwarn ("duplicate `volatile'"); + if (restrictp > 1) + pedwarn ("duplicate `restrict'"); + } type_quals = ((constp ? TYPE_QUAL_CONST : 0) | (restrictp ? TYPE_QUAL_RESTRICT : 0) |