From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by sourceware.org (Postfix) with ESMTPS id 64BE73858D28 for ; Tue, 15 Mar 2022 16:22:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 64BE73858D28 Received: by mail-pj1-x1029.google.com with SMTP id z12-20020a17090ad78c00b001bf022b69d6so2903730pju.2 for ; Tue, 15 Mar 2022 09:22:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PdtZsiN+W/POWVE4wwL/M1V0BaoyiaihbJ8zgVxYg8I=; b=KA9utNUxYs/obKZ/JTNyjMC/jSe3g2iaFn6E7TnaSwDZf2wvzpMExdSOOH1OOkFfVP TTd94kA8zG7qti+T/Sq1okRH5F6WHaVbNy9jLDfK4ou4LMDmM2rmYkqTABOfDIFGUbYi ljlfytnqKEwE0bbNy7ByrS+lSUpW3llYTUut578de/tPj6sMzhFgzW+5wyLNwpd8dcjt XICY4TS7nGzN9P6Mf072qDAIbnrb87KrDfxUAdofDwLONsQKpapb0ZLG7MGC3Mtfj7Uj cIVnsaxUf2S22QAgMdny6/dRKvGicMBtouF06PYZ4Et2ht2ivSLXwP7Yy1pD98PsJm6S K7FQ== X-Gm-Message-State: AOAM532x3/yRv1l6M1Jp0FLeaiitbphc/B1eWpCWbZY2DpjDN7JB9Q6G eqV5HqnxhpYyr4KMvUlbz7j57OoxMfs= X-Google-Smtp-Source: ABdhPJw6toij2djvA5K6Ik548jcU/OJjAwb2BQ6Y/hPA8NKj38Jdsndc1lsPTBQPcnBYobATLBM15Q== X-Received: by 2002:a17:90b:1bc3:b0:1bf:68ec:a26d with SMTP id oa3-20020a17090b1bc300b001bf68eca26dmr5549993pjb.109.1647361327318; Tue, 15 Mar 2022 09:22:07 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.58.35.176]) by smtp.gmail.com with ESMTPSA id 67-20020a630846000000b00372782a65d0sm22247229pgi.60.2022.03.15.09.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Mar 2022 09:22:05 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 63B03C055A; Tue, 15 Mar 2022 09:22:04 -0700 (PDT) From: "H.J. Lu" To: binutils@sourceware.org Subject: [PATCH 2/3] gprofng: Don't hardcode -Wno-nonnull-compare Date: Tue, 15 Mar 2022 09:22:03 -0700 Message-Id: <20220315162204.2659495-3-hjl.tools@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220315162204.2659495-1-hjl.tools@gmail.com> References: <20220315162204.2659495-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3028.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2022 16:22:11 -0000 Use -Wno-nonnull-compare only if it is supported. PR gprof/28969 * libcollector/Makefile.am (AM_CFLAGS): Replace -Wno-nonnull-compare with GPROFNG_NO_NONNULL_COMPARE_CFLAGS. * libcollector/configure.ac (GPROFNG_NO_NONNULL_COMPARE_CFLAGS): New AC_SUBST for -Wno-nonnull-compare. * libcollector/Makefile.in: Regenerate. * libcollector/aclocal.m4: Likewise. * libcollector/configure: Likewise. --- gprofng/libcollector/Makefile.am | 2 +- gprofng/libcollector/Makefile.in | 3 +- gprofng/libcollector/aclocal.m4 | 1 + gprofng/libcollector/configure | 64 ++++++++++++++++++++++++++++++- gprofng/libcollector/configure.ac | 3 ++ 5 files changed, 69 insertions(+), 4 deletions(-) diff --git a/gprofng/libcollector/Makefile.am b/gprofng/libcollector/Makefile.am index bd86e97753d..2827963b7ed 100644 --- a/gprofng/libcollector/Makefile.am +++ b/gprofng/libcollector/Makefile.am @@ -41,7 +41,7 @@ CSOURCES = \ collector.c \ $(NULL) -AM_CFLAGS = $(GPROFNG_CFLAGS) -Wno-nonnull-compare +AM_CFLAGS = $(GPROFNG_CFLAGS) $(GPROFNG_NO_NONNULL_COMPARE_CFLAGS) AM_CPPFLAGS = $(GPROFNG_CPPFLAGS) -I.. -I$(srcdir) \ -I$(srcdir)/../common -I$(srcdir)/../src \ -I$(srcdir)/../../include diff --git a/gprofng/libcollector/Makefile.in b/gprofng/libcollector/Makefile.in index 920c7a7ad11..3e5030d76ad 100644 --- a/gprofng/libcollector/Makefile.in +++ b/gprofng/libcollector/Makefile.in @@ -322,6 +322,7 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GPROFNG_NO_NONNULL_COMPARE_CFLAGS = @GPROFNG_NO_NONNULL_COMPARE_CFLAGS@ GPROFNG_VARIANT = @GPROFNG_VARIANT@ GREP = @GREP@ INSTALL = @INSTALL@ @@ -435,7 +436,7 @@ CSOURCES = \ collector.c \ $(NULL) -AM_CFLAGS = $(GPROFNG_CFLAGS) -Wno-nonnull-compare +AM_CFLAGS = $(GPROFNG_CFLAGS) $(GPROFNG_NO_NONNULL_COMPARE_CFLAGS) AM_CPPFLAGS = $(GPROFNG_CPPFLAGS) -I.. -I$(srcdir) \ -I$(srcdir)/../common -I$(srcdir)/../src \ -I$(srcdir)/../../include diff --git a/gprofng/libcollector/aclocal.m4 b/gprofng/libcollector/aclocal.m4 index b269c739e73..2d13dba8c20 100644 --- a/gprofng/libcollector/aclocal.m4 +++ b/gprofng/libcollector/aclocal.m4 @@ -1230,6 +1230,7 @@ AC_SUBST([am__untar]) m4_include([../../config/depstand.m4]) m4_include([../../config/lead-dot.m4]) m4_include([../../config/override.m4]) +m4_include([../../config/warnings.m4]) m4_include([../../libtool.m4]) m4_include([../../ltoptions.m4]) m4_include([../../ltsugar.m4]) diff --git a/gprofng/libcollector/configure b/gprofng/libcollector/configure index ed23350d7b6..40ab929857b 100755 --- a/gprofng/libcollector/configure +++ b/gprofng/libcollector/configure @@ -633,6 +633,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +GPROFNG_NO_NONNULL_COMPARE_CFLAGS GPROFNG_VARIANT CXXCPP OTOOL64 @@ -12013,7 +12014,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12016 "configure" +#line 12017 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12119,7 +12120,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12122 "configure" +#line 12123 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15437,6 +15438,65 @@ case "${target}" in esac +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +GPROFNG_NO_NONNULL_COMPARE_CFLAGS= +save_CFLAGS="$CFLAGS" +for real_option in -Wno-nonnull-compare; do + # Do the check with the no- prefix removed since gcc silently + # accepts any -Wno-* option on purpose + case $real_option in + -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;; + *) option=$real_option ;; + esac + as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh` + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5 +$as_echo_n "checking whether $CC supports $option... " >&6; } +if eval \${$as_acx_Woption+:} false; then : + $as_echo_n "(cached) " >&6 +else + CFLAGS="$option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_acx_Woption=yes" +else + eval "$as_acx_Woption=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +eval ac_res=\$$as_acx_Woption + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then : + GPROFNG_NO_NONNULL_COMPARE_CFLAGS="$GPROFNG_NO_NONNULL_COMPARE_CFLAGS${GPROFNG_NO_NONNULL_COMPARE_CFLAGS:+ }$real_option" +fi + done +CFLAGS="$save_CFLAGS" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + ac_config_files="$ac_config_files Makefile" ac_config_headers="$ac_config_headers lib-config.h:../common/config.h.in" diff --git a/gprofng/libcollector/configure.ac b/gprofng/libcollector/configure.ac index 8acd66f6977..e12d6917148 100644 --- a/gprofng/libcollector/configure.ac +++ b/gprofng/libcollector/configure.ac @@ -54,6 +54,9 @@ case "${target}" in esac AC_SUBST(GPROFNG_VARIANT) +ACX_PROG_CC_WARNING_OPTS([-Wno-nonnull-compare], [GPROFNG_NO_NONNULL_COMPARE_CFLAGS]) +AC_SUBST(GPROFNG_NO_NONNULL_COMPARE_CFLAGS) + AC_CONFIG_FILES([Makefile]) AC_CONFIG_HEADERS([lib-config.h:../common/config.h.in]) AC_OUTPUT -- 2.35.1