On Mon, Jan 11, 2021 at 11:26:42AM +0100, Martin Liška wrote:
> Problem here was that GCC-related options are not applied in stage2 (and 
> later stages).
> It's caused by fact that CXX is xg++ in stage2 (and later stages).
> Fixed with the following patch.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> libcody/ChangeLog:
> 
>       PR bootstrap/98414
>       * Makefile.in: In stage2 in UBSAN bootstrap the CXX is called
>       xg++, so findstring g++ should be used instead of exact string
>       comparison.

I think better would be to follow gcc/{configure*,Make*} practice and don't
judge compilers based on names, but on what they actually are and test
perhaps not each individual flag separately, but their whole sets together.
gcc/configure* also has:
ACX_PROG_CXX_WARNING_OPTS(
        m4_quote(m4_do([-W -Wall -Wno-narrowing -Wwrite-strings ],
                       [-Wcast-qual -Wno-error=format-diag $wf_opt])),
                       [loose_warn])
ACX_PROG_CC_WARNING_OPTS(
        m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes ],
                       [-Wno-error=format-diag])), [c_loose_warn])
etc. and then the Makefile.in just uses those @...@s.

It is true that your findstring g++ will handle this xg++ case as well as
g++-6.2.1 or redhat-linux-gnu-6.2.1-g++, but it isn't bulletproof.

Anyway, will defer to Nathan.

> ---
>  libcody/Makefile.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libcody/Makefile.in b/libcody/Makefile.in
> index 6e38d51516f..1945dc95f14 100644
> --- a/libcody/Makefile.in
> +++ b/libcody/Makefile.in
> @@ -55,7 +55,7 @@ INSTALL := $(srcdir)/build-aux/install-sh
>  CXXFLAGS := @CXXFLAGS@
>  CXXINC := $(filter -I%,@CXX@)
>  CXXOPTS := $(CXXFLAGS) @PICFLAG@
> -ifeq ($(notdir $(firstword $(CXX))),g++)
> +ifneq (,$(findstring g++, $(notdir $(firstword $(CXX)))))
>  # It's GCC, or pretending to be it -- so it better smell like it!
>  # Code generation
>  CXXOPTS += -fno-enforce-eh-specs
> -- 
> 2.29.2

        Jakub

Reply via email to