[dm-devel] [PATCH 15/15] Makefile.inc: Enable -Wextra and -Wformat-nonliteral

Xose Vazquez Perez xose.vazquez at gmail.com
Mon Oct 10 19:17:44 UTC 2016


Hi Bart,

With this patch, clang is emitting four new warnings:

> Instead of selecting some of the options enabled by -Wextra, enable
> -Wextra and disable some of the options enabled by -Wextra. Enable
> -Wformat-nonliteral.
>
> --- a/Makefile.inc
> +++ b/Makefile.inc
>  [...]
> -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.




More information about the dm-devel mailing list