lkml.org 
[lkml]   [2011]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kbuild: Add extra gcc checks
> 
> diff --git a/Makefile b/Makefile
> index c9c8c8f..03989a1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -102,6 +102,15 @@ ifeq ("$(origin O)", "command line")
> KBUILD_OUTPUT := $(O)
> endif
>
> +ifeq ("$(origin W)", "command line")
> + KBUILD_ENABLE_EXTRA_GCC_CHECKS = 1
> +endif
> +ifndef KBUILD_ENABLE_EXTRA_GCC_CHECKS
> + KBUILD_ENABLE_EXTRA_GCC_CHECKS = 0
> +endif

I do not see the purpose of setting KBUILD_ENABLE_EXTRA_GCC_CHECKS
equal to 0.

> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 4eb99ab..5bf9f40 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -30,6 +30,33 @@ ldflags-y :=
> subdir-asflags-y :=
> subdir-ccflags-y :=
>
> +# make W=1 settings
> +ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS

The symbol KBUILD_ENABLE_EXTRA_GCC_CHECKS is always defined,
as you set it to "0" in the top-level Makefile.
So you will always have the extra checks enabled.

You also need to move the assignments down.
As it is now any kbuild file that assign
EXTRA_CFLAGS with

EXTRA_CFLAGS := -D DEBUG

Will drop all the extra warnings.

From Makefile.build:
# If the save-* variables changed error out
ifeq ($(KBUILD_NOPEDANTIC),)
ifneq ("$(save-cflags)","$(CFLAGS)")
$(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS)
endif
endif

<<<<< Here would be the better place to add this.

include scripts/Makefile.lib

> +EXTRA_CFLAGS += -Wextra -Wno-unused

Use of EXTRA_CFLAGS is deprecated - so that is not the right choice.
I suggest to use KBUILD_CFLAGS that is an KBUILD internal variable.

Sam


\
 
 \ /
  Last update: 2011-02-20 21:23    [W:0.096 / U:0.400 seconds]
©2003-2014 Jasper Spaans. Advertise on this site