Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2208099imm; Thu, 23 Aug 2018 16:33:16 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxgDdSB0ZlZhsHiofCJIpuCeseBmDejllVKD0sl2WxiF2fzZSLWEOCuew9LyrAoSmsur6gV X-Received: by 2002:a62:4fd9:: with SMTP id f86-v6mr64721488pfj.110.1535067196018; Thu, 23 Aug 2018 16:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535067195; cv=none; d=google.com; s=arc-20160816; b=VWQemaTT0/bCpizGKpOX/qJnPqDA+vj72rrPTB1xw079TjTahjSpQbSVBWyeZlrwob RLtmLwihhV9g/h4vMNfyrR2++uo8TbmV/WSPlbbLjCOkLg3QSbGV8y7DvX1Q35JZr8n0 O6uicyI/vXulpW3c7utORH6ZwjatVHH2n13ZVZ1mt6uj/0xg1f8LriD3cvKOdDKeqkuC UKgLQUHQZv4Glhirp3beyoGaT5YmgfQGsZCd0mJwViT1oNG0ysnyhyoPsqypiE4KxQBR vJQE/MR0rQxYkIXA9DmEZTiDJZ/DqEu+G2ASKX8vprdIvIUUe9FgzpiqrXMTHCMzyHkV M3GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=6/VfU+b2fW/02xL2RfbImX6MIeJkPyqx1kiJC5Oes78=; b=nDCNCHUAOA0AaC+DwPLZPPTKKWjfLONSHUPhjbjJKkIC7+6k/B2ri9I8wofhcMlNBT YBt8FxAPRDt+OM+Nkmz+Ti/rI8FBf0ztfYnMqROj6X1cng7iiWut2UEQLsl5hBUBa/xz MiFVqofzPDWhux0n41LxdeJlbbFSistyNf3rdftUbRzGg8KjHCSwxR50tcZ4l7mGg5j0 +B67JGGKkV7YerM2Whl3bAxKpov+BmnB/mEih6pCTru+E6G4Mql0kidsc80BCcX+bAKZ ZL7+xtwufBtbi4euEj3gk0f0Xd3llhNOUR99O/OoXpSOomNOUSGiRWNpn2NX12L8fZLT anVQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m64-v6si6146922pfc.17.2018.08.23.16.33.00; Thu, 23 Aug 2018 16:33:15 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726804AbeHXDDK (ORCPT + 99 others); Thu, 23 Aug 2018 23:03:10 -0400 Received: from smtprelay0174.hostedemail.com ([216.40.44.174]:57047 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726085AbeHXDDJ (ORCPT ); Thu, 23 Aug 2018 23:03:09 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 7601E83777F0; Thu, 23 Aug 2018 23:31:11 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1535:1543:1593:1594:1605:1711:1730:1747:1777:1792:2110:2194:2199:2393:2525:2553:2568:2628:2682:2685:2828:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4362:4605:5007:6117:6119:6248:6691:6742:7903:8957:9025:10004:10400:10848:11026:11232:11473:11657:11658:11914:12043:12294:12295:12296:12438:12555:12663:12740:12760:12895:13095:13439:14096:14097:14180:14181:14659:14721:14819:21060:21080:21220:21347:21365:21366:21433:21451:21627:21740:21795:30012:30034:30051:30054:30056:30070:30083:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL X-HE-Tag: ants85_a0a4471a2d42 X-Filterd-Recvd-Size: 5045 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf13.hostedemail.com (Postfix) with ESMTPA; Thu, 23 Aug 2018 23:31:08 +0000 (UTC) Message-ID: <1be357c91f6469c7a9b0e857fd15bad30347fd09.camel@perches.com> Subject: Re: [PATCH] include/linux/compiler*.h: make compiler-*.h mutually exclusive From: Joe Perches To: Nick Desaulniers Cc: Kees Cook , asmadeus@codewreck.org, Linus Torvalds , Masahiro Yamada , Jonathan Corbet , Arnd Bergmann , dwmw@amazon.co.uk, LKML , Thomas Gleixner , Will Deacon , Geert Uytterhoeven , Ingo Molnar , Andrew Morton , daniel@iogearbox.net, hpa@zytor.com Date: Thu, 23 Aug 2018 16:31:07 -0700 In-Reply-To: References: <20180822233724.110454-1-ndesaulniers@google.com> <20180823002508.GA822@nautica> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-08-23 at 16:12 -0700, Nick Desaulniers wrote: > On Thu, Aug 23, 2018 at 2:19 PM Joe Perches wrote: > > > > On Thu, 2018-08-23 at 14:03 -0700, Nick Desaulniers wrote: > > > One reply for a bunch of the various threads, to keep the number of emails down: > > > > > > On Wed, Aug 22, 2018 at 5:20 PM Joe Perches wrote: > > > > On Wed, 2018-08-22 at 16:37 -0700, Nick Desaulniers wrote: > > > > > +/* Compiler specific macros. */ > > > > > #ifdef __clang__ > > > > > #include > > > > > > > > probably better as > > > > > > > > #if defined(__clang) > > > > > > > > to match the style of the #elif defined()s below it > > > > > > Hi Joe, > > > Thanks for the feedback. I always appreciate it. If you have some > > > cleanups, want to send them to me, and I'll bundle them up for a PR? > > > I'm ok with that change. > > > > > > > > +#ifdef __GNUC_STDC_INLINE__ > > > > > +# define __gnu_inline __attribute__((gnu_inline)) > > > > > +#else > > > > > +# define __gnu_inline > > > > > +#endif > > > > > > > > Perhaps __gnu_inline should be in compiler-gcc and this > > > > should use > > > > > > > > #ifndef __gnu_inline > > > > #define __gnu_inline > > > > #endif > > > > > > Not this case; it's how we get gnu89 semantics for `extern inline` is > > > not compiler specific (therefor should not go in a compiler specific > > > header). > > > > It's not possible to know that compilers support what > > __attribute__(()) and at what version that support > > exists unless it is specified somewhere. > > __has_attribute: > https://clang.llvm.org/docs/LanguageExtensions.html#has-attribute > > The release notes of GCC-5 mention __has_attribute. > https://gcc.gnu.org/gcc-5/changes.html So not available in the now minimum supported gcc 4.6? > The point of feature detection is that it _doesn't matter_ what > version that support exists. Either it does and you can use it, or it > doesn't and you can decide whether to stop compiling or there's a > valid work around. > > Feature detection should be preferred to explicit version checks > except in 2 specific cases: > 1. It's not possible to properly perform feature detection. Language > features should not be added unless it's possible to safely check for > them. > 2. A very specific version of a very specific compiler is broken and > needs to be explicitly guarded against. > > > As far as I can tell, gnu_inline is not recognized by clang. > > > > https://clang.llvm.org/docs/AttributeReference.html > > If that was the case, I would not have added it in commit d03db2bc26f0 > ("compiler-gcc.h: Add __attribute__((gnu_inline)) to all inline > declarations"). > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d03db2bc26f0e4a6849ad649a09c9c73fccdc656 Hard to know. That commit message does not mention clang. > Docs can sometimes fall behind, the lone source of truth is the source code. > https://github.com/llvm-mirror/clang/search?q=gnu_inline&unscoped_q=gnu_inline Which no compiler user should have to read. > Godbolt is also incredibly helpful for testing various compiler versions: > https://godbolt.org/z/uMJ-mo Thanks for that. > https://reviews.llvm.org/D51190 That too. cheers, Joe