Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1033314imm; Sat, 8 Sep 2018 14:28:39 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda8GC9k2EEHVVDPGVBbD866MrbyYU1xLCHc66Q9VkriRfzLtIiqqyz0yXp/R8JmJ29md3xh X-Received: by 2002:a17:902:6b47:: with SMTP id g7-v6mr14731989plt.128.1536442119073; Sat, 08 Sep 2018 14:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536442119; cv=none; d=google.com; s=arc-20160816; b=lhN1GqVHeodEE8MqhF3dUN4dg+/FOXFqs0s5InEy7PBywjujSuz7IH6jbwLz8yGwvG ueZA9VlU9fouJiq+5Za+v56PVk3WT0QFMi+8bxmY9MI8RWu5gPtvInQxB9nUQyyjqqCv zNxCFM/BRkqeATopqn+ldz9VHgw3KckbwZNNBMZkxyKZL90jt4qxkfV8lcPr8fwrFMR0 WMGR6NI1zHISKjcWejAP/YnCGdn0+QrVdX5Eh9UuHvtgtFV8ZFDpTc60WemfZpPvbOU9 WIlNoWDkWCzDBJjIRyTuA1STGxPpqZx0cWvS075rr9JBHIPWKpM8AD/spukKMAktNtOo EYjQ== 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:dkim-signature; bh=0nSFCzTHwEx3uHSnN/pA7EXvGdKx2RttjcOzGdkhYLw=; b=Ee2RfH9Q2dfneviHAUbIBEc389hJoDpA0Es56o+iPgdF0wl16rZDzxUZv6C5rSJU12 bwr8e8YsptEHPcfC8C6gUhZyiXQV2QzWz1kDNekqqB3Bh2jUtVzfwhgMrRmiYFIU/iHB 3hr5Ma/Q28LuSfWa12LqNiToCD6k3UGFUo0ghM5yR4GpEgI7vEdfa0L1OtuORb/1umMS kORIL5A8NuZRN6EhXD8qP/Qk49S4dfFyKWLTD1sZaXUGAgwNvs2o/oVG9YDzlWjDmsNV tTMmjcotPN1lTGT6Jcj3t1fhGiCb7a1SVW7fh3/eL/DRTxIId1cFD9n6jz/z/dzhHV7c XN+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KhLeyyvB; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p19-v6si12702627pgm.109.2018.09.08.14.28.24; Sat, 08 Sep 2018 14:28:39 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KhLeyyvB; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727955AbeIICM0 (ORCPT + 99 others); Sat, 8 Sep 2018 22:12:26 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:52189 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727675AbeIICM0 (ORCPT ); Sat, 8 Sep 2018 22:12:26 -0400 Received: by mail-wm0-f65.google.com with SMTP id y2-v6so17810395wma.1; Sat, 08 Sep 2018 14:25:14 -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=0nSFCzTHwEx3uHSnN/pA7EXvGdKx2RttjcOzGdkhYLw=; b=KhLeyyvBiiTvGHA2l/MgHVAheDHnUHUap6la6Ws/7+8XzYp6AaI1QDAVkMIE/j3ISl n0zUwgI+Umcoa3yA/vjVMgkoQKveTmAKNK3o5pOn+qtAfkZDQ8V1iCzuMXdCZsqX3ohZ KgI9vRcKAM/3BnFaOzXRqTHXHOz2Ritco3ADpNz6djt7MrKKfJheGxMsjpG6M/poxqHi xJ0ZMcahnyK0WLiPqbPouIRVhKNS5Tc0EXpl75Xr3ULcUKAd7isJE3d/147k/E0Y7jlz 5vkIORpKanfGQyBAmpZ0eG2DkEWN8oHEUW5egak5R4WrVvyktWGa2yTaOdlTwDks7cq8 uMpg== 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=0nSFCzTHwEx3uHSnN/pA7EXvGdKx2RttjcOzGdkhYLw=; b=Wj3JtosCwYIH0Ai/16eyrE9EchJ5RD14/Oq/OoZcuEWKWVQeIWOfolfGstkFqC/KBB uPfuvXmdfdzCV/diogkOlV/V51Rve1mrabnQiZaQkzKuzL/R7aZOSVFitIOs4WHUsKec bDBJflgoYOnn+tuXgahECPTJh/AmAos4aMeySon5X/GMQpiiRNl1P96dgktQ7eRNNUuS gPkqAjt36LrwaR49WqyRZUFCJO1dXjnqXjvv1LeN3cxV9U1OkNvbb41aBMT+zLG57PkH Ba6feHUq8YHmdWcUrJPvuL9CH0cSHDnvJfCRTsuEHlPcXhYmi3eM/Fb4h4RjXPxtf9Wn YEVA== X-Gm-Message-State: APzg51BQSGLKS+1NVSMlDQnmadaIU/KqmVKSrioxGhAZG00BkA0FoLvD 0vCOItPMjoT5Sbys7C9oEcU= X-Received: by 2002:a1c:c203:: with SMTP id s3-v6mr9296987wmf.65.1536441914016; Sat, 08 Sep 2018 14:25:14 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Sep 2018 14:25:13 -0700 (PDT) From: Miguel Ojeda To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Rasmus Villemoes , Luc Van Oostenryck , 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 02/13] Compiler Attributes: always use the extra-underscores syntax Date: Sat, 8 Sep 2018 23:24:48 +0200 Message-Id: <20180908212459.19736-3-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The attribute syntax optionally allows to surround attribute names with "__" in order to avoid collisions with macros of the same name (see https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html). This homogenizes all attributes to use the syntax with underscores. While there are currently only a handful of cases of some TUs defining macros like "error" which may collide with the attributes, this should prevent futures surprises. This has been done only for "standard" attributes supported by the major compilers. In other words, those of third-party tools (e.g. sparse, plugins...) have not been changed for the moment. Cc: Rasmus Villemoes Cc: Luc Van Oostenryck 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 Reviewed-by: Nick Desaulniers Signed-off-by: Miguel Ojeda --- include/linux/compiler-clang.h | 2 +- include/linux/compiler-gcc.h | 14 ++++++------ include/linux/compiler-intel.h | 2 +- include/linux/compiler.h | 8 +++---- include/linux/compiler_types.h | 40 +++++++++++++++++----------------- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index b1ce500fe8b3..d11cad61ba5c 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -21,7 +21,7 @@ #define __SANITIZE_ADDRESS__ #endif -#define __no_sanitize_address __attribute__((no_sanitize("address"))) +#define __no_sanitize_address __attribute__((__no_sanitize__("address"))) /* * Not all versions of clang implement the the type-generic versions diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 0a2d06677d83..371b6fa2d074 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -76,7 +76,7 @@ #endif #ifdef RETPOLINE -#define __noretpoline __attribute__((indirect_branch("keep"))) +#define __noretpoline __attribute__((__indirect_branch__("keep"))) #endif /* @@ -91,15 +91,15 @@ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves. * See GCC PR44290. */ -#define __naked __attribute__((naked)) noinline __noclone notrace +#define __naked __attribute__((__naked__)) noinline __noclone notrace #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) #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))) +#define __compiletime_warning(message) __attribute__((__warning__(message))) +#define __compiletime_error(message) __attribute__((__error__(message))) #ifdef LATENT_ENTROPY_PLUGIN #define __latent_entropy __attribute__((latent_entropy)) @@ -148,7 +148,7 @@ * optimizer that something else uses this function or variable, thus preventing * this. */ -#define __visible __attribute__((externally_visible)) +#define __visible __attribute__((__externally_visible__)) /* gcc version specific checks */ @@ -205,7 +205,7 @@ * should not be applied to that function. * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 */ -#define __no_sanitize_address __attribute__((no_sanitize_address)) +#define __no_sanitize_address __attribute__((__no_sanitize_address__)) #endif #if GCC_VERSION >= 50100 @@ -213,7 +213,7 @@ * Mark structures as requiring designated initializers. * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html */ -#define __designated_init __attribute__((designated_init)) +#define __designated_init __attribute__((__designated_init__)) #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 #endif diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h index 4c7f9befa9f6..fef8bb3e53ef 100644 --- a/include/linux/compiler-intel.h +++ b/include/linux/compiler-intel.h @@ -42,4 +42,4 @@ * and may be redefined here because they should not be shared with other * compilers, like clang. */ -#define __visible __attribute__((externally_visible)) +#define __visible __attribute__((__externally_visible__)) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 7c0157d50964..ec4a28bad2c6 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -24,7 +24,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, long ______r; \ static struct ftrace_likely_data \ __attribute__((__aligned__(4))) \ - __attribute__((section("_ftrace_annotated_branch"))) \ + __attribute__((__section__("_ftrace_annotated_branch"))) \ ______f = { \ .data.func = __func__, \ .data.file = __FILE__, \ @@ -60,7 +60,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, int ______r; \ static struct ftrace_branch_data \ __attribute__((__aligned__(4))) \ - __attribute__((section("_ftrace_branch"))) \ + __attribute__((__section__("_ftrace_branch"))) \ ______f = { \ .func = __func__, \ .file = __FILE__, \ @@ -146,7 +146,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, extern typeof(sym) sym; \ static const unsigned long __kentry_##sym \ __used \ - __attribute__((section("___kentry" "+" #sym ), used)) \ + __attribute__((__section__("___kentry" "+" #sym ), used)) \ = (unsigned long)&sym; #endif @@ -287,7 +287,7 @@ unsigned long read_word_at_a_time(const void *addr) * visible to the compiler. */ #define __ADDRESSABLE(sym) \ - static void * __attribute__((section(".discard.addressable"), used)) \ + static void * __attribute__((__section__(".discard.addressable"), used)) \ __PASTE(__addressable_##sym, __LINE__) = (void *)&sym; /** diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index b6534292ea33..2bc0f94df38e 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -195,26 +195,26 @@ struct ftrace_likely_data { * would be. * [...] */ -#define __pure __attribute__((pure)) -#define __aligned(x) __attribute__((aligned(x))) -#define __aligned_largest __attribute__((aligned)) -#define __printf(a, b) __attribute__((format(printf, a, b))) -#define __scanf(a, b) __attribute__((format(scanf, a, b))) -#define __maybe_unused __attribute__((unused)) -#define __always_unused __attribute__((unused)) -#define __mode(x) __attribute__((mode(x))) +#define __pure __attribute__((__pure__)) +#define __aligned(x) __attribute__((__aligned__(x))) +#define __aligned_largest __attribute__((__aligned__)) +#define __printf(a, b) __attribute__((__format__(printf, a, b))) +#define __scanf(a, b) __attribute__((__format__(scanf, a, b))) +#define __maybe_unused __attribute__((__unused__)) +#define __always_unused __attribute__((__unused__)) +#define __mode(x) __attribute__((__mode__(x))) #define __malloc __attribute__((__malloc__)) #define __used __attribute__((__used__)) -#define __noreturn __attribute__((noreturn)) -#define __packed __attribute__((packed)) -#define __weak __attribute__((weak)) -#define __alias(symbol) __attribute__((alias(#symbol))) -#define __cold __attribute__((cold)) +#define __noreturn __attribute__((__noreturn__)) +#define __packed __attribute__((__packed__)) +#define __weak __attribute__((__weak__)) +#define __alias(symbol) __attribute__((__alias__(#symbol))) +#define __cold __attribute__((__cold__)) #define __section(S) __attribute__((__section__(#S))) #ifdef CONFIG_ENABLE_MUST_CHECK -#define __must_check __attribute__((warn_unused_result)) +#define __must_check __attribute__((__warn_unused_result__)) #else #define __must_check #endif @@ -222,7 +222,7 @@ struct ftrace_likely_data { #if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__) #define notrace __attribute__((hotpatch(0, 0))) #else -#define notrace __attribute__((no_instrument_function)) +#define notrace __attribute__((__no_instrument_function__)) #endif #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) @@ -234,7 +234,7 @@ struct ftrace_likely_data { * defined so the gnu89 semantics are the default. */ #ifdef __GNUC_STDC_INLINE__ -# define __gnu_inline __attribute__((gnu_inline)) +# define __gnu_inline __attribute__((__gnu_inline__)) #else # define __gnu_inline #endif @@ -254,17 +254,17 @@ struct ftrace_likely_data { #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ !defined(CONFIG_OPTIMIZE_INLINING) #define inline \ - inline __attribute__((always_inline, unused)) notrace __gnu_inline + inline __attribute__((__always_inline__, __unused__)) notrace __gnu_inline #else -#define inline inline __attribute__((unused)) notrace __gnu_inline +#define inline inline __attribute__((__unused__)) notrace __gnu_inline #endif #define __inline__ inline #define __inline inline -#define noinline __attribute__((noinline)) +#define noinline __attribute__((__noinline__)) #ifndef __always_inline -#define __always_inline inline __attribute__((always_inline)) +#define __always_inline inline __attribute__((__always_inline__)) #endif /* -- 2.17.1