From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from movementarian.org ([178.79.150.28]:51746 "EHLO movementarian.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728128AbfHOLMj (ORCPT ); Thu, 15 Aug 2019 07:12:39 -0400 Date: Thu, 15 Aug 2019 12:12:37 +0100 From: John Levon Subject: Re: noreturn attribute doesn't work in smatch Message-ID: <20190815111237.GA20100@movementarian.org> References: <20190815005328.GA8004@movementarian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190815005328.GA8004@movementarian.org> Sender: smatch-owner@vger.kernel.org List-ID: To: smatch@vger.kernel.org, linux-sparse@vger.kernel.org Cc: yuri.pankov@nexenta.com I took another pass, and this works for me: diff --git a/parse.c b/parse.c index ca4726b8..44c59707 100644 --- a/parse.c +++ b/parse.c @@ -2859,6 +2859,7 @@ struct token *external_declaration(struct token *token, struct symbol_list **lis /* Parse declaration-specifiers, if any */ token = declaration_specifiers(token, &ctx); mod = storage_modifiers(&ctx); + mod |= ctx.ctype.modifiers & MOD_NORETURN; decl = alloc_symbol(token->pos, SYM_NODE); /* Just a type declaration? */ if (match_op(token, ';')) { (I suppose a proper fix would collate all function-level attributes but...) However, it seems like smatch is still not quite passing its knowledge along: if I have: extern void die() __attribute((__noreturn__)); void mydie() { die(); } then the die() call is nullified, but smatch doesn't realise that means all paths of mydie() are __noreturn__ too. regards john