Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3794626pxu; Mon, 30 Nov 2020 10:21:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNvIph6BYx87xXcS3jUKK9Nwk05AhCOSHxUEHN0oPUpZ7coT5+mnLTyyJDSazZPHYFDWxI X-Received: by 2002:a50:ff0c:: with SMTP id a12mr23371459edu.79.1606760511696; Mon, 30 Nov 2020 10:21:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606760511; cv=none; d=google.com; s=arc-20160816; b=BWLrwVvih8p1fzBrwyzosmRT0bMUwTtosADPxz9ED4ECDuHswBZWi8zwwuypKByIgp b1tpDVt5tPiO3UhNOQJVlAaO7/n4a+ZSfRAVLiYWyJgopYYFrkcb5pV4s8KU6wF6axvR yt4fn6ROrL5zswmDVCZY8ipK+ekVOFX++7wxt3NOHTZxMUGez6hmJbB59egoMoCioPZH DbqkIewGKpST2Zn7nQUs7bgrPFBCsJMiA2Lt4r3HgvN2U16Z4NyOZYXZTKFyxi2EQKo4 X2F/Nl6m5l51HYAmXCT08MtvYVdk0dKqLD3oPUAvqSS5/RMLsGxOT4M69l9OZbybEcTV iPWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GNY/70CAQC3eXUNKhqPKEV6KDBxfhoyyaZSVMFjGEY8=; b=L/47oLBqmam9YsdI7a6XptgYIbAXGnVItNHuvgg2sp8qDsECtXHrfH0wkDg+G/JII7 d7N2OIeMniFKLGki+XK6qrsP3DiU67UAli5Zwt5skbN5O3dLm0Tk6VVKC+FwxfW3FRNK J9ncCHdDiqh0628bmIFyIiNumEQ6OdydDyZfG4ZPMQGgZTY/tbsv43xIBN45mANCHQVX QMdTewDDeiGnvkw5+iGrAXtWHdiZOlZRVxht4cWj+EroWk5JhvGduoWnMDGrYubkmncX 9ZhR44tiA3S0tBJI9+afRATpZg3xHseYR7uATz9UdW/kPdW+4WYz3HSIDvXKmYP/II5G lJgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=IYOlgdTZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id a23si12481546edn.292.2020.11.30.10.21.27; Mon, 30 Nov 2020 10:21:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=IYOlgdTZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2388099AbgK3SR5 (ORCPT + 99 others); Mon, 30 Nov 2020 13:17:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388071AbgK3SR5 (ORCPT ); Mon, 30 Nov 2020 13:17:57 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD315C0617A6 for ; Mon, 30 Nov 2020 10:16:31 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id v3so2334319plz.13 for ; Mon, 30 Nov 2020 10:16:31 -0800 (PST) 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=GNY/70CAQC3eXUNKhqPKEV6KDBxfhoyyaZSVMFjGEY8=; b=IYOlgdTZd++fVWTYletOkoUT3ndMy448aAtQuAIXDNftZRVE+GdVf3fPiPCMKskPDE sEktxLJpNMGGz7Oxbfz18HSeFME8OUGXj8f6WRq3b9UI9lgCYn9U8IaSQuJt8MrwQvtz dJIi93LLvWtJlbJZPKnlStHRhPV1Jxs+vthk1vqmGEkhG1mnbfkMWVrMj9B+m/1akesX D0rJ2Nl4fQ/uZ6C4E2nQ+G2pxRRwj5RgM0mIvCQAAKh0oJpQyPk3xPaTi1nWLR+9/cUX 2Ww78lpiLdcwg+xLAvUSMXCQ736Yu435e9wGr9Vy77yHpB0TSBBHjKlKvcfqoOrPlhxS 7XKA== 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=GNY/70CAQC3eXUNKhqPKEV6KDBxfhoyyaZSVMFjGEY8=; b=tIzE3z9+shgcnCHiqyJQ76p8x0DjpIn/XbxPBMvalGrwtChIJelBH0S1wFpLCuJia1 iNoYI5mjuRqSmJQHWG9Dh3QCV/5j2190RgPtvmT6NO4pI3N2xtDPWcM42qDoRQPtj1KC Z5gPC/Tw9D7cRj7StaeYM60nR28xeUMRD0mh/6PZypxA4ZRT/EbMIyW0mp+Fs7ZC9aAz eBI5d9AJpKEw14/ANUdDnQcgH2w6y9y+gjDbQfWab42EF7oGOGub+bNPvgxtXAOyjUjE gZx26t0J7O37AeuFJHQOc0zZbsEjI3tQ/djLup+RS/RskFQqTBLnZV/3YhfNxoIUV2lk eOCQ== X-Gm-Message-State: AOAM531TxBqpANXRRIw0GTShejEGnJWjTKkXvp78G1s0oAXTrZ109oD5 4I8SJ4QFc2XhR7Tz0xMoVdyS9raNwexIT2g4jmlFdQ== X-Received: by 2002:a17:902:e901:b029:d8:e727:2595 with SMTP id k1-20020a170902e901b02900d8e7272595mr19843120pld.56.1606760191169; Mon, 30 Nov 2020 10:16:31 -0800 (PST) MIME-Version: 1.0 References: <20201128193335.219395-1-masahiroy@kernel.org> In-Reply-To: <20201128193335.219395-1-masahiroy@kernel.org> From: Nick Desaulniers Date: Mon, 30 Nov 2020 10:16:20 -0800 Message-ID: Subject: Re: [PATCH v3] Compiler Attributes: remove CONFIG_ENABLE_MUST_CHECK To: Masahiro Yamada Cc: Miguel Ojeda , "Jason A . Donenfeld" , Nathan Chancellor , Shuah Khan , clang-built-linux , LKML , "open list:KERNEL SELFTEST FRAMEWORK" , Network Development , wireguard@lists.zx2c4.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 28, 2020 at 11:34 AM Masahiro Yamada wrote: > > Revert commit cebc04ba9aeb ("add CONFIG_ENABLE_MUST_CHECK"). > > A lot of warn_unused_result warnings existed in 2006, but until now > they have been fixed thanks to people doing allmodconfig tests. > > Our goal is to always enable __must_check where appropriate, so this > CONFIG option is no longer needed. > > I see a lot of defconfig (arch/*/configs/*_defconfig) files having: > > # CONFIG_ENABLE_MUST_CHECK is not set > > I did not touch them for now since it would be a big churn. If arch > maintainers want to clean them up, please go ahead. > > While I was here, I also moved __must_check to compiler_attributes.h > from compiler_types.h > > Signed-off-by: Masahiro Yamada > Acked-by: Jason A. Donenfeld Reviewed-by: Nick Desaulniers > --- > > Changes in v3: > - Fix a typo > > Changes in v2: > - Move __must_check to compiler_attributes.h > > include/linux/compiler_attributes.h | 7 +++++++ > include/linux/compiler_types.h | 6 ------ > lib/Kconfig.debug | 8 -------- > tools/testing/selftests/wireguard/qemu/debug.config | 1 - > 4 files changed, 7 insertions(+), 15 deletions(-) > > diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h > index b2a3f4f641a7..5f3b7edad1a7 100644 > --- a/include/linux/compiler_attributes.h > +++ b/include/linux/compiler_attributes.h > @@ -171,6 +171,13 @@ > */ > #define __mode(x) __attribute__((__mode__(x))) > > +/* > + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-warn_005funused_005fresult-function-attribute > + * clang: https://clang.llvm.org/docs/AttributeReference.html#nodiscard-warn-unused-result > + * > + */ > +#define __must_check __attribute__((__warn_unused_result__)) > + > /* > * Optional: only supported since gcc >= 7 > * > diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h > index ac3fa37a84f9..7ef20d1a6c28 100644 > --- a/include/linux/compiler_types.h > +++ b/include/linux/compiler_types.h > @@ -110,12 +110,6 @@ struct ftrace_likely_data { > unsigned long constant; > }; > > -#ifdef CONFIG_ENABLE_MUST_CHECK > -#define __must_check __attribute__((__warn_unused_result__)) > -#else > -#define __must_check > -#endif > - > #if defined(CC_USING_HOTPATCH) > #define notrace __attribute__((hotpatch(0, 0))) > #elif defined(CC_USING_PATCHABLE_FUNCTION_ENTRY) > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index c789b39ed527..cb8ef4fd0d02 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -286,14 +286,6 @@ config GDB_SCRIPTS > > endif # DEBUG_INFO > > -config ENABLE_MUST_CHECK > - bool "Enable __must_check logic" > - default y > - help > - Enable the __must_check logic in the kernel build. Disable this to > - suppress the "warning: ignoring return value of 'foo', declared with > - attribute warn_unused_result" messages. > - > config FRAME_WARN > int "Warn for stack frames larger than" > range 0 8192 > diff --git a/tools/testing/selftests/wireguard/qemu/debug.config b/tools/testing/selftests/wireguard/qemu/debug.config > index b50c2085c1ac..fe07d97df9fa 100644 > --- a/tools/testing/selftests/wireguard/qemu/debug.config > +++ b/tools/testing/selftests/wireguard/qemu/debug.config > @@ -1,5 +1,4 @@ > CONFIG_LOCALVERSION="-debug" > -CONFIG_ENABLE_MUST_CHECK=y > CONFIG_FRAME_POINTER=y > CONFIG_STACK_VALIDATION=y > CONFIG_DEBUG_KERNEL=y > -- > 2.27.0 > -- Thanks, ~Nick Desaulniers