Commit 04e6db94 by Joseph Myers Committed by Joseph Myers

c-decl.c (grokdeclarator): Make error for duplicate type qualifiers into a…

c-decl.c (grokdeclarator): Make error for duplicate type qualifiers into a pedwarn, disabled for C99.

	* c-decl.c (grokdeclarator): Make error for duplicate type
	qualifiers into a pedwarn, disabled for C99.

testsuite:
	* gcc.dg/c90-idem-qual-2.c, gcc.dg/c99-idem-qual-2.c: New tests.

From-SVN: r58983
parent d663b76d
2002-11-10 Joseph S. Myers <jsm@polyomino.org.uk>
* c-decl.c (grokdeclarator): Make error for duplicate type
qualifiers into a pedwarn, disabled for C99.
2002-11-10 Hans-Peter Nilsson <hp@bitrange.com>
* config/mmix/mmix.h (FUNCTION_ARG_CALLEE_COPIES): Define the same
......
......@@ -3541,7 +3541,15 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
}
}
else if (specbits & (1 << (int) i))
error ("duplicate `%s'", IDENTIFIER_POINTER (id));
{
if (i == RID_CONST || i == RID_VOLATILE || i == RID_RESTRICT)
{
if (!flag_isoc99)
pedwarn ("duplicate `%s'", IDENTIFIER_POINTER (id));
}
else
error ("duplicate `%s'", IDENTIFIER_POINTER (id));
}
/* Diagnose "__thread extern". Recall that this list
is in the reverse order seen in the text. */
......
2002-11-10 Joseph S. Myers <jsm@polyomino.org.uk>
* gcc.dg/c90-idem-qual-2.c, gcc.dg/c99-idem-qual-2.c: New tests.
2002-11-09 Hans-Peter Nilsson <hp@bitrange.com>
* lib/compat.exp (compat-execute): Fix logic error in last
......
/* Test for idempotent type qualifiers: in C99 only. Test "const const". */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
const const int foo; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "duplicate" "duplicate type qualifier error" { target *-*-* } 6 } */
/* Test for idempotent type qualifiers: in C99 only. Test "const const". */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
const const int foo; /* { dg-bogus "duplicate" "duplicate type qualifier error" } */
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