Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3058568imm; Mon, 10 Sep 2018 10:19:44 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYIBjdQqwU1DpibWPqBHY+KJzezVUGpYAGeqNU23ANiVQCBPypdrxEv8Evo0UCMzFALhV3N X-Received: by 2002:a17:902:528a:: with SMTP id a10-v6mr22711586pli.199.1536599984007; Mon, 10 Sep 2018 10:19:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536599983; cv=none; d=google.com; s=arc-20160816; b=gezmMrBzxJfG0atvRR2CCDAIFiG5kxAFAjMuGWXiWif4iq54CAvc3FHdDwO0Vqwxi2 XKnUefsbusVEydF15Jqs8lj+PyAwS0dA4uzgBpsqh7ZWNth3XzuFMmoBRDlIxL0HE0yT /zVkttGJEtQQoiD9Rgv0j4wf5PzGgXKkycf4ZGhTHiXcuOGf7GTJ9+PiWoSq5JxP2jW5 CqznKChLkLzJU9Tc4rsvIMm4TmsmedfwaTBMLq++BbglH5/wQwapBn6JOpkzDXNODKpl y0tD4Foc/zAbYlP4bcpKypd7+EOr3b9NPvLXb6xu7N9TTPZWJMWSIn0iDBe6IEe5flEp sjPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=yuOIQZv6WjRvAbKrrWHpsdnwVgADihJ1PU5uAuXb3BU=; b=iDBlu6JQmiUAEDNpEA0f3/XSjYXsdTrweDJodPwdO1MP9HmY0YO6uyGxWO0dmIAY23 L3liWQ1g+sReCnCniLvkDn77JbFuzZWg9B+rrX6NM2F0ucD3MFbhsD3RTwdDAwCAadq2 3Z6AaOwt1ON+jSJ9bHF8Fn/OUZ44KVMUsRU9AChGkeqWmWB1z1s8mwPoJhKrBdf1F1H1 uevMmkPcDMZ6cLkGGYvd7fWj2WZmf9Yr+WOkR/VBe4+sft80p43CfgfgNB66N0n+9a5F Oj/48dWlKf+0vYqj8YF/VWEPg4+M6bLkKRn41aFkbSSwbrriG27OrpOrn6ib4XW6pGbr ro6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FW95iO2q; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e30-v6si17622001pga.272.2018.09.10.10.19.28; Mon, 10 Sep 2018 10:19:43 -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=@google.com header.s=20161025 header.b=FW95iO2q; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729017AbeIJWMh (ORCPT + 99 others); Mon, 10 Sep 2018 18:12:37 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:34164 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728820AbeIJWMh (ORCPT ); Mon, 10 Sep 2018 18:12:37 -0400 Received: by mail-pf1-f196.google.com with SMTP id k19-v6so10818820pfi.1 for ; Mon, 10 Sep 2018 10:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yuOIQZv6WjRvAbKrrWHpsdnwVgADihJ1PU5uAuXb3BU=; b=FW95iO2qZ3Ex4T/a4AkaYhrtgxza99RtCOjp73h7nI08h9c3A56V0HSbuHpsDv3Fcf TSBGrrH8rFiDndtU1QXuj70vmLpnyWZ+bZP+lo6EvsZ9+RCjY+C0A0WR748XaoV69QWh zH+UpJWEEB+nKVH5Kl6JLHcOtFwdsAQZ5liZ6dSnc+/Wim86KCRtU4V2qaK9355XjDo/ tA7trYMmc/hKfViRtrtzKgTgmwyEozksyWVMwA7ykz2v4xJmqsxxPT7SqIPiwZdyCyQl 8+Ow+Y1Og+KM6E+6OdfBP9pnSpCpw7238zGZ4yz2wIqkI85vySCAHfBzPG/KOW+VWvoE YOHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yuOIQZv6WjRvAbKrrWHpsdnwVgADihJ1PU5uAuXb3BU=; b=OrqCZ3NYE2MIlzb7SgQmNdn0YoMCeuz7ZfOi9olnIusCljbsY21zKLc/REWwGOYMmN DpTcZ8tQIuA+MilK6CpdXpi7zjmfpvF+MqCO7iD7M07RtZiLlZVsxxo6dfbp9T7ubKUq W55a3gSmGLV6UQDQXUuUwWtTqqKpDaRX5203GzDuAQye43e/vtmBA8lAXpyGTqTlocge MH6zeHq0h0yq3x8O1eylk1QlzVIej39Rmj2KR/K0xTfURvAbzrYrZSEU5KllsJszzNHS ZIzX88CqhkIzHIcY9fAhGMnb+RejNv737qYuap/hegZFUvV88OVKor/suHv+Hr4YjGTK Bptw== X-Gm-Message-State: APzg51CdaS3CAqzbIsJANMBT0rq3DUXPNywg0q6kpNVXD86bO4HAW6BU khsImVru4zFP3pXVxoK23VitKBWLHMHtuupHlUu+ug20Wfk= X-Received: by 2002:a62:4b14:: with SMTP id y20-v6mr24769222pfa.93.1536599851787; Mon, 10 Sep 2018 10:17:31 -0700 (PDT) MIME-Version: 1.0 References: <20180908212459.19736-1-miguel.ojeda.sandonis@gmail.com> In-Reply-To: <20180908212459.19736-1-miguel.ojeda.sandonis@gmail.com> From: Nick Desaulniers Date: Mon, 10 Sep 2018 10:17:20 -0700 Message-ID: Subject: Re: [PATCH v4 00/13] Compiler Attributes To: Miguel Ojeda Cc: Linus Torvalds , LKML , Jonathan Corbet , Rasmus Villemoes , Luc Van Oostenryck , efriedma@codeaurora.org, sparse@chrisli.org, Kees Cook , Ingo Molnar , Geert Uytterhoeven , Arnd Bergmann , Greg KH , Masahiro Yamada , joe@perches.com, asmadeus@codewreck.org, linux-sparse@vger.kernel.org, linux-doc@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 8, 2018 at 2:25 PM Miguel Ojeda wrote: > > 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 > For the ones I didn't already review: Reviewed-by: Nick Desaulniers -- Thanks, ~Nick Desaulniers