Skip to contentSkip to conversation

replacing -Wextra with -W

PATCH In review Cyril Hrubis 2 participants 4 messages Nov 5, 2009 – Nov 9, 2009 5 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 replacing -Wextra with -W

Hi!
Lately gcc developers introduced -Wextra flag that does the same as -W but is more descriptive. According to this using -W flag should be safe (as gcc is backward compatlible) but using -Wextra is limited to newer gcc releases.

Attached patch replaces all -Wextra occurences with -W and thus fixes compliation failures with older gcc (mine was gcc-3.3.3 on sles).

Signed-off-by [email protected]
Signature · 2 lines
Cyril Hrubis
[email protected]
testcases/kernel/controllers/cpuctl_fj/Makefile +1 -1
Index: delme/testcases/kernel/controllers/cpuctl_fj/Makefile
===================================================================
@@ -25,7 +25,7 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 
-CPPFLAGS		+= -Wall -O2 -Wextra
+CPPFLAGS		+= -Wall -O2 -W
 
 INSTALL_TARGETS		:= *.sh
 
testcases/kernel/device-drivers/v4l/kernel_space/Makefile +1 -1
Index: delme/testcases/kernel/device-drivers/v4l/kernel_space/Makefile
===================================================================
@@ -1,5 +1,5 @@
 
-EXTRA_CFLAGS += -Wall -Wextra -Wno-unused-parameter
+EXTRA_CFLAGS += -Wall -W -Wno-unused-parameter
 
 ifneq ($(KERNELRELEASE),)
 
testcases/kernel/device-drivers/v4l/user_space/Makefile +1 -1
Index: delme/testcases/kernel/device-drivers/v4l/user_space/Makefile
===================================================================
@@ -33,7 +33,7 @@
 # Released under GPL
 #
 
-CFLAGS = -O2 -Wall -Wextra
+CFLAGS = -O2 -Wall -W
 #CFLAGS += -g
 LDFLAGS = -lcunit
 
testcases/kernel/device-drivers/acpi/Makefile +1 -1
Index: delme/testcases/kernel/device-drivers/acpi/Makefile
===================================================================
@@ -6,7 +6,7 @@
 #
 
 #KERNELDIR := /usr/src/linux-2.5.64-gcov
-EXTRA_CFLAGS := -Wall -g -Wextra -Wno-unused-parameter
+EXTRA_CFLAGS := -Wall -g -W -Wno-unused-parameter
 
 ifneq ($(KERNELRELEASE),)
 
testcases/kernel/device-drivers/block/kernel_space/Makefile +1 -1
Index: delme/testcases/kernel/device-drivers/block/kernel_space/Makefile
===================================================================
@@ -1,5 +1,5 @@
 
-EXTRA_CFLAGS += -Wall -Wextra -Wno-unused-parameter
+EXTRA_CFLAGS += -Wall -W -Wno-unused-parameter
 
 ifneq ($(KERNELRELEASE),)
 
testcases/kernel/device-drivers/misc_modules/per_cpu_allocator_module/Makefile +1 -1
Index: delme/testcases/kernel/device-drivers/misc_modules/per_cpu_allocator_module/Makefile
===================================================================
@@ -1,5 +1,5 @@
 
-EXTRA_CFLAGS += -Wall -Wextra -Wno-unused-parameter
+EXTRA_CFLAGS += -Wall -W -Wno-unused-parameter
 
 ifneq ($(KERNELRELEASE),)
 
testcases/kernel/device-drivers/nls/Makefile +1 -1
Index: delme/testcases/kernel/device-drivers/nls/Makefile
===================================================================
@@ -2,7 +2,7 @@
 # Makefile for GCOV profiling kernel module
 #
 
-EXTRA_CFLAGS := -Wall -Wextra -Wno-unused-parameter
+EXTRA_CFLAGS := -Wall -W -Wno-unused-parameter
 
 ifneq ($(KERNELRELEASE),)
 
testcases/kernel/device-drivers/tbio/user_space/Makefile +1 -1
Index: delme/testcases/kernel/device-drivers/tbio/user_space/Makefile
===================================================================
@@ -1,5 +1,5 @@
 
-CFLAGS += -O2 -Wall -Wextra -g
+CFLAGS += -O2 -Wall -W -g
 OBJS = tbio_ki.o user_tbio.o
 
 test_bio: $(OBJS)
testcases/kernel/device-drivers/usb/tusb/Makefile +1 -1
Index: delme/testcases/kernel/device-drivers/usb/tusb/Makefile
===================================================================
@@ -3,7 +3,7 @@
 #
 
 #KERNELDIR := /usr/src/linux-2.5.64-gcov
-EXTRA_CFLAGS := -Wall -Wextra -Wno-unused-parameter
+EXTRA_CFLAGS := -Wall -W -Wno-unused-parameter
 
 ifneq ($(KERNELRELEASE),)
 
