On 27/10/20 15:46, Valdis Klētnieks wrote:
> This died a horrid death on my laptop when building with W=1.
> 
>   CC      arch/x86/kvm/mmu/tdp_iter.o
> In file included from arch/x86/kvm/mmu/tdp_iter.c:5:
> arch/x86/kvm/mmu/spte.h:120:18: error: 'shadow_nonpresent_or_rsvd_mask_len' 
> defined but not used [-Werror=unused-const-variable=]
>   120 | static const u64 shadow_nonpresent_or_rsvd_mask_len = 5;
>       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> arch/x86/kvm/mmu/spte.h:115:18: error: 'shadow_acc_track_saved_bits_shift' 
> defined but not used [-Werror=unused-const-variable=]
>   115 | static const u64 shadow_acc_track_saved_bits_shift = 
> PT64_SECOND_AVAIL_BITS_SHIFT;
>       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> arch/x86/kvm/mmu/spte.h:113:18: error: 'shadow_acc_track_saved_bits_mask' 
> defined but not used [-Werror=unused-const-variable=]
>   113 | static const u64 shadow_acc_track_saved_bits_mask = 
> PT64_EPT_READABLE_MASK |
>       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[2]: *** [scripts/Makefile.build:283: arch/x86/kvm/mmu/tdp_iter.o] Error 1
> make[1]: *** [scripts/Makefile.build:500: arch/x86/kvm] Error 2
> make: *** [Makefile:1799: arch/x86] Error 2
> 
> Do we really need to define 3 static variables in every .c file that includes
> this .h file, directly or not?

I'd expect the compiler to get rid of them, but I will change them to
#defines to fix the warnings.

Paolo

Reply via email to