Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp530844imu; Fri, 9 Nov 2018 01:38:10 -0800 (PST) X-Google-Smtp-Source: AJdET5eSIwLSB+Gx8BsxVWqCvsoQjp+tulDyMMn9+9DpDaYcBCLFSCBdAdHERrLKfu3rf5Fu+DJp X-Received: by 2002:a62:5f05:: with SMTP id t5-v6mr8162136pfb.223.1541756290468; Fri, 09 Nov 2018 01:38:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541756290; cv=none; d=google.com; s=arc-20160816; b=j8VWk9Cravy+QQvvx9pkqSwC11mhodO3oBBHNgm52GYzadZGKP8posXv+9Ca6y+UKX hn37SSQqvbZasNTWuzWXsaA2hNgjV/ZOUZlIR8rsREnY6LrTFuShyBYcHwvPwf8mHTmj yk+/mCztzCV4hHENw1xwGzzY+dMRb6W41qeOt0Z4XacgKsrW9Se1pfrScXeQZglf+24w FhOkXfMnziBOoleO8N8/89IUeqADzShptTaj90lyfwWJC/mb4RV4qZ+DbhvzqWizmj3p sCYXvV5qP2O2jevOE8Sdr8PCcQb9fYSRc0U0Z9KTKnm5aEufv4BbC8B+FZe+cEn6WVbK 1DiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=ZxndxbkxbQEOy9vtICjCrHWR2uKSe9R6wBVocQ0KUuk=; b=M0LSll+USfxnamWzHA5CtDLFXQpM2hAF99dSLuxQ5uRK/YehSS9DyZr/iA8SoL+6DD VhRyoUbkcfMwqhTxcLokXgh8Xn6j0owZb24BviSvBb7OW1cn3tWPPt2vS5ak98Rsl0X+ ugCLNvdlzt19y3lXvQRQk5JDylKgD3sDHMH/U6m9pvpLMAuA8nPv88/3smLmHhw5V3iu 5X0xUHHk7ICaUUjeN9Z3CTUBmSqG1PYQcr7aZpQxXSb09etN4GyCxf7OzuhJ0W+tcz0k I22WGoDkH00eWAvhhfL+o3hk4i9lE1+BnrGd9ns0/2EAT+ZSx0B80ej86ZpVcG+aWaLF JAmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m33si5705096pgl.379.2018.11.09.01.37.55; Fri, 09 Nov 2018 01:38:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727992AbeKITPY (ORCPT + 99 others); Fri, 9 Nov 2018 14:15:24 -0500 Received: from s3.sipsolutions.net ([144.76.43.62]:55166 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727638AbeKITPX (ORCPT ); Fri, 9 Nov 2018 14:15:23 -0500 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.91) (envelope-from ) id 1gL3CU-0000te-Cz; Fri, 09 Nov 2018 10:35:38 +0100 From: Johannes Berg To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: Johannes Berg Subject: [PATCH v2 2/3] kernel.h: hide __is_constexpr() from sparse Date: Fri, 9 Nov 2018 10:35:33 +0100 Message-Id: <20181109093534.15121-2-johannes@sipsolutions.net> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181109093534.15121-1-johannes@sipsolutions.net> References: <20181109093534.15121-1-johannes@sipsolutions.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg __is_constexpr() is a work of art, understandable only to the most respected wizards of C. Even sparse doesn't seem to belong to that group and warns that there's an "expression using sizeof(void)". Just hide the definition from sparse and pretend it's always true. Signed-off-by: Johannes Berg --- include/linux/kernel.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d6aac75b51ba..d4d2233f95c9 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -844,6 +844,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } #define __typecheck(x, y) \ (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) +#ifndef __CHECKER__ /* * This returns a constant expression while determining if an argument is * a constant expression, most importantly without evaluating the argument. @@ -851,6 +852,13 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } */ #define __is_constexpr(x) \ (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) +#else +/* + * We don't really care about the check when running sparse and the + * above expression causes a warning due to sizeof(void). + */ +#define __is_constexpr(x) 1 +#endif #define __no_side_effects(x, y) \ (__is_constexpr(x) && __is_constexpr(y)) -- 2.17.2