Skip to contentSkip to conversation

The rocky road to building with -Wextra

PATCH In review Emil Velikov 2 participants 7 messages Feb 23, 2015 – Feb 25, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover The rocky road to building with -Wextra

Hi all,

A few small patches, that handle the initial step of building the whole of libdrm with WARN_CFLAGS (-Wall -Wextra and friends).

The first patch makes sure we build everything at make distcheck time, followed by a couple of warnings-turned-errors, and finally adding the cflags everywhere in the project.

Individual fixes for the 66 warnings will follow up in due time :-)

Thanks
Emil

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

PATCH 1/4 autotools: add AM_DISTCHECK_CONFIGURE_FLAGS

To make sure that the release/distribution tarball is not broken for all the targets. Currently the experimental APIs are disabled by default amongst others.

---
 Makefile.am | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
Makefile.am +16 -0
index 3cb516c..062feb4 100644
@@ -22,6 +22,22 @@ include Makefile.sources
 
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 
+AM_DISTCHECK_CONFIGURE_FLAGS = \
+	--enable-udev \
+	--enable-libkms \
+	--enable-intel \
+	--enable-radeon \
+	--enable-nouveau \
+	--enable-vmwgfx \
+	--enable-omap-experimental-api \
+	--enable-exynos-experimental-api \
+	--enable-freedreno \
+	--enable-freedreno-kgsl\
+	--enable-tegra-experimental-api \
+	--enable-install-test-programs \
+	--enable-cairo-tests \
+	--enable-manpages
+
 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm.pc
 
Signature · 6 lines
2.3.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 2/4 exynos_fimg2d_test: fix implicit funciton declaration errors

In reply to Emil Velikov

As one adds WARN_CFLAGS to the build the compiler throws a couple of lovely error messages. Add the relevant includes to fix them.

error: implicit declaration of function ‘time’
error: implicit declaration of function ‘getopt’

Cc Inki Dae <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 tests/exynos/exynos_fimg2d_test.c | 2 ++
 1 file changed, 2 insertions(+)
tests/exynos/exynos_fimg2d_test.c +2 -0
index c6bd558..f141964 100644
@@ -18,6 +18,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
+#include <time.h>
+#include <unistd.h>
 
 #include <sys/mman.h>
 #include <linux/stddef.h>
Signature · 6 lines
2.3.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH 3/4 tests: fix implicit funciton declaration errors

In reply to Emil Velikov

ioctl() and strcmp() were used without the relevent header being included.

---
 tests/auth.c         | 1 +
 tests/getclient.c    | 1 +
 tests/getstats.c     | 1 +
 tests/lock.c         | 1 +
 tests/name_from_fd.c | 1 +
 tests/setversion.c   | 1 +
 tests/updatedraw.c   | 1 +
 7 files changed, 7 insertions(+)
tests/auth.c +1 -0
index 9b6fca9..9147b11 100644
@@ -26,6 +26,7 @@
  */
 
 #include <limits.h>
+#include <sys/ioctl.h>
 #include "drmtest.h"
 
 enum auth_event {
tests/getclient.c +1 -0
index 349c16e..481ce11 100644
@@ -26,6 +26,7 @@
  */
 
 #include <limits.h>
+#include <sys/ioctl.h>
 #include "drmtest.h"
 
 /**
tests/getstats.c +1 -0
index bd55b12..8d40d0b 100644
@@ -26,6 +26,7 @@
  */
 
 #include <limits.h>
+#include <sys/ioctl.h>
 #include "drmtest.h"
 
 /**
tests/lock.c +1 -0
index 86caa28..365681b 100644
@@ -30,6 +30,7 @@
  */
 
 #include <limits.h>
+#include <sys/ioctl.h>
 #include "drmtest.h"
 
 enum auth_event {
tests/name_from_fd.c +1 -0
index 330c8ff..e3db413 100644
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <limits.h>
+#include <string.h>
 #include "drmtest.h"
 
 /**
tests/setversion.c +1 -0
index 5a5d01c..2f7b529 100644
@@ -27,6 +27,7 @@
 
 #include <limits.h>
 #include <string.h>
+#include <sys/ioctl.h>
 #include "drmtest.h"
 
 /**
tests/updatedraw.c +1 -0
index a61eb15..8e0b94b 100644
@@ -25,6 +25,7 @@
  *
  */
 
+#include <sys/ioctl.h>
 #include "drmtest.h"
 
 static void
Signature · 6 lines
2.3.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

PATCH 4/4 autotools: add WARN_CFLAGS to all targets

In reply to Emil Velikov

... minus test/ttmtest. The latter is not really hooked up with the actual build.

This will give us 66 warnings on a distribution build of which
- 12 -Wunused-variable
- 11 -Wunused-function
- 19 -Wmissing-prototypes
and a few -Wswitch-enum, -Wtype-limits etc.

Adding the CFLAGS gives some exposure to these so that we can fix them.

---
 Makefile.am                 | 1 +
 tests/Makefile.am           | 3 ++-
 tests/exynos/Makefile.am    | 1 +
 tests/kmstest/Makefile.am   | 1 +
 tests/modeprint/Makefile.am | 1 +
 tests/proptest/Makefile.am  | 1 +
 tests/radeon/Makefile.am    | 1 +
 tests/tegra/Makefile.am     | 2 +-
 tests/vbltest/Makefile.am   | 2 ++
 9 files changed, 11 insertions(+), 2 deletions(-)
Makefile.am +1 -0
index 062feb4..9514cc5 100644
@@ -82,6 +82,7 @@ libdrm_la_LIBADD = @CLOCK_LIB@
 
 libdrm_la_CPPFLAGS = -I$(top_srcdir)/include/drm
 AM_CFLAGS = \
+	$(WARN_CFLAGS) \
 	$(VALGRIND_CFLAGS)
 
 libdrm_la_SOURCES = $(LIBDRM_FILES)
tests/Makefile.am +2 -1
index 37b8d3a..f989d8e 100644
@@ -1,6 +1,7 @@
 NULL:=#
 
-AM_CPPFLAGS = \
+AM_CFLAGS = \
+	$(WARN_CFLAGS)\
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)
 
tests/exynos/Makefile.am +1 -0
index 92de4e4..b21d016 100644
@@ -1,4 +1,5 @@
 AM_CFLAGS = \
+	$(WARN_CFLAGS)\
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)/libkms/ \
 	-I $(top_srcdir)/exynos \
