summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-19 00:33:09 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-19 00:33:09 +0000
commit149a6627fd601f466ef83d01a027b0d6f3862c25 (patch)
tree762c0f376628e76afc5809add65a72d5e16a9cdf /gcc/cp
parent73b8a26bf3cb3730d6888cb56b798a0ce6b8ba6b (diff)
downloadgcc-149a6627fd601f466ef83d01a027b0d6f3862c25.tar.gz
* gxxint.texi: G++ now implements namespaces.
* decl.c (pop_label): Don't warn about unused labels more than once. * semantics.c (finish_goto_stmt): Always marked used labels as used. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29505 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/decl.c15
-rw-r--r--gcc/cp/gxxint.texi2
-rw-r--r--gcc/cp/semantics.c6
4 files changed, 24 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 599c7ff254c..51185fa5522 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,14 @@
+1999-09-18 Paul Burchard <burchard@pobox.com>
+
+ * gxxint.texi: G++ now implements namespaces.
+
1999-09-18 Mark Mitchell <mark@codesourcery.com>
+ * decl.c (pop_label): Don't warn about unused labels more than
+ once.
+ * semantics.c (finish_goto_stmt): Always marked used labels as
+ used.
+
* decl.c (layout_var_decl): Change prototype. Call layout_decl
even when the declaration is external.
(cp_finish_decl): Adjust call to layout_var_decl.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index ed3e11e921d..c1a07c1eb27 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1125,14 +1125,17 @@ pop_label (link)
{
tree label = TREE_VALUE (link);
- if (DECL_INITIAL (label) == NULL_TREE)
+ if (!processing_template_decl && doing_semantic_analysis_p ())
{
- cp_error_at ("label `%D' used but not defined", label);
- /* Avoid crashing later. */
- define_label (input_filename, 1, DECL_NAME (label));
+ if (DECL_INITIAL (label) == NULL_TREE)
+ {
+ cp_error_at ("label `%D' used but not defined", label);
+ /* Avoid crashing later. */
+ define_label (input_filename, 1, DECL_NAME (label));
+ }
+ else if (warn_unused && !TREE_USED (label))
+ cp_warning_at ("label `%D' defined but not used", label);
}
- else if (warn_unused && !TREE_USED (label))
- cp_warning_at ("label `%D' defined but not used", label);
SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (label), TREE_PURPOSE (link));
}
diff --git a/gcc/cp/gxxint.texi b/gcc/cp/gxxint.texi
index 05f1373b252..df9d100c3c3 100644
--- a/gcc/cp/gxxint.texi
+++ b/gcc/cp/gxxint.texi
@@ -1602,7 +1602,7 @@ The int parameter is a basic type, and does not receive a B encoding...
@subsection Qualified names
Both C++ and Java allow a class to be lexically nested inside another
-class. C++ also supports namespaces (not yet implemented by G++).
+class. C++ also supports namespaces.
Java also supports packages.
These are all mangled the same way: First the letter @samp{Q}
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 383e981402e..6943b966efc 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -642,6 +642,11 @@ finish_goto_stmt (destination)
if (TREE_CODE (destination) == IDENTIFIER_NODE)
destination = lookup_label (destination);
+ /* We warn about unused labels with -Wunused. That means we have to
+ mark the used labels as used. */
+ if (TREE_CODE (destination) == LABEL_DECL)
+ TREE_USED (destination) = 1;
+
if (building_stmt_tree ())
add_tree (build_min_nt (GOTO_STMT, destination));
else
@@ -650,7 +655,6 @@ finish_goto_stmt (destination)
if (TREE_CODE (destination) == LABEL_DECL)
{
- TREE_USED (destination) = 1;
label_rtx (destination);
expand_goto (destination);
}