aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@cam.ac.uk>2000-09-17 20:39:56 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2000-09-17 20:39:56 +0100
commit60e9d01cf742140d4d56eb8aaf7eced14a923141 (patch)
tree334934f9502cc4e6f33fbd5069958392abed651a /gcc/c-decl.c
parentbc5006c72549c530c630f8a749612ea5ec2bb9e7 (diff)
downloadgcc-60e9d01cf742140d4d56eb8aaf7eced14a923141.zip
gcc-60e9d01cf742140d4d56eb8aaf7eced14a923141.tar.gz
gcc-60e9d01cf742140d4d56eb8aaf7eced14a923141.tar.bz2
c-decl.c (grokdeclarator): Don't give a warning about defaulting to int for plain complex which defaults...
* c-decl.c (grokdeclarator): Don't give a warning about defaulting to int for plain complex which defaults to complex double. Do warn about defaulting to complex double if pedantic. Warn about complex integer types if pedantic. Warn about complex types if pedantic and not in C99 mode. * c-typeck.c (build_unary_op): If pedantic, warn about use of ~ for complex conjugation. testsuite: * gcc.dg/c90-complex-1.c, gcc.dg/c99-complex-1.c: New tests. From-SVN: r36478
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 1de1f97..8287eef 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -4078,7 +4078,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
{
if ((! (specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT)
| (1 << (int) RID_SIGNED)
- | (1 << (int) RID_UNSIGNED))))
+ | (1 << (int) RID_UNSIGNED)
+ | (1 << (int) RID_COMPLEX))))
/* Don't warn about typedef foo = bar. */
&& ! (specbits & (1 << (int) RID_TYPEDEF) && initialized)
&& ! in_system_header)
@@ -4209,6 +4210,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
if (specbits & 1 << (int) RID_COMPLEX)
{
+ if (pedantic && !flag_isoc99)
+ pedwarn ("ISO C89 does not support complex types");
/* If we just have "complex", it is equivalent to
"complex double", but if any modifiers at all are specified it is
the complex form of TYPE. E.g, "complex short" is
@@ -4218,9 +4221,17 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
&& ! (specbits & ((1 << (int) RID_LONG) | (1 << (int) RID_SHORT)
| (1 << (int) RID_SIGNED)
| (1 << (int) RID_UNSIGNED))))
- type = complex_double_type_node;
+ {
+ if (pedantic)
+ pedwarn ("ISO C does not support plain `complex' meaning `double complex'");
+ type = complex_double_type_node;
+ }
else if (type == integer_type_node)
- type = complex_integer_type_node;
+ {
+ if (pedantic)
+ pedwarn ("ISO C does not support complex integer types");
+ type = complex_integer_type_node;
+ }
else if (type == float_type_node)
type = complex_float_type_node;
else if (type == double_type_node)
@@ -4228,7 +4239,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
else if (type == long_double_type_node)
type = complex_long_double_type_node;
else
- type = build_complex_type (type);
+ {
+ if (pedantic)
+ pedwarn ("ISO C does not support complex integer types");
+ type = build_complex_type (type);
+ }
}
/* Figure out the type qualifiers for the declaration. There are