qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Li Qiang <liq3ea@163.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"eblake@redhat.com" <eblake@redhat.com>,
	"liq3ea@gmail.com" <liq3ea@gmail.com>,
	Alexander Bulekov <alxndr@bu.edu>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Bandan Das <bsd@redhat.com>
Subject: Re: build error of unused function as MACRO G_DEFINE_AUTOPTR_CLEANUP_FUNC expand
Date: Wed, 8 Jul 2020 18:50:29 +0200	[thread overview]
Message-ID: <b02161d0-a027-5018-af05-8ccbc5c90cc9@redhat.com> (raw)
In-Reply-To: <5F05E942.FB9110.20278@mail-m971.mail.163.com>

Cc'ing the fuzzing maintainers.

On 7/8/20 5:41 PM, Li Qiang wrote:
> 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
> 



  reply	other threads:[~2020-07-08 22:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 15:41 build error of unused function as MACRO G_DEFINE_AUTOPTR_CLEANUP_FUNC expand Li Qiang
2020-07-08 16:50 ` Philippe Mathieu-Daudé [this message]
2020-07-08 19:23   ` Alexander Bulekov
2020-07-08 19:39     ` Philippe Mathieu-Daudé
2020-07-08 20:06     ` Alexander Bulekov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b02161d0-a027-5018-af05-8ccbc5c90cc9@redhat.com \
    --to=philmd@redhat.com \
    --cc=alxndr@bu.edu \
    --cc=bsd@redhat.com \
    --cc=eblake@redhat.com \
    --cc=liq3ea@163.com \
    --cc=liq3ea@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).