Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2798941pxp; Tue, 8 Mar 2022 01:58:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjGvDeKDri10RGO0EyaZ/Fsu5Iojy6FN76DD6VqUYabCkgkRVGqVOowlbwagcCjbmccUEW X-Received: by 2002:a63:82c1:0:b0:37c:99c3:e3ef with SMTP id w184-20020a6382c1000000b0037c99c3e3efmr13382534pgd.27.1646733504546; Tue, 08 Mar 2022 01:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646733504; cv=none; d=google.com; s=arc-20160816; b=xX4mt2bS3Km7Je1o/uxiQqCv/IttRa+N/rq4a9zLq/jafHOLUQn4vuQsrWSxlzdVsy ZYd7F4m0nvnxM/h0c6qDaCiKvhD7Y/OOYdgw6l1JfmRzlVEayyDT5lcXSOhHeyAotuc3 jLIV7+06lGab+hf97cNWFsmrdoY+UKopj6AkarMG8IVX1h1W7NQ7fAzaYOWFpJ5JHHBZ noIVs1a0P1KtRWO90Ei6wAXFwZAV25V3dsZ8vhJEfj8dKZkT+9ddL+kujc0O8KJp5UEM CpWENPvIrOyJ18FWoq96ZZt7wT5k5cgiw7NeQZqzFxzx/fxH+CrFO3W9uxm8WndNwWW/ v3Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yR4pOnNNi+W5qKC3ntFghkt+5izb2a8c8+qMVgl1ApA=; b=oNGnZliMe+5sRGppNGTffCO5PLwOHYec+Pr8wPn4mBSNxgVU/kLkntBNMzjAX0buXG RfDj0F53JexujuZ3j5HcXL8hYooL10jrlQgRnHte/DVotr5OkzVeUq1XLFRc+MRipsfh 79rVhldUHaiGW5UXs8M943uB2DGzjLiWTLjSztazZbgJlAoD/OaX7deBsBQnF/Z6Q4zl 3B4LVqsnZEb+1QgG3xZY3WJYFa/0RiuC777ynBMhRJPRS9E8YyAFhgOpvno7mi01fIUm IuYo6PjeN2dSep5Mk0INdX7zFYPzj3FdycTQNN8n+Zflg7zgBYBsAQkLicyh6WWKH5r5 9dhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="NMPhOzq/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a170902ce0c00b0014d9b77957esi15746723plg.88.2022.03.08.01.58.09; Tue, 08 Mar 2022 01:58:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="NMPhOzq/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S245299AbiCGUxG (ORCPT + 99 others); Mon, 7 Mar 2022 15:53:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245320AbiCGUwy (ORCPT ); Mon, 7 Mar 2022 15:52:54 -0500 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 569396E348; Mon, 7 Mar 2022 12:51:59 -0800 (PST) Received: by mail-pl1-x644.google.com with SMTP id w4so4747181ply.13; Mon, 07 Mar 2022 12:51:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=yR4pOnNNi+W5qKC3ntFghkt+5izb2a8c8+qMVgl1ApA=; b=NMPhOzq/mMkrZi5s2ob46xsjhUImMM+S51Ohw253Be5IB2AqUfkoGWIsRG78GPNIe9 l49K8cC320ZDVF6hl6ODxby80/z1d5Dg2rk8YnabapY45nxqBojFbGsAOxe8jR+Rv3/5 s4uZnESwccKzVjg8DwSBZ5kzofetAnaVvOMuBRdni8yqHc0+KXC8fGLoT6Sq8SxhDkb1 j1vlzr8iCKaO2GIuxisUt2ZU4XAKG2dgWce+2fOmMZs05WasPdJw6LfyXgbGzK/Tp+p7 cuBZH5YD7194STKKMIyxTkosa/8JXebt2/kqqZgWLwHwkoYCUlQ7WeMfWb7XU7xGPpGY SizQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yR4pOnNNi+W5qKC3ntFghkt+5izb2a8c8+qMVgl1ApA=; b=5JSjylugoIY/mB5sdKLgER41jkjkxxNG099bbV1lqK2//kkQjr5eT0nwwXtpzxkicq K1r7+XN5vndWQiwqZbB9x+gYQKRA4zD2f8m5skjizhc7BIpMS05D4x77UFXf0wU0r5Y3 40PPgOG1RZYsezWx3yPWrJJNerpHZGi5yvgTy1CehzR53vJ3zXxMd3R6idnNQTMmIl/5 0ITIfemf+qUNSb/P1yEODJKLPkT6y8F1+dg0AeN6bEyZqEmuwWJlr9lEHsA6GFmHfClR +6LzDB0ccT6mTkKCg0GMBFJx04j6KhtXVgbfJ2gXIssHSpEoID7m6cwsGTgmFV0HRNfu Cudw== X-Gm-Message-State: AOAM530/549iLNOFg74HvNxi7omwQH1kgBwOx72qesChFoNIkJjPOqky 5utQmQcxvOgE3/slANX8c3M= X-Received: by 2002:a17:902:7595:b0:151:7b0b:11c4 with SMTP id j21-20020a170902759500b001517b0b11c4mr14337470pll.126.1646686318792; Mon, 07 Mar 2022 12:51:58 -0800 (PST) Received: from localhost ([2405:201:6014:d0c0:6243:316e:a9e1:adda]) by smtp.gmail.com with ESMTPSA id f7-20020a056a0022c700b004e11d3d0459sm17440929pfj.65.2022.03.07.12.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 12:51:58 -0800 (PST) Date: Tue, 8 Mar 2022 02:21:56 +0530 From: Kumar Kartikeya Dwivedi To: Nick Desaulniers Cc: bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next v4 6/8] compiler_types.h: Add unified __diag_ignore_all for GCC/LLVM Message-ID: <20220307205156.g5pv4jg3iihhffxc@apollo.legion> References: <20220304224645.3677453-1-memxor@gmail.com> <20220304224645.3677453-7-memxor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 08, 2022 at 01:00:18AM IST, Nick Desaulniers wrote: > On Sat, Mar 05, 2022 at 04:16:43AM +0530, Kumar Kartikeya Dwivedi wrote: > > Add a __diag_ignore_all macro, to ignore warnings for both GCC and LLVM, > > without having to specify the compiler type and version. By default, GCC > > 8 and clang 11 are used. This will be used by bpf subsystem to ignore > > -Wmissing-prototypes warning for functions that are meant to be global > > functions so that they are in vmlinux BTF, but don't have a prototype. > > > > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Kumar Kartikeya Dwivedi > > --- > > include/linux/compiler-clang.h | 3 +++ > > include/linux/compiler-gcc.h | 3 +++ > > include/linux/compiler_types.h | 4 ++++ > > 3 files changed, 10 insertions(+) > > > > diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h > > index f1aa41d520bd..babb1347148c 100644 > > --- a/include/linux/compiler-clang.h > > +++ b/include/linux/compiler-clang.h > > @@ -90,3 +90,6 @@ > > #else > > #define __diag_clang_11(s) > > #endif > > + > > +#define __diag_ignore_all(option, comment) \ > > + __diag_clang(11, ignore, option) > > diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h > > index ccbbd31b3aae..d364c98a4a80 100644 > > --- a/include/linux/compiler-gcc.h > > +++ b/include/linux/compiler-gcc.h > > @@ -151,6 +151,9 @@ > > #define __diag_GCC_8(s) > > #endif > > > > +#define __diag_ignore_all(option, comment) \ > > + __diag_GCC(8, ignore, option) > > While this approach will work for clang, it doesn't seem scalable for > GCC. Documentation/process/changes.rst documents that we support gcc > 5.1+. This approach will only disable diagnostics for gcc 8+. > ISTM the original commit adding these macros only defined them for GCC 8+, so coverage for previous versions is already not there, unrelated to this change. I am not sure what the reason for that was, though. > > + > > /* > > * Prior to 9.1, -Wno-alloc-size-larger-than (and therefore the "alloc_size" > > * attribute) do not work, and must be disabled. > > diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h > > index 3f31ff400432..8e5d2f50f951 100644 > > --- a/include/linux/compiler_types.h > > +++ b/include/linux/compiler_types.h > > @@ -371,4 +371,8 @@ struct ftrace_likely_data { > > #define __diag_error(compiler, version, option, comment) \ > > __diag_ ## compiler(version, error, option) > > > > +#ifndef __diag_ignore_all > > +#define __diag_ignore_all(option, comment) > > +#endif > > + > > #endif /* __LINUX_COMPILER_TYPES_H */ > > -- > > 2.35.1 > > -- Kartikeya