tests/kmstest/Makefile.am +1 -0
index 7903a26..fd21e61 100644
@@ -1,4 +1,5 @@
 AM_CFLAGS = \
+	$(WARN_CFLAGS)\
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)/libkms/ \
 	-I$(top_srcdir)
tests/modeprint/Makefile.am +1 -0
index 6420ef3..895805f 100644
@@ -1,4 +1,5 @@
 AM_CFLAGS = \
+	$(WARN_CFLAGS)\
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)
 
tests/proptest/Makefile.am +1 -0
index f81a3c0..48a84c1 100644
@@ -1,4 +1,5 @@
 AM_CFLAGS = \
+	$(WARN_CFLAGS)\
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)
 
tests/radeon/Makefile.am +1 -0
index 1775669..d18620d 100644
@@ -1,4 +1,5 @@
 AM_CFLAGS = \
+	$(WARN_CFLAGS)\
 	-I $(top_srcdir)/include/drm \
 	-I $(top_srcdir)
 
tests/tegra/Makefile.am +1 -1
index ca63d92..8e625c8 100644
@@ -3,7 +3,7 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/tegra \
 	-I$(top_srcdir)
 
-AM_CFLAGS = -Wall -Werror
+AM_CFLAGS = $(WARN_CFLAGS)
 
 LDADD = \
 	../../tegra/libdrm_tegra.la \
tests/vbltest/Makefile.am +2 -0
index 34a35e7..4d87887 100644
@@ -1,6 +1,8 @@
 AM_CFLAGS = \
+	$(WARN_CFLAGS)\
 	-I$(top_srcdir)/include/drm \
 	-I$(top_srcdir)
+
 if HAVE_INSTALL_TESTS
 bin_PROGRAMS = \
 	vbltest
Signature · 6 lines
2.3.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw
In reply to Emil Velikov
Quoted 11 lines · Emil Velikov

Hi all,

A few small patches, that handle the initial step of building the whole of libdrm with WARN_CFLAGS (-Wall -Wextra and friends).

The first patch makes sure we build everything at make distcheck time, followed by a couple of warnings-turned-errors, and finally adding the cflags everywhere in the project.

Individual fixes for the 66 warnings will follow up in due time :-)

Hi Jan,

Slightly forgot that you're not subscribed to the list. Considering your earlier work on this can you take a look at the series please.

This lays the groundwork, and a later one [1] nukes some of the warnings.

Thank
Emil

[1] http://lists.freedesktop.org/archives/dri-devel/2015-February/077976.html
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by
#6 lore raw
Quoted 10 lines · Emil Velikov
Quoted 9 lines · Emil Velikov

Hi all,

A few small patches, that handle the initial step of building the whole of libdrm with WARN_CFLAGS (-Wall -Wextra and friends).

The first patch makes sure we build everything at make distcheck time, followed by a couple of warnings-turned-errors, and finally adding the cflags everywhere in the project.

Quoted 8 lines
Quoted 2 lines

Individual fixes for the 66 warnings will follow up in due time :-)

Hi Jan,

Slightly forgot that you're not subscribed to the list. Considering your earlier work on this can you take a look at the series please.

This lays the groundwork, and a later one [1] nukes some of the warnings.

Hi,

I'm now subscribed to the list, but I somehow missed the series. The changes are pretty straightforward. You can add

I'll try to find some time to take a look at the other series too.

jan

Quoted 5 lines

Thank
Emil

[1] http://lists.freedesktop.org/archives/dri-devel/2015-February/077976.html

Signature · 1 line
Jan Vesely <[email protected]>

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel