* 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.
From-SVN: r29505
+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.
{
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));
}
@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}
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
if (TREE_CODE (destination) == LABEL_DECL)
{
- TREE_USED (destination) = 1;
label_rtx (destination);
expand_goto (destination);
}
--- /dev/null
+// Build don't link:
+// Special g++ Options: -Wall
+// Origin: Jeroen@MMR.be
+
+template <typename T>
+void f()
+{
+ for(;;)
+ for(;;)
+ goto a;
+
+ a:
+ ;
+}
+
+void g()
+{
+ f<long>();
+}