From patchwork Mon Sep 3 20:33:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 10586363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7A26112B for ; Mon, 3 Sep 2018 20:34:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDD992931D for ; Mon, 3 Sep 2018 20:34:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEF2829324; Mon, 3 Sep 2018 20:34:01 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D28202931D for ; Mon, 3 Sep 2018 20:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729047AbeIDAzu (ORCPT ); Mon, 3 Sep 2018 20:55:50 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41620 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727850AbeIDAzt (ORCPT ); Mon, 3 Sep 2018 20:55:49 -0400 Received: by mail-wr1-f66.google.com with SMTP id z96-v6so1742391wrb.8; Mon, 03 Sep 2018 13:33:57 -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=HoCi5EJzB+/PbEERt2xyXHFMzpFbJL9r+GdGJgj/E2I=; b=Skx0JzuzOifbH6Nu73FZZulPhYCoy3WAHSwkgknIK7riIm3YwzVs+waTWb1cNxZtVE VkljYkOsx8v3stytWW1mgYxYy6bmV76ypJ2+f3uNy6fNHNFbN7h8B4CjDTqdBjptm3KO 7CZPBNWMH4OsPbDuG/Ul8wKoyllhlKj/4qDOqwANo0D4MaBiS74aW4D3HJmf/0NzJVWt rvBKxCOC3MDEebpsDlSdrYki/S20yYioFtUXt2lnBJvpTkTUu0EE5CfTS380S2MxY0ZL QSs5JZmqrfCTJyNhRCh2dIyvESJZZqnBA1VBOwcKx8s34uXqigHg49uOk3WYf96O2T9t 5BbA== 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=HoCi5EJzB+/PbEERt2xyXHFMzpFbJL9r+GdGJgj/E2I=; b=jGD4MJEbnMCvbwgF/qObRhufYoRQx6XiVUjiuzO2+GrjJk7sRUc92WODq7+kWfVXa4 1tVxTCfDIjNiiOqOUvouno9RCwlzDKgvDneU2ABStZKcMnCXZqyAOT0u2t7l2WQ1DymU Q1e1tZfWIJdOjhCghmwkN0ar0BUQQzTmAReLeahdYizYTiC4Vuw233u2Ssg5iUBdvzE3 zs6wf+lhsqbdR/EvRyymoozDGknwaZjH+TVVX28XP1rg5uLBMzjnjPfn8Djjnmxu1G45 MXgRi61Kt8Jv7/IczK6omeVy8QGyH7VVnDBFiF2idL9wdfe+GT+oxIZkghgBV182a7J1 qPfw== X-Gm-Message-State: APzg51DQrlC/b3j7/QAWJaYIwIWivr9fbKaK+ikrgZjyV5oRO2srDhLW Fub1mOwjd2HsbNG+BfgIdyU= X-Google-Smtp-Source: ANB0VdbZb23hl5yC72x74//5yieVjzAtxnS1CcRJsCLFbrc43giXsUnFM9kteBQUwueSjE2MTwOXQQ== X-Received: by 2002:adf:8919:: with SMTP id s25-v6mr20133892wrs.89.1536006836762; Mon, 03 Sep 2018 13:33:56 -0700 (PDT) Received: from localhost.localdomain (62.83.35.8.dyn.user.ono.com. [62.83.35.8]) by smtp.gmail.com with ESMTPSA id 132-v6sm12354870wmd.13.2018.09.03.13.33.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 13:33:56 -0700 (PDT) From: Miguel Ojeda To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Rasmus Villemoes , Eli Friedman , Christopher Li , Kees Cook , Ingo Molnar , Geert Uytterhoeven , Arnd Bergmann , Greg Kroah-Hartman , Masahiro Yamada , Joe Perches , Dominique Martinet , linux-sparse@vger.kernel.org Subject: [PATCH 07/12] Compiler Attributes: remove unneeded sparse (__CHECKER__) tests Date: Mon, 3 Sep 2018 22:33:11 +0200 Message-Id: <20180903203316.16183-8-miguel.ojeda.sandonis@gmail.com> In-Reply-To: <20180903203316.16183-1-miguel.ojeda.sandonis@gmail.com> References: <20180903203316.16183-1-miguel.ojeda.sandonis@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 Sparse knows about a few more attributes now, so we can remove the __CHECKER__ conditions from them (which, in turn, allow us to move some of them later on to compiler_attributes.h). * assume_aligned: since sparse's commit ffc860b ("sparse: ignore __assume_aligned__ attribute"), included in 0.5.1 * error: since sparse's commit 0a04210 ("sparse: Add 'error' to ignored attributes"), included in 0.5.0 * hotpatch: since sparse's commit 6043210 ("sparse/parse.c: ignore hotpatch attribute"), included in 0.5.1 * warning: since sparse's commit 977365d ("Avoid "attribute 'warning': unknown attribute" warning"), included in 0.4.2 On top of that, __must_be_array does not need it either because: * Even ancient versions of sparse do not have a problem * BUILD_BUG_ON_ZERO() is currently disabled for __CHECKER__ Cc: Rasmus Villemoes Cc: Eli Friedman Cc: Christopher Li Cc: Kees Cook Cc: Ingo Molnar Cc: Geert Uytterhoeven Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Masahiro Yamada Cc: Joe Perches Cc: Dominique Martinet Cc: Linus Torvalds Cc: linux-sparse@vger.kernel.org Acked-by: Luc Van Oostenryck Reviewed-by: Nick Desaulniers Signed-off-by: Miguel Ojeda --- include/linux/compiler-gcc.h | 6 ++---- include/linux/compiler.h | 4 ---- include/linux/compiler_types.h | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 3b32bbfa5a49..1ca6a51cfaa9 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -76,14 +76,12 @@ #define __compiletime_object_size(obj) __builtin_object_size(obj, 0) -#ifndef __CHECKER__ #define __compiletime_warning(message) __attribute__((__warning__(message))) #define __compiletime_error(message) __attribute__((__error__(message))) -#ifdef LATENT_ENTROPY_PLUGIN +#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__) #define __latent_entropy __attribute__((latent_entropy)) #endif -#endif /* __CHECKER__ */ /* * calling noreturn functions, __builtin_unreachable() and __builtin_trap() @@ -131,7 +129,7 @@ /* gcc version specific checks */ -#if GCC_VERSION >= 40900 && !defined(__CHECKER__) +#if GCC_VERSION >= 40900 /* * __assume_aligned(n, k): Tell the optimizer that the returned * pointer can be assumed to be k modulo n. The second argument is diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 165b1d5683ed..4030a2940d6b 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -357,11 +357,7 @@ static inline void *offset_to_ptr(const int *off) compiletime_assert(__native_word(t), \ "Need native word sized stores/loads for atomicity.") -#ifdef __CHECKER__ -#define __must_be_array(a) 0 -#else /* &a[0] degrades to a pointer: a different type from an array */ #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) -#endif #endif /* __LINUX_COMPILER_H */ diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index f182f2ef3227..65b10b1e2a59 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -217,7 +217,7 @@ struct ftrace_likely_data { #define __must_check #endif -#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__) +#if defined(CC_USING_HOTPATCH) #define notrace __attribute__((hotpatch(0, 0))) #else #define notrace __attribute__((__no_instrument_function__))