]> git.ipfire.org Git - thirdparty/gcc.git/commit
d: Move call to set_linkage_for_decl to declare_extern_var.
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 13 Apr 2021 14:19:03 +0000 (16:19 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Wed, 14 Apr 2021 12:43:38 +0000 (14:43 +0200)
commit5b63eb17d863ac080cf3c7df08233054b09d3747
treeab6c28abef05e7db0ae4185b7e8dbe320e9a91e4
parent3785d2b207f1958f31a79fbbb5705b261551950d
d: Move call to set_linkage_for_decl to declare_extern_var.

This both prevents against it being called twice for declarations that
are defined, and fixes an issue where variables defined in the
compilation get one kind of linkage (weak), and the same variables
declared via declare_extern_var get another (extern).

gcc/d/ChangeLog:

PR d/99914
* decl.cc (DeclVisitor::visit (StructDeclaration *)): Don't set
DECL_INSTANTIATED on static initializer declarations.
(DeclVisitor::visit (ClassDeclaration *)): Likewise.
(DeclVisitor::visit (EnumDeclaration *)): Likewise.
(d_finish_decl): Move call to set_linkage_for_decl to...
(declare_extern_var): ...here.
gcc/d/decl.cc