diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2002-10-09 21:27:38 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2002-10-09 21:27:38 +0000 |
commit | 95f79357c5e37b27626a5513b612f8b598e5e8ce (patch) | |
tree | 5c1833358257015d0bc6c32fda4a348ff65b9084 /gcc/c-decl.c | |
parent | 10a38dba685e4c5fe4902bbac5d85bb86326e87f (diff) | |
download | gcc-95f79357c5e37b27626a5513b612f8b598e5e8ce.zip gcc-95f79357c5e37b27626a5513b612f8b598e5e8ce.tar.gz gcc-95f79357c5e37b27626a5513b612f8b598e5e8ce.tar.bz2 |
c-decl.c (start_decl): Unconditionally issue error for 'typedef foo = bar'.
gcc:
* c-decl.c (start_decl): Unconditionally issue error for
'typedef foo = bar'.
(finish_decl): Remove special case for TYPE_DECL with initializer.
* doc/extend.texi: Delete "Naming Types" section. Change all
cross-references to that section to refer to "Typeof" instead.
Add the useful safe-max()-macro example from "Naming Types" to
"Typeof", rewritten using that extension.
gcc/cp:
* decl.c (start_decl): Unconditionally issue error for
'typedef foo = bar'.
(cp_finish_decl): Remove special case for TYPE_DECL with initializer.
(grokdeclarator): Remove redundant error for 'typedef foo = bar'.
gcc/testsuite:
* g++.dg/ext/typedef-init.C: New test.
* gcc.dg/typedef-init.c: New test.
From-SVN: r57995
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index dba2737..60fade4 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2821,15 +2821,9 @@ start_decl (declarator, declspecs, initialized, attributes) switch (TREE_CODE (decl)) { case TYPE_DECL: - /* typedef foo = bar means give foo the same type as bar. - We haven't parsed bar yet, so `finish_decl' will fix that up. - Any other case of an initialization in a TYPE_DECL is an error. */ - if (pedantic || list_length (declspecs) > 1) - { - error ("typedef `%s' is initialized", - IDENTIFIER_POINTER (DECL_NAME (decl))); - initialized = 0; - } + error ("typedef `%s' is initialized", + IDENTIFIER_POINTER (DECL_NAME (decl))); + initialized = 0; break; case FUNCTION_DECL: @@ -2988,16 +2982,7 @@ finish_decl (decl, init, asmspec_tree) init = 0; if (init) - { - if (TREE_CODE (decl) != TYPE_DECL) - store_init_value (decl, init); - else - { - /* typedef foo = bar; store the type of bar as the type of foo. */ - TREE_TYPE (decl) = TREE_TYPE (init); - DECL_INITIAL (decl) = init = 0; - } - } + store_init_value (decl, init); /* Deduce size of array from initialization, if not already known */ if (TREE_CODE (type) == ARRAY_TYPE |