From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4ed3-0002z8-TS for qemu-devel@nongnu.org; Fri, 16 Sep 2011 16:03:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4ed2-00016C-CH for qemu-devel@nongnu.org; Fri, 16 Sep 2011 16:03:17 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:39199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4ed2-000161-1F for qemu-devel@nongnu.org; Fri, 16 Sep 2011 16:03:16 -0400 From: Stefan Weil Date: Fri, 16 Sep 2011 22:03:08 +0200 Message-Id: <1316203388-24910-3-git-send-email-weil@mail.berlios.de> In-Reply-To: <1316203388-24910-1-git-send-email-weil@mail.berlios.de> References: <1316203388-24910-1-git-send-email-weil@mail.berlios.de> Subject: [Qemu-devel] [PATCH 2/2] Fix and clean code which tests the gcc version List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The code which tests whether gcc supports warn_unused_result was wrong. Remove the wrong test from configure and replace it by code using macro QEMU_GNUC_PREREQ in compiler.h. Signed-off-by: Stefan Weil --- compiler.h | 2 +- configure | 20 -------------------- 2 files changed, 1 insertions(+), 21 deletions(-) diff --git a/compiler.h b/compiler.h index 3a9b8a1..a1c0794 100644 --- a/compiler.h +++ b/compiler.h @@ -18,7 +18,7 @@ #define QEMU_NORETURN __attribute__ ((__noreturn__)) -#ifdef CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT +#if QEMU_GNUC_PREREQ(3, 4) #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #else #define QEMU_WARN_UNUSED_RESULT diff --git a/configure b/configure index ad924c4..129c427 100755 --- a/configure +++ b/configure @@ -2358,23 +2358,6 @@ if compile_prog "" "" ; then need_offsetof=no fi -########################################## -# check if the compiler understands attribute warn_unused_result -# -# This could be smarter, but gcc -Werror does not error out even when warning -# about attribute warn_unused_result - -gcc_attribute_warn_unused_result=no -cat > $TMPC << EOF -#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4) -#error gcc 3.3 or older -#endif -int main(void) { return 0;} -EOF -if compile_prog "" ""; then - gcc_attribute_warn_unused_result=yes -fi - # spice probe if test "$spice" != "no" ; then cat > $TMPC << EOF @@ -2997,9 +2980,6 @@ fi if test "$need_offsetof" = "yes" ; then echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak fi -if test "$gcc_attribute_warn_unused_result" = "yes" ; then - echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak -fi if test "$fdatasync" = "yes" ; then echo "CONFIG_FDATASYNC=y" >> $config_host_mak fi -- 1.7.2.5