[all-commits] [llvm/llvm-project] a22d38: [Sema] Do not emit -Wmissing-variable-declarations...

Nathan Chancellor via All-commits all-commits at lists.llvm.org
Tue Aug 8 13:42:06 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a22d385f9656c95f5ce4155ea705aab6f8ef6d82
      https://github.com/llvm/llvm-project/commit/a22d385f9656c95f5ce4155ea705aab6f8ef6d82
  Author: Nathan Chancellor <nathan at kernel.org>
  Date:   2023-08-08 (Tue, 08 Aug 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaDecl.cpp
    A clang/test/Sema/warn-missing-variable-declarations-register.c

  Log Message:
  -----------
  [Sema] Do not emit -Wmissing-variable-declarations for register variables

When building the Linux kernel with -Wmissing-variable-declarations,
there are several instances of warnings around variables declared with
register storage:

  arch/x86/include/asm/asm.h:208:24: warning: no previous extern declaration for non-static variable 'current_stack_pointer' [-Wmissing-variable-declarations]
  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
  register unsigned long current_stack_pointer asm(_ASM_SP);
           ^
  1 warning generated.

The suggestion is invalid, as the variable cannot have both static and
register storage. Do not emit -Wmissing-variable-declarations for
register variables.

Closes: https://github.com/llvm/llvm-project/issues/64509
Link: https://lore.kernel.org/202308081050.sZEw4cQ5-lkp@intel.com/
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110947

Reviewed By: aaron.ballman, nickdesaulniers

Differential Revision: https://reviews.llvm.org/D157435




More information about the All-commits mailing list