Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1032310imm; Sat, 8 Sep 2018 14:26:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY/om5+u13EJxcdS3q/TRPsDVjAU3DU4TthO4fLitlbff8WMYT+zGrVp0XqgEKDvJdBM4Vi X-Received: by 2002:a62:808c:: with SMTP id j134-v6mr15653920pfd.120.1536442012776; Sat, 08 Sep 2018 14:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536442012; cv=none; d=google.com; s=arc-20160816; b=FkuduclMnGugtU5HjBdaumpHU6F3B6I34URKBKJarCzsFEvhCboTZiVLMxgQlHyIO6 miUyqrwqcFBvSRHMO9deR5tBGOQjUAdLZRDkBVk1f5KoK21R62yPyyUEe8PYUKHHpc/M 6R5E4DEudGmDc4c+WDN3vxL0cUK4COsk5Na0wXC/AddYMbxLfpBh6pGSFPqOMkzwtUzy 4jOaiXUGjFJMYnnvxFlio5kmNYkOH717HRyMm8Z6UcLqhKXXYjS4R0+xtELx/A/FMm/p YWk0bGG0+tW3ALSbx8OuALY3OQtXIGv8HE3x3ojOhxtvxcAr7Z0gd7o2URTVZPrETeFu LkiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=hQLziiB7cA1CETh/GxBQlUsMkk9RYUuPHaaaolDaah0=; b=FX7o/a3dv+E9wYXRNbGxYJsvLAVqCDbz8GYohcauvI4J5m7a4U7BHBEHtGbC1fxKxH AUAbMJHVRHJHYFIyKr8FeAyl17DhtuNOutDyq+Fpb4ExuKCbtv7Yx+JbPLzZelUkYttF EjWrzd88wS+elvX0/PIbIBZk27O2UYqmXIRV4TC/9G1DEN9rX33aD4rRRLeY/WdNnZmv aWVCOC1g17FdXUYbcPAltswSeI/SvfZ2PIonhEhyUoU/Q+xg67D0Zolasvr0ZiLXDjnF E+MAZoJCn9lMxI9ILI4a+pB9Ir9wSnw1hSDMrKB4QGNqDX7EDD62FLtBhL9meivvUvc2 ulqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=i86wFAKF; 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 a23-v6si12269416pgk.673.2018.09.08.14.26.35; Sat, 08 Sep 2018 14:26:52 -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=i86wFAKF; 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 S1727803AbeIICMV (ORCPT + 99 others); Sat, 8 Sep 2018 22:12:21 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33407 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727675AbeIICMV (ORCPT ); Sat, 8 Sep 2018 22:12:21 -0400 Received: by mail-wr1-f67.google.com with SMTP id v90-v6so18168039wrc.0; Sat, 08 Sep 2018 14:25:11 -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; bh=hQLziiB7cA1CETh/GxBQlUsMkk9RYUuPHaaaolDaah0=; b=i86wFAKFgv+CeGVr1yvRHrQ4OtRj0qByEje4TrfNcIF/FPYmUEfNdxWTdqO7MGV65/ zZfMHb9w69ilqfao8gsvkzSH23RybdQCF5v4zE0xC1b9LuCLuRX+ODGy50DY11IA4QJ4 ZTWaz6eyBlaEslLLG/QzdLiPb3d/IeVEz67j0geqF/qmm9dY8qhHBH3eFhcJlsoLDYuF qaX40d4hVtYrZgVStjXwxbfbzcxCI8O2P2an7MqEtgIooDxBawoOvlzRzOxkDUL546Wo UK3j75GI6OV/3z4mIWd2TfInutx8cEUtLFjs+ECPUJywj8MVCdMm3OkcQUwMb0fB/Y4H VbCQ== 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; bh=hQLziiB7cA1CETh/GxBQlUsMkk9RYUuPHaaaolDaah0=; b=gbRGaKEzlimlRR7U5KSyFtxGspEGoBjn6uUI70846JbRYqXWt4SmF0w+lKjFbC9alb hPwJz/wsMElE3mAMD7b2jLFWW5nHKKdKWvT4WXjOaBOE2J/yWiWan20L+df61ORAskZd 3IGRo1UcBimFVF0auMTvOb8ONzxTBabyQP2fOaMkzf0wvzBPumwPh7fW5ioxmERWSX6p gkt700ukvXpwi8Ezp68MGEpln/usaxurLxNsCPyM8l2Z0C2xDcsEaCP98lJkqDhcAEwh ZIbsKEPtFWqcYwQqIMLz4h0iRaiXkS6gCMcnVj06gYgvRPakXbKVxNrVKZYWRQz1Qid1 z4Rg== X-Gm-Message-State: APzg51CQqH3q8dPDfQvLv4FnmxqC1bgoyeK9S5FLs/nBXjPmD5SHvElH 7obwhZ7sfhs2meNjhNQbi00= X-Received: by 2002:a5d:4605:: with SMTP id t5-v6mr9364555wrq.200.1536441911169; Sat, 08 Sep 2018 14:25:11 -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.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Sep 2018 14:25:10 -0700 (PDT) From: Miguel Ojeda To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Jonathan Corbet , 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 , Nick Desaulniers , linux-sparse@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v4 00/13] Compiler Attributes Date: Sat, 8 Sep 2018 23:24:46 +0200 Message-Id: <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 Compiler Attributes series is an effort to disentangle the include/linux/compiler*.h headers and bring them up to date. The main idea behind the series is to use feature checking macros (i.e. __has_attribute) instead of compiler version checks (e.g. GCC_VERSION), which are compiler-agnostic (so they can be shared, reducing the size of compiler-specific headers) and version-agnostic. Other related improvements have been performed in the headers as well, which on top of the use of __has_attribute it has amounted to a significant simplification of these headers (e.g. GCC_VERSION is now only guarding 4 non-attribute macros). This series should also help the efforts to support compiling the kernel with clang and icc. A fair amount of documentation and comments have also been added, clarified or removed; and the headers are now more readable, which should help kernel developers in general. The series was triggered due to the move to gcc >= 4.6. In turn, this series has also triggered Sparse to gain the ability to recognize __has_attribute on its own. You can also fetch it from: https://github.com/ojeda/linux/tree/compiler-attributes-v4 Enjoy! Cheers, Miguel Cc: Jonathan Corbet 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: Nick Desaulniers Cc: Linus Torvalds Cc: linux-sparse@vger.kernel.org Cc: linux-doc@vger.kernel.org Signed-off-by: Miguel Ojeda v3 -> v4 This time it is an important fix I found while doing randconfigs, plus the documentation sentence that Nick suggested and the MAINTAINERS file. Compile-tested for a while on (x86_64, gcc-7.3) on a few randconfs. New: * Add MAINTAINERS entry for the new file (compiler_attributes.h) so that we try to maintain that one as clean as possible. (if someone else wants to join, feel free!) Modified: * Fix inline macro __always_inline cannot be used in the inline macro, because people marking a function as __always_inline would expand to inline which in turn would expand back to __always_inline (under some configs), which would not be expanded again. Added a comment about this in the inline macro. Also added another comment about __always_inline in compiler_attributes.h to note that users expect to not have to write inline (as well as the attribute). We cannot simply remove "inline" there (which would solve the problem described above) because using the attribute is not enough for gcc. A function marked as always_inline seems to require to be marked as inline itself so that the attribute is applied: "warning: always_inline function might not be inlinable [-Wattributes]" From the gcc docs: "For functions declared inline, this attribute inlines the function independent of any restrictions that otherwise apply to inlining." See https://godbolt.org/z/LpzUPj for an example. From reviews: * Add sentence about feature-detection in Docs (Nick) Miguel Ojeda (13): Compiler Attributes: remove unused attributes Compiler Attributes: always use the extra-underscores syntax Compiler Attributes: remove unneeded tests Compiler Attributes: homogenize __must_be_array Compiler Attributes: naked was fixed in gcc 4.6 Compiler Attributes: naked can be shared Compiler Attributes: remove unneeded sparse (__CHECKER__) tests Compiler Attributes: add missing SPDX ID in compiler_types.h Compiler Attributes: use feature checks instead of version checks Compiler Attributes: KENTRY used twice the "used" attribute Compiler Attributes: remove uses of __attribute__ from compiler.h Compiler Attributes: add Doc/process/programming-language.rst Compiler Attributes: Add MAINTAINERS entry Documentation/process/index.rst | 1 + .../process/programming-language.rst | 45 ++++ MAINTAINERS | 5 + include/linux/compiler-clang.h | 5 - include/linux/compiler-gcc.h | 84 +----- include/linux/compiler-intel.h | 9 - include/linux/compiler.h | 19 +- include/linux/compiler_attributes.h | 244 ++++++++++++++++++ include/linux/compiler_types.h | 105 ++------ 9 files changed, 329 insertions(+), 188 deletions(-) create mode 100644 Documentation/process/programming-language.rst create mode 100644 include/linux/compiler_attributes.h -- 2.17.1