Hello all,
I build qemu with fuzzing enabled using clang and following error come.
nbd/server.c:1937:1: error: unused function
'glib_listautoptr_cleanup_NBDExtentArray' [-Werror,-Wunused-function]
G_DEFINE_AUTOPTR_CLEANUP_FUNC(NBDExtentArray, nbd_extent_array_free);
^
/usr/include/glib-2.0/glib/gmacros.h:462:22: note: expanded from macro
'G_DEFINE_AUTOPTR_CLEANUP_FUNC'
static inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l) {
g_list_free_full (*_l, (GDestroyNotify) func); } \
^
/usr/include/glib-2.0/glib/gmacros.h:443:48: note: expanded from macro
'_GLIB_AUTOPTR_LIST_FUNC_NAME'
#define _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName)
glib_listautoptr_cleanup_##TypeName
^
<scratch space>:170:1: note: CC crypto/hash-glib.o
expanded from here
glib_listautoptr_cleanup_NBDExtentArray
^
nbd/server.c:1937:1: error: unused function
'glib_slistautoptr_cleanup_NBDExtentArray' [-Werror,-Wunused-function]
/usr/include/glib-2.0/glib/gmacros.h:463:22: note: expanded from macro
'G_DEFINE_AUTOPTR_CLEANUP_FUNC'
static inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) {
g_slist_free_full (*_l, (GDestroyNotify) func); } \
^
/usr/include/glib-2.0/glib/gmacros.h:445:49: note: expanded from macro
'_GLIB_AUTOPTR_SLIST_FUNC_NAME'
#define _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName)
glib_slistautoptr_cleanup_##TypeName
^
<scratch space>:171:1: note: expanded from here
glib_slistautoptr_cleanup_NBDExtentArray
I see Eric’s patch 9bda600b083(“build: Silence clang warning on older glib
autoptr usage”)
So I know there should be a ‘-Wno-unused-function’ in CFLAGS. It is after
./configure:
CFLAGS -g -Wno-unused-function
QEMU_CFLAGS -I/usr/include/pixman-1 -Werror -pthread
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE
-DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings
-Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99
-Wno-string-plus-int -Wno-typedef-redefinition -Wno-initializer-overrides
-Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value
-Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security
-Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition
-Wtype-limits -fstack-protector-strong -I$(SRC_PATH)/capstone/include
However while I ‘make V=1’ I see the build nbd/serer.c using following command:
clang-8 -iquote /home/test/qemu/nbd -iquote nbd -iquote
/home/test/qemu/tcg/i386 -isystem /home/test/qemu/linux-headers -isystem
/home/test/qemu/linux-headers -iquote . -iquote /home/test/qemu -iquote
/home/test/qemu/accel/tcg -iquote /home/test/qemu/include -iquote
/home/test/qemu/disas/libvixl -I/usr/include/pixman-1 -Werror -pthread
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE
-DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings
-Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99
-Wno-string-plus-int -Wno-typedef-redefinition -Wno-initializer-overrides
-Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value
-Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security
-Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition
-Wtype-limits -fstack-protector-strong -I/home/test/qemu/capstone/include
-I/home/test/qemu/tests -I/home/test/qemu/tests/qtest -MMD -MP -MT nbd/server.o
-MF nbd/server.d -fsanitize=address,fuzzer-no-link -c -o nbd/server.o
nbd/server.c
There’s no CFLAGS ‘-Wno-unused-function’.
So I want to know:
1. Wha’t the relation of CFLAGS and QEMU_CFLAGS, it seems the CFLAGS doesn’t
work in this.
2. Any hits to solve this? My env error or needs a patch?
I use following command in Ubuntu 18.04.1.
CC=clang-8 CXX=clang++-8 ./configure --target-list="i386-softmmu"
--enable-debug --enable-debug --enable-kvm --enable-fuzzing
Thanks,
Li Qiang