From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24818 invoked by alias); 31 Jul 2014 22:42:35 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 24784 invoked by uid 48); 31 Jul 2014 22:42:31 -0000 From: "sstewartgallus00 at mylangara dot bc.ca" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/61985] New: It's possible to declare a function pointer as noreturn using the old volatile syntax but not normally. Date: Thu, 31 Jul 2014 22:42:00 -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: enhancement X-Bugzilla-Who: sstewartgallus00 at mylangara dot bc.ca X-Bugzilla-Status: UNCONFIRMED 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 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-07/txt/msg02091.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61985 Bug ID: 61985 Summary: It's possible to declare a function pointer as noreturn using the old volatile syntax but not normally. Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: sstewartgallus00 at mylangara dot bc.ca It's against the C11 standard to let people use the _Noreturn keyword on a function pointer type. It's treated the same as the inline keyword. In my opinion this is silly but whatever. Anyways, it is possible to declare a function pointer as noreturn using the old volatile syntax but not using the noreturn keyword or attribute. Eg) #include #include #include #include typedef void f(void * restrict, int); typedef volatile f next_t; __attribute__((noinline)) noreturn void increment(void * restrict context, next_t * next, int xx) { next(context, xx + 1); } __attribute__((noinline)) noreturn void main_1(void * restrict context, int xx); __attribute__((noinline)) noreturn void main_2(void * restrict context, int xx); int main(void) { { int value = 4; printf("value: %i\n", value); increment(NULL, main_1, value); } } __attribute__((noinline)) noreturn void main_1(void * restrict context, int xx) { printf("value + 1: %i\n", xx); increment(NULL, main_2, xx); } __attribute__((noinline)) noreturn void main_2(void * restrict context, int xx) { printf("value + 2: %i\n", xx); exit(EXIT_FAILURE); }