From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9B9043858D28; Tue, 20 Feb 2024 12:43:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B9043858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708433011; bh=PsPywLwt8Lf0kAFkG311oZX/0d1GSG6/Q51oAvYh8Z4=; h=From:To:Subject:Date:From; b=E8e05OfRLN4htaniPe71Tal/8s036NizsxGNpjIAsZe/dod/QVpv9FR8eaNEvmTIF xfA98+PYxmmNDLNJmkeqQ33yvt5U9jp/Muy9I2kIni6yCDnlclRwlG7Exef0ARaoka epHX/KqH3afGNcg68g33rV4wJM+hQfg5dkGgsHsI= From: "pskocik at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/114011] New: Feature request: __goto__ Date: Tue, 20 Feb 2024 12:43:30 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pskocik at gmail dot com 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 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=3D114011 Bug ID: 114011 Summary: Feature request: __goto__ Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: pskocik at gmail dot com Target Milestone: --- Gcc has __volatile__. I can only assume the rationale for it is so that inline asm macros can do __asm __volatile__ and not have to worry about user-redefines of the volatile keyword (which while not quite approved by the standard, is someti= mes practically useful). While the __asm syntax also allows the goto keyword, there's currently no __goto__ counterpart to __volatile__, which could similarly protect against goto redefines. Adding it is trivial and consistent with the already existing volatile/__volatile__ pair. Would you consider it? ( Why am I redefining goto? I'm basically doing it within the confines of a m= acro framework to force a static context check on gotos to prevent gotos out of scopes where doing it would be an error. Something like: enum { DISALLOW_GOTO_HERE =3D 0 }; //normally, goto is allowed #define goto while(_Generic((int(*)[!DISALLOW_GOTO_HERE])0, int(*)[1]:1)) g= oto //statically checked goto int main(void){ goto next; next:; //OK, not disallowed in this context #if 0 //would fail to compile enum {DISALLOW_GOTO_HERE=3D1}; //disallowed in this context goto next2; next2:; #endif } While this redefine does not syntactically disturb C, it does disturb `__asm goto()`, which I, unfortunately, have one very frequently used instance of,= and since there's no way to suppress an object macro redefine, I'd like to be a= ble to change it to `__asm __goto__` and have it peacefully coexist with the go= to redefine. )=