From 31dbaab57fef485412a0369a222b9c252ad2713b Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 14 Jul 2020 05:57:57 -0700 Subject: c++: Comments & formatting I found some bad formatting and misleading or incomplete comments during my spelunking around the c++FE. May as well clean up trunk and record what I noted. gcc/cp/ * cp-tree.h: Correct some tree lang flag comments, reformat some structure definitions. Note some structure sizes. Clarify some comments. (yyungetc): Delete. Not been a thing for some time. * class.c (copy_fndecl_with_name): Comment. (check_bases_and_members): Unnecessary {}. (layout_class_type): Comment. * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment. * decl.c: Fix some formatting & whitespace issues. (function_requirements_equivalent_p): Note why substitutions are needed. * decl2.c (no_linkage_error): Note that heroics about 'typedef struct { ... };' are no longer needed. * method.c: Whitespace. * name-lookup.c: Whitespace. (add_decl_to_level): Reformat a line. (print_binding_stack): Mark as DEBUG_FUNCTION. (has_using_namespace_std_directive_p): Delete comment. * pt.c: Whitespace * ptree.c: Whitespace. * rtti.c: Whitespace & comment. * tree.c: Comment. * typeck.c (structural_comptypes): Add comment. --- gcc/cp/decl2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/cp/decl2.c') diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index ddc2023..5bada50 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2215,6 +2215,7 @@ decl_needed_p (tree decl) emitted; they may be referred to from other object files. */ if (TREE_PUBLIC (decl) && !DECL_COMDAT (decl) && !DECL_REALLY_EXTERN (decl)) return true; + /* Functions marked "dllexport" must be emitted so that they are visible to other DLLs. */ if (flag_keep_inline_dllexport @@ -2725,8 +2726,7 @@ determine_visibility (tree decl) determine_visibility_from_class (decl, class_type); if (decl_anon_ns_mem_p (decl)) - /* Names in an anonymous namespace get internal linkage. - This might change once we implement export. */ + /* Names in an anonymous namespace get internal linkage. */ constrain_visibility (decl, VISIBILITY_ANON, false); else if (TREE_CODE (decl) != TYPE_DECL) { @@ -4492,11 +4492,13 @@ no_linkage_error (tree decl) && TREE_NO_WARNING (decl)))) /* In C++11 it's ok if the decl is defined. */ return; + tree t = no_linkage_check (TREE_TYPE (decl), /*relaxed_p=*/false); if (t == NULL_TREE) /* The type that got us on no_linkage_decls must have gotten a name for linkage purposes. */; else if (CLASS_TYPE_P (t) && TYPE_BEING_DEFINED (t)) + // FIXME: This is now invalid, as a DR to c++98 /* The type might end up having a typedef name for linkage purposes. */ vec_safe_push (no_linkage_decls, decl); else if (TYPE_UNNAMED_P (t)) -- cgit v1.1