Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2520086pxp; Mon, 7 Mar 2022 17:46:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwiv4m0mkNSilMLPw8h8c660MQeVKaMc8IJHALIlX2QNUu1qfVsfb3/PbZaR8xkQaWgtFFq X-Received: by 2002:a05:6402:5173:b0:415:f1e2:8d53 with SMTP id d19-20020a056402517300b00415f1e28d53mr13876458ede.95.1646703997161; Mon, 07 Mar 2022 17:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646703997; cv=none; d=google.com; s=arc-20160816; b=LsIj9+Q8qdoF/GvSVYGJ1Yc+XbSwS8RzbPeUBRLBHRt36gzSElCIDRq1wkAXfQ3ikm T/tfENkd6wWXctL8qi8ofGQQN4js63xrQPhvrjn5Im/VpKWXnmnh8QIpG9Zh22twwFd6 7EazKAxoGiDYatKjdqaVPokizxxEPoo6upY0I1luCCaXHeNiej6YMA+wT34ylRGHh4mT cHf7O8XFtSW1LQI8rcQ/E9E/Nw1K5yRlgbLfwg5vI6zsOE3DlbrEHeBf1+1Qr5NPDh/P xt4Q04P8J3rjovsUP0Uu9/6xuEDto4G3mYytnTmuiAhK9k/9Iy6FIw64ljaSdwkf83CD u+Ew== 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=q9MIZw6teCffW6Igi7yqKRQRmAst7rY6bxwkmUE9mhs=; b=AMWb/1wqNBQN/Qf4LKH6jQZWGyj5vAwhw7uBc+Lik36E+dEnqVTYIuLKwDtJ7TKZ0U B1yQq/xiKH7weQRK2FKG0rptb2KMeX7vonQDVZSYUGNptQkRg8+uR+6NzJWGRpaY4Kxi QyG674R6sizcMvEr+u3zGU8GMO+Sw88FeCzQ7Kfh+2y/V2V2YuAgg3gXwuBe0eSEclL9 KdMmmd4H/CpbhxmnTtBI3ZG8s4aUlb2diQDjXhNN/Ybhtf7NSIAX8j7kX4Nw6LhGXNNH gRpzDmhXgiwW5j1hZdcb0p6qksvIhUu8DSSslMedZ/FwD7Htc4nA09BfcvE+ME4AGhSU yHPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=bZD8Y3Sq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kl2-20020a170907994200b006d0c16be2a2si8661839ejc.146.2022.03.07.17.46.14; Mon, 07 Mar 2022 17:46:37 -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=@google.com header.s=20210112 header.b=bZD8Y3Sq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245073AbiCGTb0 (ORCPT + 99 others); Mon, 7 Mar 2022 14:31:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245110AbiCGTbW (ORCPT ); Mon, 7 Mar 2022 14:31:22 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37C127E0B1 for ; Mon, 7 Mar 2022 11:30:28 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id s18so1682967plp.1 for ; Mon, 07 Mar 2022 11:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=q9MIZw6teCffW6Igi7yqKRQRmAst7rY6bxwkmUE9mhs=; b=bZD8Y3SqOgghrjCIHTeGTF6y6uqzsnVMF4L6I6oOWCeeoTHF94gaNNfuDiAr11u+qa M+fjbH8BA93m9z4YCAZ1qs+tII+HXl7jmhJf9EFLpNy/zuGf0prGeo7Ba0dnTt5JxiCN 9/5N2y2e4zqUHuOOgZ4rz2Q4HnUK+2M5MrVfIyKBFGIFsYzj6wxWB5syvmVxBSP4NUxk r3xQuoFO0F4eCOaFmTBQVV9t6tIbhMH6Oc1MvsC1jJffUHd5jOLs+ntjvfh6ylYTm1Ff snO7v4AJlAOzYvTfXCpISPyvw6RKAnTkeVXNoQ5DnQvl9fxQ7RurPKRpiQoipSNIHK4B T+CQ== 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=q9MIZw6teCffW6Igi7yqKRQRmAst7rY6bxwkmUE9mhs=; b=qjiBBAhYroGrRL8Za0+uywHdkdT3qOaueJ/2JWAfq5WdR+5Y1Nrrqp/B0udjINGTN9 XXnTf+A5kyzADvMey4XNQKBo3YV/RL76Q1mBb6bRQuQ71L1ci+ZsFJOOcu4EA58FCMla UTNKf1KlzxGTTDhiItmL+LLmUifw2oEWh6WcxJ/rusGjJ57gV+x2kIPPbG/au0u138OE slOIuszx1HozIXRoIP7rPwZCcbfBrEh2nk/xkF7f4xpwNonVD9opEA5wR7MAJX2oBjqW cxGVzLLBlJiPxBQAw+F5TU1ZGHv3h6cEFXHp51/SgKO5fh2TUR40pdJFT0flrwl+E8qx EfeQ== X-Gm-Message-State: AOAM530e6930vgXn8Pyt/cVVbGQWnlk6yjff5fgEHcgWCRB7kt1X33s5 9axz0Cosr3utipLK729PnvUPoA== X-Received: by 2002:a17:90a:ba10:b0:1bf:6900:2c5d with SMTP id s16-20020a17090aba1000b001bf69002c5dmr601274pjr.36.1646681427476; Mon, 07 Mar 2022 11:30:27 -0800 (PST) Received: from google.com ([2620:15c:211:202:ed1d:9a92:2389:76be]) by smtp.gmail.com with ESMTPSA id g6-20020a056a001a0600b004f2a4316a0asm16426990pfv.60.2022.03.07.11.30.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 11:30:26 -0800 (PST) Date: Mon, 7 Mar 2022 11:30:18 -0800 From: Nick Desaulniers To: Kumar Kartikeya Dwivedi 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: 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: <20220304224645.3677453-7-memxor@gmail.com> X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 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+. > + > /* > * 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 >