From patchwork Fri Mar 31 01:44:36 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: 9655367 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 9940360113 for ; Fri, 31 Mar 2017 01:46:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B92D28617 for ; Fri, 31 Mar 2017 01:46:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 808A528693; Fri, 31 Mar 2017 01:46:33 +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 327BA28617 for ; Fri, 31 Mar 2017 01:46:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934814AbdCaBqc (ORCPT ); Thu, 30 Mar 2017 21:46:32 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34158 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934742AbdCaBqb (ORCPT ); Thu, 30 Mar 2017 21:46:31 -0400 Received: by mail-wr0-f194.google.com with SMTP id w43so16582540wrb.1 for ; Thu, 30 Mar 2017 18:46:30 -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=MlpP3EcKAAJyo9nYNm/Q4kYotcAu2jKqBA3iYdTZXSg=; b=ZHj7IvMxJq59KlSo9U1ha69IPJCOj+3cdAwuybMHDAtqdVW2evT3cE47mm1Rz2oI+U zdXyy9JXL8zl1D1/bU/bROSs+XseQN9zgKzXNKvklmVSXYdG0aQCTPABM3U3ScduaWO5 WvXBMGO6+e9pFpjgOruRT9MXJr7EVVoAd+pBVziy0rQYXao+Rz3NS7Ft8zpagSlLzrL3 S2QXCwuSnMgQ6z7ZgoSTxh9yahQQV03kUBMxz5GNI6H1GJfU7FFUbbyD0/kvQF14Ai77 mRj2CrRBHDlccAntf2s5AeZWEiW3jWh05+vFwpoEszj7S/u92DMO59vc6snF+rXdXqJD p6Nw== 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=MlpP3EcKAAJyo9nYNm/Q4kYotcAu2jKqBA3iYdTZXSg=; b=P/whdemYIikeRpr8tZiSN1m5SsZ6fUjl2yLLX029JAXvUcFd7geAdIGaQlMuh+wLac ltnnPIgAXI4B9BUbP1kXrhJ7sj80BZjfnMH6OG4Yv9bBH8pgosiA1Zsnrt5i+wUDFlde qwqXZUh50b1w2t0iUs3J3P3LTuoPjLheyOGIjDkXCkj7ZCK22Yj2gDIUrNP71ju/5bml SkkTeUB9tYYG3eWaB97Wbk1QIcQlga8iHiHyzFbhgs8dskRHLwAxfy1aeDyI9SE6BUUH uJkuFAunG2LQ9KbSbLdUrCiByhnuoeoKQjx/B1pdawRsWAVnrZHuIXzejBxCAdIDKyja 6YbQ== X-Gm-Message-State: AFeK/H2t2sSk6PkXUwbBXN2P7fcPZFY2NfkGgzNyp5h+U79VbIgXIe6m5nHKLdJ2C+6gSA== X-Received: by 10.28.137.211 with SMTP id l202mr412516wmd.118.1490924789386; Thu, 30 Mar 2017 18:46:29 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 18:46:28 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Christopher Li , Nicolai Stange , Luc Van Oostenryck Subject: [PATCH v4 02/25] constexpr: init flags at expression allocation Date: Fri, 31 Mar 2017 03:44:36 +0200 Message-Id: <20170331014459.9351-3-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 Currently, the expression evaluation code explicitly opts out from constness at evaluation if certain criteria regarding the subexpressions are not matched. Instead of this active opt-out, we want to have subexpression constness attributes to get propagated from child expressions to their parents in the future. A prerequisite is that each expression's ->flags is in a defined state at all times. Set ->flags to SET_INT or NONE at expression allocation time, depending if the expression has a type or not (alloc_const_expression() or alloc_expression()). Signed-off-by: Nicolai Stange Signed-off-by: Luc Van Oostenryck --- expression.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/expression.h b/expression.h index e02cb8584..ec94ff4a1 100644 --- a/expression.h +++ b/expression.h @@ -249,6 +249,7 @@ static inline struct expression *alloc_expression(struct position pos, int type) struct expression *expr = __alloc_expression(0); expr->type = type; expr->pos = pos; + expr->flags = CEF_NONE; return expr; } @@ -259,6 +260,7 @@ static inline struct expression *alloc_const_expression(struct position pos, int expr->pos = pos; expr->value = value; expr->ctype = &int_ctype; + expr->flags = CEF_SET_INT; return expr; }