From patchwork Sat Sep 8 21:24:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 10593193 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 4F0CF109C for ; Sat, 8 Sep 2018 21:25:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3313929F11 for ; Sat, 8 Sep 2018 21:25:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2629629F31; Sat, 8 Sep 2018 21:25:27 +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 7CC7529F11 for ; Sat, 8 Sep 2018 21:25:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728018AbeIICMb (ORCPT ); Sat, 8 Sep 2018 22:12:31 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33415 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727639AbeIICMb (ORCPT ); Sat, 8 Sep 2018 22:12:31 -0400 Received: by mail-wr1-f65.google.com with SMTP id v90-v6so18168223wrc.0; Sat, 08 Sep 2018 14:25:21 -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=Uz4AzMih6EiI5/W9aglDJg253rzEWbsVW4idFIjJeXQ=; b=GfvASppxzIARsLg0IgW/5IQPp33XWoJQDu7Za/q5e1gfp6vhyt7GqQr8iZxOuCPL2I s5SQpvREQbvh4HUMwh0fJ5b9NCyFCRyXwxm/iLZEOUqX8AbbDy8jelMr6ojX5edVIjw0 kWw9xjE1Zbu8vYqGMBJN8aJPXmpq8ix/pVsAePlUu5Qii3g6A35nB2+ZYIT2ta5+2jLZ SX1hJPAgD0kG99Qz06yBQeF3eICRJrVrR/khz+iJCTQn/t5z3BCJytwp8rSYzzse5NoQ 9yYxJ4LBajfsnFjasI8+Rj1XWF7gZdrPzOS0JPczb404x++zXYoFGpjGKO1gAhefmbTs hocA== 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=Uz4AzMih6EiI5/W9aglDJg253rzEWbsVW4idFIjJeXQ=; b=dAU1J9JZ92ckfCLfATaqUe6nMYDJduo/MF9/lNLRNKb7ivbyn7cd+xaCxir0+6+eHQ U+jI3BFrSO2evgm5J4WgHx8IZm4obqphxY7sBCMJfIF4u/VYCUoJeuIidZdTCO/HO0M9 EAwmYKvkKO1lX+19+8GBRjbzdtARsPAK+8Xsgx+9z3eBvJ6nBJI5Zxw8wM1rru697VUj OPBsSSJX39JPUGl4lAhif8FZDdAHJuIqemlQ/1T9Y4qFOcncibFPXvxqFL9z3nFU4lxy Yh92xY0RDLD5vcwF58Bu7wtrUvmmp/0JITq5QrgCmh0za3k9Fg1N+H5apC8iGiRxmy4d DCgw== X-Gm-Message-State: APzg51Alu/ZFr9h4GgOwFi4Apfxc3rPGy0rdWq87ApNysh6sq/ELyiHj HrHM4/wItybdMG2BjYEm/68= X-Google-Smtp-Source: ANB0VdZ6WMq8qHMBMavCADXAwbaFHJf6G2VdK/SbMd75aRc8VOzWtxDKeeBDXD9HO1oQltid5uJixQ== X-Received: by 2002:a5d:4648:: with SMTP id j8-v6mr9734310wrs.52.1536441921172; Sat, 08 Sep 2018 14:25:21 -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 u40-v6sm17340786wrc.43.2018.09.08.14.25.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Sep 2018 14:25:20 -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 v4 07/13] Compiler Attributes: remove unneeded sparse (__CHECKER__) tests Date: Sat, 8 Sep 2018 23:24:53 +0200 Message-Id: <20180908212459.19736-8-miguel.ojeda.sandonis@gmail.com> In-Reply-To: <20180908212459.19736-1-miguel.ojeda.sandonis@gmail.com> References: <20180908212459.19736-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 5ff9cda893f4..a3eceb3ad1b3 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -218,7 +218,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__))