From patchwork Fri Mar 31 01:44:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9655401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DB50A60113 for ; Fri, 31 Mar 2017 01:46:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDC0C28688 for ; Fri, 31 Mar 2017 01:46:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2CFF28696; Fri, 31 Mar 2017 01:46:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AF6D28688 for ; Fri, 31 Mar 2017 01:46:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934971AbdCaBqt (ORCPT ); Thu, 30 Mar 2017 21:46:49 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35232 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934699AbdCaBqr (ORCPT ); Thu, 30 Mar 2017 21:46:47 -0400 Received: by mail-wr0-f196.google.com with SMTP id p52so16621792wrc.2 for ; Thu, 30 Mar 2017 18:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xMF2g6fF5rq+0KEFl7ouDfcYDxbssPHh5AIUElMpH0g=; b=TzuAPNQHcOQuxdRYArRrYVT86Ydt1BDUom+HopcYgF2/RmA9VSyXmB1L572vgQ0oqn MxJaIberuEX/6jXFj/ZRpXyrObtPKcJe0m77UbJ18QqVBPUs1LMEQh9eJniBKZ5kZ//q 288Dpu1BTFw5Of5DrM7aE+z9ggxWeR4zJAszMaFOkZ2tFBmUs7/lQV8H9rFpzIeBBS4B 305PbdXx+4Feb4DeA8zNLHf2kwd50E2YB7RMLcyLul4lf4LnSqp3qkQa/w71++ZBaBBp ma7+jHb4lqAOQXxm/QIw2iBBqh50mngcaO4m9JmQrSStEQLOsJY4+KTzQpkcjdJRArAy e1XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xMF2g6fF5rq+0KEFl7ouDfcYDxbssPHh5AIUElMpH0g=; b=FQo6qtBSRIiEebuh+Rm8XvY3S2LLegNF96mSIlDwI+/isjrbG2a+IOidZ6hMXDXsZo YHDtHfr/BZEcfBEVUgpCtHyIZFlaYTh1uXxDrgj9LUvx8IUAWDyILYCgKUGy7KsVKpSX GmjO7wVq2ZXD/umaj5A1RIwijm4MnjFtQDjvcZltHBRRWP766dLUACLSIjynPpyF5dJJ kam+BXiv7OaexbtC1vQ1at3vAi7I6Fd5w1c2kc/HQ+gWe8IAyFlQvWEp0JVFnBAhZq7e IVwTjpepqrFCwvx/fSf65tjX9t62nburlsYZ4nkIq+ULdSZ6kEVfkOnNgtJVz+mwpLJY V2vg== X-Gm-Message-State: AFeK/H3VTpM7KOn48GJx385Ed8Ym4gRQ9Z9X1Agrbgb3HIOJIh5EUXJ+UjUCt90aVdDnXA== X-Received: by 10.28.183.4 with SMTP id h4mr421560wmf.32.1490924805974; Thu, 30 Mar 2017 18:46:45 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:88d:1900:cdad:92b8:5279:ae19]) by smtp.gmail.com with ESMTPSA id 189sm917023wmm.31.2017.03.30.18.46.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 18:46:45 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Christopher Li , Nicolai Stange , Luc Van Oostenryck Subject: [PATCH v4 19/25] constexpr: flag builtins constant_p, safe_p and warning as constexprs Date: Fri, 31 Mar 2017 03:44:53 +0200 Message-Id: <20170331014459.9351-20-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170331014459.9351-1-luc.vanoostenryck@gmail.com> References: <20170331014459.9351-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicolai Stange Unconditionally flag the expressions __builtin_constant_p(), __builtin_safe_p(), __builtin_warning() as being integer constant expressions. Signed-off-by: Nicolai Stange Signed-off-by: Luc Van Oostenryck --- builtin.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/builtin.c b/builtin.c index dbb81032b..a427b45ee 100644 --- a/builtin.c +++ b/builtin.c @@ -27,9 +27,10 @@ #include "expand.h" #include "symbol.h" -static int evaluate_to_integer(struct expression *expr) +static int evaluate_to_int_const_expr(struct expression *expr) { expr->ctype = &int_ctype; + expr->flags |= CEF_SET_ICE; return 1; } @@ -152,17 +153,17 @@ static int expand_safe_p(struct expression *expr, int cost) } static struct symbol_op constant_p_op = { - .evaluate = evaluate_to_integer, + .evaluate = evaluate_to_int_const_expr, .expand = expand_constant_p }; static struct symbol_op safe_p_op = { - .evaluate = evaluate_to_integer, + .evaluate = evaluate_to_int_const_expr, .expand = expand_safe_p }; static struct symbol_op warning_op = { - .evaluate = evaluate_to_integer, + .evaluate = evaluate_to_int_const_expr, .expand = expand_warning };