On Wed, 26 Feb 2025 at 20:53, Thomas Schwinge <tschwi...@baylibre.com> wrote:
>
> Hi Jonathan!
>
> Sorry for not providing more context initially.
>
> On 2025-02-26T10:50:11+0000, Jonathan Wakely <jwak...@redhat.com> wrote:
> > On Wed, 26 Feb 2025 at 10:47, Jonathan Wakely <jwak...@redhat.com> wrote:
> >> On Wed, 26 Feb 2025 at 10:19, Thomas Schwinge wrote:
> >> > In particular, 'GLIBCXX_ENABLE_CXX_FLAGS' shouldn't overwrite 
> >> > 'EXTRA_CXX_FLAGS'
> >> > (and prepend any additional '--enable-cxx-flags=[...]').
> >>
> >> This seems good, but why prepend instead of append here?
> >> If there are important flags passed down from top-level configure that
> >> shouldn't be replaced by the libstdc++ --enable-cxx-flags option, can
> >> we mention that in the new comment in acinclude.m4?
> >
> > Oh sorry, they're more likely to be from configure.host not from the
> > top-level, right?
>
> That's right: for GCN, nvptx configurations inject '-fno-exceptions' etc.
> via 'libstdc++-v3/configure.host'.
>
> > But if we prepend, then when users put bad options in
> > --enable-cxx-flags we silently override that with good target-specific
> > ones from configure.host
>
> That was my intention indeed -- but not a strong one.  ;-) (I've myself
> never used '--enable-cxx-flags=[...]'.)

I have used it occasionally, but long ago.

> > Maybe if users explicitly give bad options, they should get an error,
> > or a bad result?
>
> That's fine for me.  So if you think that makes more sense, then I'll be
> happy to swap it around.  I agree that it would be more standard to allow
> user-specified flags to override the default ones.

Yeah, I think I'd prefer that. OK with that change, and maybe change
the comment in acinclude.m4 from "Prepend the additional flags." to
something like:

# Append the additional flags to any that came from configure.host


> > Or maybe I just don't understand the context properly :-)
> >
> >
> >>
> >> >
> >> >         libstdc++-v3/
> >> >         * acinclude.m4 (GLIBCXX_ENABLE_CXX_FLAGS): Prepend any additional
> >> >         flags to 'EXTRA_CXX_FLAGS'.
> >> >         * configure: Regenerate.
> >> >         * configure.host: Document 'EXTRA_CFLAGS', 'EXTRA_CXX_FLAGS'.
> >> > ---
> >> >  libstdc++-v3/acinclude.m4   | 3 ++-
> >> >  libstdc++-v3/configure      | 3 ++-
> >> >  libstdc++-v3/configure.host | 4 ++++
> >> >  3 files changed, 8 insertions(+), 2 deletions(-)
> >> >
> >> > diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
> >> > index b3423d7957a..3287dab3b89 100644
> >> > --- a/libstdc++-v3/acinclude.m4
> >> > +++ b/libstdc++-v3/acinclude.m4
> >> > @@ -3269,7 +3269,8 @@ AC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl
> >> >      done
> >> >    fi
> >> >
> >> > -  EXTRA_CXX_FLAGS="$enable_cxx_flags"
> >> > +  # Prepend the additional flags.
> >> > +  EXTRA_CXX_FLAGS="$enable_cxx_flags $EXTRA_CXX_FLAGS"
> >> >    AC_MSG_RESULT($EXTRA_CXX_FLAGS)
> >> >    AC_SUBST(EXTRA_CXX_FLAGS)
> >> >  ])
> >> > diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
> >> > index e115ee55739..ba908577a66 100755
> >> > --- a/libstdc++-v3/configure
> >> > +++ b/libstdc++-v3/configure
> >> > @@ -19452,7 +19452,8 @@ fi
> >> >      done
> >> >    fi
> >> >
> >> > -  EXTRA_CXX_FLAGS="$enable_cxx_flags"
> >> > +  # Prepend the additional flags.
> >> > +  EXTRA_CXX_FLAGS="$enable_cxx_flags $EXTRA_CXX_FLAGS"
> >> >    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXTRA_CXX_FLAGS" >&5
> >> >  $as_echo "$EXTRA_CXX_FLAGS" >&6; }
> >> >
> >> > diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
> >> > index 45f55b250ce..1e84c78af30 100644
> >> > --- a/libstdc++-v3/configure.host
> >> > +++ b/libstdc++-v3/configure.host
> >> > @@ -61,6 +61,10 @@
> >> >  #
> >> >  # It possibly modifies the following variables:
> >> >  #
> >> > +#   EXTRA_CFLAGS           extra flags to pass when compiling C code
> >> > +#
> >> > +#   EXTRA_CXX_FLAGS        extra flags to pass when compiling C++ code
> >> > +#
> >> >  #   OPT_LDFLAGS            extra flags to pass when linking the 
> >> > library, of
> >> >  #                          the form '-Wl,blah'
> >> >  #                          (defaults to empty in acinclude.m4)
> >> > --
> >> > 2.34.1
> >> >
>

Reply via email to