testcases/kernel/controllers/cgroup_fj/Makefile +1 -1
Index: delme/testcases/kernel/controllers/cgroup_fj/Makefile
===================================================================
@@ -25,7 +25,7 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 
-CPPFLAGS		+= -Wall -O2 -Wextra
+CPPFLAGS		+= -Wall -O2 -W
 
 INSTALL_TARGETS		:= *.sh
 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi!

Quoted 5 lines
Quoted 5 lines

Lately gcc developers introduced -Wextra flag that does the same as -W but
is more descriptive. According to this using -W flag should be safe (as gcc is backward compatlible) but using -Wextra is limited to newer gcc releases.

Quoted 9 lines
Quoted 2 lines

Attached patch replaces all -Wextra occurences with -W and thus fixes compliation failures with older gcc (mine was gcc-3.3.3 on sles).

it'd be better if we had configure tests for -W flags, but that would take a bit more effort, and i dont think it should preclude applying your patch. however, please make this change first:
- integrated Makefiles shouldnt be setting flags at all, so just delete the
whole line in testcases/kernel/controllers/{cpuctl,cgroup}_fj/Makefile

Patch that should be applied over the previous one attached.

Signature · 2 lines
Cyril Hrubis
[email protected]
testcases/kernel/controllers/cpuctl_fj/Makefile +0 -2
Index: delme/testcases/kernel/controllers/cpuctl_fj/Makefile
===================================================================
@@ -25,8 +25,6 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 
-CPPFLAGS		+= -Wall -O2 -W
-
 INSTALL_TARGETS		:= *.sh
 
 LDLIBS			+= -lm
testcases/kernel/controllers/cgroup_fj/Makefile +0 -2
Index: delme/testcases/kernel/controllers/cgroup_fj/Makefile
===================================================================
@@ -25,8 +25,6 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 
-CPPFLAGS		+= -Wall -O2 -W
-
 INSTALL_TARGETS		:= *.sh
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/controllers/cpuacct/Makefile +0 -2
Index: delme/testcases/kernel/controllers/cpuacct/Makefile
===================================================================
@@ -25,8 +25,6 @@ top_srcdir		?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 
-CPPFLAGS		+= -Wall
-
 INSTALL_TARGETS		:= *.sh
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/io/disktest/Makefile +1 -1
Index: delme/testcases/kernel/io/disktest/Makefile
===================================================================
@@ -188,7 +188,7 @@ include $(top_srcdir)/include/mk/env_pre
 
 VER		:= `grep VER_STR $(abs_srcdir)/main.h | awk -F\" '{print $$2}'`
 
-CPPFLAGS	+= -g -Wall -O -DLINUX -D_THREAD_SAFE -D_GNU_SOURCE -D_LARGE_FILES -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $(RPM_OPT_FLAGS)
+CPPFLAGS	+= -g -O -DLINUX -D_THREAD_SAFE -D_GNU_SOURCE -D_LARGE_FILES -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $(RPM_OPT_FLAGS)
 
 DISTRO_FILES	:= Makefile* *.[ch] LICENSE README CHANGELOG
 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 10 lines · On Friday 06 November 2009 17:53:56 Garrett Cooper wrote:
Quoted 6 lines · Mike Frysinger

some of the Makefiles Cyril highlighted havent been converted to the common .mk framework. we could cheat and just pull in config.mk fo some, but for others (ones that build kernel modules), i'm not sure that will work. linux' kbuild gets pissy if you try to tweak build flags like CFLAGS/CPPFLAGS. so we might have to create a new .mk target specifically for kernel modules that takes care of these details.

I was avoiding those Makefiles because they require kernel build tools and it requires some adjusting to get them to work.

np. i guess i can take a look.
-mike

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#8 lore raw
In reply to a message not in the archive

Hi!

Quoted 25 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 8 lines

Lately gcc developers introduced -Wextra flag that does the same as -W but is more descriptive. According to this using -W flag should be safe (as gcc is backward compatlible) but using -Wextra is limited to newer gcc releases.

Attached patch replaces all -Wextra occurences with -W and thus fixes compliation failures with older gcc (mine was gcc-3.3.3 on sles).

it'd be better if we had configure tests for -W flags, but that would take a bit more effort, and i dont think it should preclude applying your patch. however, please make this change first:
- integrated Makefiles shouldnt be setting flags at all, so just
delete the whole line in testcases/kernel/controllers/{cpuctl,cgroup}_fj/Makefile

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Patch that should be applied over the previous one attached.

thanks, ive merged the two and added to the tree. hopefully i didnt screw anything up in the (simple) process ;).

It looks fine from my end :]. We should really restrict the -W*
flag setting to include/mk/config.mk like you suggested though, so maybe we should clean up all of the Makefiles in one shot.

Quoted 6 lines

some of the Makefiles Cyril highlighted havent been converted to the common .mk framework. we could cheat and just pull in config.mk fo some, but for others (ones that build kernel modules), i'm not sure that will work. linux' kbuild gets pissy if you try to tweak build flags like CFLAGS/CPPFLAGS. so we might have to create a new .mk target specifically for kernel modules that takes care of these details.

In these I've only replaced -Wextra with -W. Is there any way this could broke them?

Signature · 12 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list