Skip to contentSkip to conversation

Makefile.inc: Enable -Wextra and -Wformat-nonliteral

PATCH Xose Vazquez Perez 2 participants 3 messages Oct 10, 2016 Device mapper

lore
Share & tools
lore
#0 lore raw

Hi Bart,

With this patch, clang is emitting four new warnings:

Makefile.inc

Quoted 13 lines

Instead of selecting some of the options enabled by -Wextra, enable

(quoted diff) +0 -2
-Wextra and disable some of the options enabled by -Wextra. Enable
-Wformat-nonliteral.
Makefile.inc +4 -2
[...]
-OPTFLAGS	= -Wunused -Wstrict-prototypes -O2 -g -pipe -Wformat-security -Wall \
-		  -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4
+OPTFLAGS	= -O2 -g -pipe -Wall -Wextra -Wformat=2 \
+		  -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered\
+		  -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector \
+		  --param=ssp-buffer-size=4

clang -O2 -g -pipe -Wall -Wextra -Wformat=2 -Wno-sign-compare -Wno-unused-parameter -fstack-protector --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -I../libmpathcmd -DUSE_SYSTEMD=229 -DLIBDM_API_FLUSH -D_GNU_SOURCE -DLIBDM_API_COOKIE -DLIBUDEV_API_RECVBUF -DLIBDM_API_DEFERRED -c -o devmapper.o devmapper.c
devmapper.c:86:20: warning: format string is not a string literal [-Wformat-nonliteral]

                vfprintf(stdout, f, ap);
                                 ^

1 warning generated.

clang -O2 -g -pipe -Wall -Wextra -Wformat=2 -Wno-sign-compare -Wno-unused-parameter -fstack-protector --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -I../libmpathcmd -DUSE_SYSTEMD=229 -DLIBDM_API_FLUSH -D_GNU_SOURCE -DLIBDM_API_COOKIE -DLIBUDEV_API_RECVBUF -DLIBDM_API_DEFERRED -c -o debug.o debug.c
debug.c:41:21: warning: format string is not a string literal [-Wformat-nonliteral]

                        vfprintf(stdout, fmt, ap);
                                         ^~~

1 warning generated.

clang -O2 -g -pipe -Wall -Wextra -Wformat=2 -Wno-sign-compare -Wno-unused-parameter -fstack-protector --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -I../libmpathcmd -DUSE_SYSTEMD=229 -DLIBDM_API_FLUSH -D_GNU_SOURCE -DLIBDM_API_COOKIE -DLIBUDEV_API_RECVBUF -DLIBDM_API_DEFERRED -c -o log_pthread.o log_pthread.c log_pthread.c:28:17: warning: format string is not a string literal [-Wformat-nonliteral]

                vsyslog(prio, fmt, ap);
                              ^~~

1 warning generated.

clang -O2 -g -pipe -Wall -Wextra -Wformat=2 -Wno-sign-compare -Wno-unused-parameter -fstack-protector --param=ssp-buffer-size=4 -fPIC -DLIB_STRING=\"lib64\" -DRUN_DIR=\"run\" -I../libmpathcmd -DUSE_SYSTEMD=229 -DLIBDM_API_FLUSH -D_GNU_SOURCE -DLIBDM_API_COOKIE -DLIBUDEV_API_RECVBUF -DLIBDM_API_DEFERRED -c -o log.o log.c
log.c:121:32: warning: format string is not a string literal [-Wformat-nonliteral]

        vsnprintf(buff, MAX_MSG_SIZE, fmt, ap);
                                      ^~~

1 warning generated.