diff options
| author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-17 09:48:53 +0000 |
|---|---|---|
| committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-17 09:48:53 +0000 |
| commit | 313d903f1246d51146be2554cc3b43119cba83a8 (patch) | |
| tree | 6719ea214e9eb7d8d41cf312484af570b5b68c57 | |
| parent | 289353fdba3c99477acd3f14d563166f17dcd012 (diff) | |
| download | ppe42-gcc-313d903f1246d51146be2554cc3b43119cba83a8.tar.gz ppe42-gcc-313d903f1246d51146be2554cc3b43119cba83a8.zip | |
* typeck2.c (incomplete_type_error): Reorganise to avoid
excessive diagnostics.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37516 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/cp/typeck2.c | 17 |
2 files changed, 16 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a9930eedd64..f059212cd3a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2000-11-17 Nathan Sidwell <nathan@codesourcery.com> + + * typeck2.c (incomplete_type_error): Reorganise to avoid + excessive diagnostics. + 2000-11-16 Zack Weinberg <zack@wolery.stanford.edu> * lex.c (struct impl_files, internal_filename): Constify a char *. diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index b030a050490..60933e385d3 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -187,10 +187,18 @@ incomplete_type_error (value, type) tree value; tree type; { + int decl = 0; + /* Avoid duplicate error message. */ if (TREE_CODE (type) == ERROR_MARK) return; + if (value != 0 && (TREE_CODE (value) == VAR_DECL + || TREE_CODE (value) == PARM_DECL)) + { + cp_error_at ("`%D' has incomplete type", value); + decl = 1; + } retry: /* We must print an error message. Be clever about what it says. */ @@ -199,12 +207,13 @@ retry: case RECORD_TYPE: case UNION_TYPE: case ENUMERAL_TYPE: - cp_error ("invalid use of undefined type `%#T'", type); + if (!decl) + cp_error ("invalid use of undefined type `%#T'", type); cp_error_at ("forward declaration of `%#T'", type); break; case VOID_TYPE: - cp_error ("invalid use of void expression"); + cp_error ("invalid use of `%T'", type); break; case ARRAY_TYPE: @@ -239,10 +248,6 @@ retry: default: my_friendly_abort (108); } - - if (value != 0 && (TREE_CODE (value) == VAR_DECL - || TREE_CODE (value) == PARM_DECL)) - cp_error_at ("incomplete `%D' defined here", value); } /* This is a wrapper around fancy_abort, as used in the back end and |

