From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2010) id B043F383E682; Tue, 14 Jun 2022 07:17:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B043F383E682 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Eric Gallager To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/egallager/heads/autotools-tinkering)] trying to hunt down a linking error X-Act-Checkin: gcc X-Git-Author: Eric Gallager X-Git-Refname: refs/users/egallager/heads/autotools-tinkering X-Git-Oldrev: db80d5b57943aef8aed2f880c9acd88fac4966d8 X-Git-Newrev: 079a70387cc77d91ef73ed8c859084f33752c06c Message-Id: <20220614071701.B043F383E682@sourceware.org> Date: Tue, 14 Jun 2022 07:17:01 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jun 2022 07:17:01 -0000 https://gcc.gnu.org/g:079a70387cc77d91ef73ed8c859084f33752c06c commit 079a70387cc77d91ef73ed8c859084f33752c06c Author: Eric Gallager Date: Tue Jun 14 03:16:42 2022 -0400 trying to hunt down a linking error maybe turning on more compile warnings will help... Diff: --- c++tools/Makefile.in | 5 ++- c++tools/configure | 59 +++++++++++++++++++++++++ c++tools/configure.ac | 3 ++ c++tools/server.cc | 2 + gcc/configure | 4 +- gcc/configure.ac | 4 +- libcody/Makefile.in | 5 ++- libcody/configure | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++ libcody/configure.ac | 3 ++ 9 files changed, 194 insertions(+), 8 deletions(-) diff --git a/c++tools/Makefile.in b/c++tools/Makefile.in index d6a33613732..cc9f28b5a34 100644 --- a/c++tools/Makefile.in +++ b/c++tools/Makefile.in @@ -27,9 +27,10 @@ INSTALL_STRIP_PROGRAM := $(srcdir)/../install-sh -c -s AUTOCONF := @AUTOCONF@ AUTOHEADER := @AUTOHEADER@ CXX := @CXX@ -CXXFLAGS := @CXXFLAGS@ +CXXFLAGS := @CXXFLAGS@ @WARN_CXXFLAGS@ PIEFLAG := @PIEFLAG@ CXXOPTS := $(CXXFLAGS) $(PIEFLAG) -fno-exceptions -fno-rtti +WARN_CXXFLAGS := @WARN_CXXFLAGS@ LDFLAGS := @LDFLAGS@ exeext := @EXEEXT@ LIBIBERTY := ../libiberty/libiberty.a @@ -82,7 +83,7 @@ SRC_CXXFLAGS = $(CXXFLAGS$(patsubst $(srcdir)%,%,$1)) \ %.o: %.cc $(CXX) $(strip $(CXXOPTS) $(call SRC_CXXFLAGS,$<) $(CXXINC)) \ - -MMD -MP -MF ${@:.o=.d} -c -o $@ $< + $(WARN_CXXFLAGS) -MMD -MP -MF ${@:.o=.d} -c -o $@ $< ifeq (@CXX_AUX_TOOLS@,yes) diff --git a/c++tools/configure b/c++tools/configure index e9d6d317dec..89c51326c1d 100755 --- a/c++tools/configure +++ b/c++tools/configure @@ -622,6 +622,7 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS +WARN_CXXFLAGS NETLIBS get_gcc_base_ver EGREP @@ -3908,6 +3909,64 @@ NETLIBS="$LIBS" LIBS="$save_LIBS" +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +WARN_CXXFLAGS= +save_CXXFLAGS="$CXXFLAGS" +for real_option in -Wall -Wextra -Wmissing-declarations; 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 $CXX supports $option" >&5 +$as_echo_n "checking whether $CXX supports $option... " >&6; } +if eval \${$as_acx_Woption+:} false; then : + $as_echo_n "(cached) " >&6 +else + CXXFLAGS="$option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_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 : + WARN_CXXFLAGS="$WARN_CXXFLAGS${WARN_CXXFLAGS:+ }$real_option" +fi + done +CXXFLAGS="$save_CXXFLAGS" +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + ac_config_headers="$ac_config_headers config.h" ac_config_files="$ac_config_files Makefile" diff --git a/c++tools/configure.ac b/c++tools/configure.ac index 4c114f18712..b944d200ec4 100644 --- a/c++tools/configure.ac +++ b/c++tools/configure.ac @@ -23,6 +23,7 @@ sinclude(../config/acx.m4) sinclude(../config/ax_lib_socket_nsl.m4) +sinclude(../config/warnings.m4) AC_INIT AC_CONFIG_SRCDIR([c++tools]) @@ -260,6 +261,8 @@ NETLIBS="$LIBS" LIBS="$save_LIBS" AC_SUBST(NETLIBS) +ACX_PROG_CXX_WARNING_OPTS([-Wall -Wextra -Wmissing-declarations]) + AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) diff --git a/c++tools/server.cc b/c++tools/server.cc index 00154a05925..f361bf54409 100644 --- a/c++tools/server.cc +++ b/c++tools/server.cc @@ -632,6 +632,8 @@ server (bool ipv6, int sock_fd, module_resolver *resolver) { #ifdef HAVE_EPOLL event_count = epoll_pwait (epoll_fd, events, max_events, -1, &mask); +#else + event_count = 0; #endif } else diff --git a/gcc/configure b/gcc/configure index db66ff0ace3..58c97e3c8f3 100755 --- a/gcc/configure +++ b/gcc/configure @@ -7077,7 +7077,7 @@ else fi if test $enable_build_format_warnings = no; then : - wf_opt=-Wno-format + wf_opt="-Wno-format -Wno-ignored-attributes" else wf_opt= fi @@ -7204,7 +7204,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu strict_warn= save_CXXFLAGS="$CXXFLAGS" -for real_option in -Wmissing-format-attribute -Woverloaded-virtual; do +for real_option in -Wmissing-format-attribute -Wmissing-declarations -Woverloaded-virtual; do # Do the check with the no- prefix removed since gcc silently # accepts any -Wno-* option on purpose case $real_option in diff --git a/gcc/configure.ac b/gcc/configure.ac index 223e6bc03a5..65aec6a9e38 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -570,7 +570,7 @@ AC_ARG_ENABLE(build-format-warnings, AS_HELP_STRING([--disable-build-format-warnings],[don't use -Wformat while building GCC]), [],[enable_build_format_warnings=yes]) AS_IF([test $enable_build_format_warnings = no], - [wf_opt=-Wno-format],[wf_opt=]) + [wf_opt="-Wno-format -Wno-ignored-attributes"],[wf_opt=]) ACX_PROG_CXX_WARNING_OPTS( m4_quote(m4_do([-Wall -Wextra -Wno-narrowing -Wwrite-strings ], [-Wcast-qual $wf_opt])), @@ -579,7 +579,7 @@ ACX_PROG_CC_WARNING_OPTS( m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes ], [])), [c_loose_warn]) ACX_PROG_CXX_WARNING_OPTS( - m4_quote(m4_do([-Wmissing-format-attribute ], + m4_quote(m4_do([-Wmissing-format-attribute -Wmissing-declarations ], [-Woverloaded-virtual])), [strict_warn]) ACX_PROG_CC_WARNING_OPTS( m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn]) diff --git a/libcody/Makefile.in b/libcody/Makefile.in index 7eaf8ace8ce..1afbcbbe8eb 100644 --- a/libcody/Makefile.in +++ b/libcody/Makefile.in @@ -19,9 +19,10 @@ RANLIB := @RANLIB@ INSTALL := $(srcdir)/build-aux/install-sh # C++ compiler options -CXXFLAGS := @CXXFLAGS@ +CXXFLAGS := @CXXFLAGS@ @WARN_CXXFLAGS@ CXXINC := $(filter -I%,@CXX@) CXXOPTS := $(CXXFLAGS) @PICFLAG@ +WARN_CXXFLAGS := @WARN_CXXFLAGS@ ifneq (@EXCEPTIONS@,yes) CXXOPTS += -fno-exceptions -fno-rtti @@ -56,7 +57,7 @@ vpath %.cc $(srcdir) %.o: %.cc @mkdir -p $(dir $@) $(CXX) $(strip $(CXXOPTS) $(call SRC_CXXFLAGS,$<) $(CXXINC)) \ - -MMD -MP -MF ${@:.o=.d} -c -o $@ $< + $(WARN_CXXFLAGS) -MMD -MP -MF ${@:.o=.d} -c -o $@ $< all:: Makefile diff --git a/libcody/configure b/libcody/configure index da52a5cfca5..e0b70b45d31 100755 --- a/libcody/configure +++ b/libcody/configure @@ -588,6 +588,7 @@ ac_unique_file="cody.hh" ac_subst_vars='LTLIBOBJS LIBOBJS configure_args +WARN_CXXFLAGS AR RANLIB EXCEPTIONS @@ -1836,6 +1837,64 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +# Autoconf include file defining macros related to compile-time warnings. + +# Copyright 2004, 2005, 2007, 2009, 2011 Free Software Foundation, Inc. + +#This file is part of GCC. + +#GCC is free software; you can redistribute it and/or modify it under +#the terms of the GNU General Public License as published by the Free +#Software Foundation; either version 3, or (at your option) any later +#version. + +#GCC is distributed in the hope that it will be useful, but WITHOUT +#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +#for more details. + +#You should have received a copy of the GNU General Public License +#along with GCC; see the file COPYING3. If not see +#. + +# ACX_PROG_CC_WARNING_OPTS(WARNINGS, [VARIABLE = WARN_CFLAGS]) +# Sets @VARIABLE@ to the subset of the given options which the +# compiler accepts. +# ACX_PROG_CC_WARNING_OPTS + +# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(WARNINGS, [VARIABLE = WARN_PEDANTIC]) +# Append to VARIABLE "-pedantic" + the argument, if the compiler is GCC +# and accepts all of those options simultaneously, otherwise to nothing. +# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC + +# ACX_PROG_CC_WARNINGS_ARE_ERRORS([x.y.z], [VARIABLE = WERROR]) +# sets @VARIABLE@ to "-Werror" if the compiler is GCC >=x.y.z, or if +# --enable-werror-always was given on the command line, otherwise +# to nothing. +# If the argument is the word "manual" instead of a version number, +# then @VARIABLE@ will be set to -Werror only if --enable-werror-always +# appeared on the configure command line. +# ACX_PROG_CC_WARNINGS_ARE_ERRORS + +# ACX_PROG_CXX_WARNING_OPTS(WARNINGS, [VARIABLE = WARN_CXXFLAGS]) +# Sets @VARIABLE@ to the subset of the given options which the +# compiler accepts. +# ACX_PROG_CXX_WARNING_OPTS + +# ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC(WARNINGS, [VARIABLE = WARN_PEDANTIC]) +# Append to VARIABLE "-pedantic" + the argument, if the compiler is G++ +# and accepts all of those options simultaneously, otherwise to nothing. +# ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC + +# ACX_PROG_CXX_WARNINGS_ARE_ERRORS([x.y.z], [VARIABLE = WERROR]) +# sets @VARIABLE@ to "-Werror" if the compiler is G++ >=x.y.z, or if +# --enable-werror-always was given on the command line, otherwise +# to nothing. +# If the argument is the word "manual" instead of a version number, +# then @VARIABLE@ will be set to -Werror only if --enable-werror-always +# appeared on the configure command line. +# ACX_PROG_CXX_WARNINGS_ARE_ERRORS + ac_aux_dir= for ac_dir in .. "$srcdir"/..; do @@ -2855,6 +2914,64 @@ fi ac_config_headers="$ac_config_headers config.h" +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +WARN_CXXFLAGS= +save_CXXFLAGS="$CXXFLAGS" +for real_option in -Wall -Wextra -Wmissing-declarations; 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 $CXX supports $option" >&5 +$as_echo_n "checking whether $CXX supports $option... " >&6; } +if eval \${$as_acx_Woption+:} false; then : + $as_echo_n "(cached) " >&6 +else + CXXFLAGS="$option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_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 : + WARN_CXXFLAGS="$WARN_CXXFLAGS${WARN_CXXFLAGS:+ }$real_option" +fi + done +CXXFLAGS="$save_CXXFLAGS" +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + ac_config_files="$ac_config_files Makefile" configure_args=$ac_configure_args diff --git a/libcody/configure.ac b/libcody/configure.ac index 960191ecb72..1badc1fe0c8 100644 --- a/libcody/configure.ac +++ b/libcody/configure.ac @@ -5,6 +5,7 @@ AC_INIT([codylib],[0.0],[github.com/urnathan/libcody]) AC_CONFIG_SRCDIR(cody.hh) m4_include(config.m4) +m4_include(../config/warnings.m4) AC_CONFIG_AUX_DIR(..) AC_SUBST(PACKAGE_VERSION) @@ -75,6 +76,8 @@ AH_VERBATIM([_GNU_SOURCE],[#define _GNU_SOURCE 1]) AH_VERBATIM([_FORTIFY_SOURCE],[#undef _FORTIFY_SOURCE]) AC_CONFIG_HEADERS([config.h]) +ACX_PROG_CXX_WARNING_OPTS([-Wall -Wextra -Wmissing-declarations]) + AC_CONFIG_FILES([Makefile]) AC_SUBST(configure_args,[$ac_configure_args])