Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3244131rwb; Mon, 7 Aug 2023 10:15:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHA4eBYL1Ec2zXgcSdvWhS/yF4xcwyv6PH6gikBde68sAlEWTgGfoVMOGDVCGGBB+m0rAcE X-Received: by 2002:a17:902:ef85:b0:1bc:afa:95a6 with SMTP id iz5-20020a170902ef8500b001bc0afa95a6mr7330479plb.40.1691428501226; Mon, 07 Aug 2023 10:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691428501; cv=none; d=google.com; s=arc-20160816; b=hDAurwpxlkRGUBOxX2ZmkAXGHrk9B1he1nDLAZRXQqJ0qIu+hov5Co3Dq6N3oiDArZ HNMT2rMLGUxuELx/6ak3oNCEheNJwpQU3WF5RIO0T6JSD5+hzCkM6ZQQrMU18TBGcvph kJlNssZQn9UreZEkvxo6+d8jQ+SF8HBHs0bSuTsPrvWcLZAhSHC826HA5HUD11YO3VQ6 OyUcCPKt6jeyGLdHV2HM2uAJQvKj7jKU3sNhwh1+m+rCCsywNkQ3d49GwB8otWlMauj5 xLVN6qF/b7OwYDJQjEEOkfACD1Ne9/DCVMJ3KvqB6Ih1+8qTk6zQNyrwPbJ9tnJ07HyI 2xfA== 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=hcRT2NJevtWcvZ4AL0hyW0FaJUXDSZuANVKMLdThY9Q=; fh=L95h+XquSwhIptIeFofVXDHG6asJggoJWCQw5BJbczY=; b=so0XD83ILddimFFDvH/ww9ExkTa04P4JLVSsjgoOk6zsj/YdTTWLLjisuEOVj6wmgq 7hlACgE0sD4960cDf1rDdidE0G2CPsvDzFLLw+GEBz3gVwyZ9e2KV1I5FQ50GUBfSs7d 6cG/ig9oqUxprftIY+tTodfTs9Zv9G7BjWgZmGNefF3IOOxGc6J1LkxvxVY1Uu8LXT2M 3EDCUERXw8j20wJQycmUAKhXy1gpQAQjQhhigIhKR1qO8V0Zk67ZpQJSDkfG5+hTiePi HqzeRf47JA2eOSdQHRd04G/LTPrH5cBaVaafVpOxnCgDEvrqUPgVruvBx4TJKRDy2Wor NLSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y3NQqGi+; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a170902c40200b001b9fef6bf58si6150906plk.294.2023.08.07.10.14.48; Mon, 07 Aug 2023 10:15:01 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=Y3NQqGi+; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230223AbjHGQ4a (ORCPT + 99 others); Mon, 7 Aug 2023 12:56:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbjHGQ42 (ORCPT ); Mon, 7 Aug 2023 12:56:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDD4C19AF; Mon, 7 Aug 2023 09:56:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 79A0D61FB5; Mon, 7 Aug 2023 16:55:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CD06C433C8; Mon, 7 Aug 2023 16:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691427328; bh=WU3AeiqSRDkKCekepGZR4kr95/r5A21Ia8054t6T2ec=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Y3NQqGi+B4y/KPTi4YTTMJpZixaDzDrB70X+f+DCDBOWJl6H2ZNBdO0n1AeyWxgJi 4AjZffAdBLZH+6iv1WA/yETU8ipTXzrSFmHtx5EvwUx8ONAdHXcTIjd+RILAD+WqVd kvNWewKH0h3l0O03+5UeMobT9dBL3JSHQscCN4xds06zOpnQJSLS6Y0tIH7HR9md5P N7mjgGppNygMOFSCZCduREpb5r7JY78NSidBD6lJN3n3OktnlcwWhXQ/y6WwBKMZUO QIsvJ3sFcttsVrQc2mj2XvoR2Hoz+fOeTJuxO2x+iyP5itbuN5ksXEjy2FD8b2cxe8 eYrCsM4skQHJA== Date: Mon, 7 Aug 2023 09:55:26 -0700 From: Nathan Chancellor To: Nick Desaulniers Cc: Masahiro Yamada , Nicolas Schier , Tom Rix , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] Makefile.extrawarn: enable -Wmissing-variable-declarations for W=1 Message-ID: <20230807165526.GA2744968@dev-arch.thelio-3990X> References: <20230807-missing_proto-v1-1-7f566b7ba5ca@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230807-missing_proto-v1-1-7f566b7ba5ca@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 Mon, Aug 07, 2023 at 09:50:32AM -0700, Nick Desaulniers wrote: > I noticed Tom was sending patches where smatch was recommending > annotating functions as static when no previous declaration existed. > Surely the compiler could make such recommendations as well, I thought. > > Looks like -Wmissing-variable-declarations can make such > recommendations. > > GCC just added support for this warning (gcc 14.1.0 will ship with > support), and all versions of clang relevant to building the kernel > support this flag. > > Signed-off-by: Nick Desaulniers Any idea how many instances of this there are? At least x86_64 defconfig fails immediately with: In file included from scripts/mod/devicetable-offsets.c:3: In file included from include/linux/mod_devicetable.h:14: In file included from include/linux/uuid.h:11: In file included from include/linux/string.h:20: In file included from arch/x86/include/asm/string.h:5: In file included from arch/x86/include/asm/string_64.h:6: In file included from include/linux/jump_label.h:112: In file included from arch/x86/include/asm/jump_label.h:7: arch/x86/include/asm/asm.h:208:24: error: no previous extern declaration for non-static variable 'current_stack_pointer' [-Werror,-Wmissing-variable-declarations] 208 | register unsigned long current_stack_pointer asm(_ASM_SP); | ^ arch/x86/include/asm/asm.h:208:10: note: declare 'static' if the variable is not intended to be used outside of this translation unit 208 | register unsigned long current_stack_pointer asm(_ASM_SP); | ^ 1 error generated. > --- > scripts/Makefile.extrawarn | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn > index 40cd13eca82e..617739eb84e2 100644 > --- a/scripts/Makefile.extrawarn > +++ b/scripts/Makefile.extrawarn > @@ -32,6 +32,7 @@ KBUILD_CFLAGS += $(call cc-option, -Wunused-but-set-variable) > KBUILD_CFLAGS += $(call cc-option, -Wunused-const-variable) > KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned) > KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation) > +KBUILD_CFLAGS += $(call cc-option, -Wmissing-varibale-declarations) ^ variable > # The following turn off the warnings enabled by -Wextra > KBUILD_CFLAGS += -Wno-missing-field-initializers > KBUILD_CFLAGS += -Wno-sign-compare > > --- > base-commit: 52a93d39b17dc7eb98b6aa3edb93943248e03b2f > change-id: 20230807-missing_proto-0cb90ec6454c > > Best regards, > -- > Nick Desaulniers >