From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EB9C13858D35; Tue, 23 Apr 2024 06:28:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB9C13858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713853715; bh=CW06VN8Omgqf4C88OLwGsaMmmlMIEPq58PD9UpTuD7I=; h=From:To:Subject:Date:From; b=dy9QDpyOPOvTe6drtU/RydLg7OZYvIRPbt/TljuSyRv6mCAc+oTbtThYd/jX0WpfS NM/CtTZbgDZR08Af5wBIinVksf9VvTt5TorrKYzIjdBts1NK3bga5qSoJYtT2dR9cR YNQ019ZuXNFHOek5IQIES+m8nSf0MKK+UWnxUUoQ= From: "tschwinge at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/114818] New: 'constructor', 'destructor' function attributes vs. 'extern' Date: Tue, 23 Apr 2024 06:28:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: diagnostic, documentation X-Bugzilla-Severity: minor X-Bugzilla-Who: tschwinge at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114818 Bug ID: 114818 Summary: 'constructor', 'destructor' function attributes vs. 'extern' Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: diagnostic, documentation Severity: minor Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tschwinge at gcc dot gnu.org Target Milestone: --- By chance, I noticed that when 'constructor', 'destructor' function attribu= tes appear on an 'extern' function declaration, then that is (a) accepted witho= ut any diagnostic by the C, C++ front ends, but (b) no 'constructor', 'destruc= tor' calls are emitted. (Doesn't matter whether the function does or doesn't get linked in.) Assuming that is the expected behavior, should we update 'gcc/doc/extend.te= xi' for this, and implement a diagnostic (warning or even error, enabled by default)? I found that in 'gcc/doc/tm.texi', '@node Initialization' we state: [...] Each object file that defines an initialization function also puts a word in the constructor section to point to that function. [...] Note "defines", which excludes 'extern'.=