On Tue, Jul 8, 2025 at 12:46 AM Robert Dubner <rdub...@symas.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Rainer Orth <r...@cebitec.uni-bielefeld.de>
> > Sent: Monday, July 7, 2025 18:08
> > To: Robert Dubner <rdub...@symas.com>
> > Cc: gcc-patches@gcc.gnu.org
> > Subject: Re: [PATCH] cobol: Implement CXXFLAGS_FOR_COBOL.
> >
> > Hi Robert,
> >
> > > I have elsewhere described my frustration in trying, during
> development,
> > > to set more stringent error-finding and warning-generating compilation
> > > options.  But they seem to require the use of CXXFLAGS, which in at
> > least
> > > the case of trying to set -std=c++14, causes libcody's compilation to
> > > fail, since it wants, specifically c++11.
> > >
> > > So, I dove in and figured out how to implement CXXFLAGS_FOR_COBOL.
> This
> > > new flag applies only to compilations of c++ programs in the gcc/cobol
> > > source code tree.
> > >
> > > These changes were tested with a bootstrap build of
> > > --enable-languages=c,c++,fortran,cobol.
> > >
> > > Is this okay for trunk?
> >
> > I think there's a far easier way which doesn't require any patch.  Have
> > a look at toplevel configure.ac:
> >
> > # When bootstrapping with GCC, build stage 1 in C++14 mode to ensure
> that
> > a
> > # C++14 compiler can still start the bootstrap.  Otherwise, if building
> > GCC,
> > # require C++14 (or higher).
> > if test "$enable_bootstrap:$GXX" = "yes:yes"; then
> >   CXX="$CXX -std=c++14"
> > elif test "$have_compiler" = yes; then
> >   AX_CXX_COMPILE_STDCXX(14)
> >
> >   if test "${build}" != "${host}"; then
> >     AX_CXX_COMPILE_STDCXX(14, [], [], [_FOR_BUILD])
> >   fi
> > fi
> >
> > You should be able to achieve what you want by building with CXX='g++
> > -std=c++14', just as one can build a 32-bit gcc with a 64-bit host
> > compiler using CXX='g++ -m32'.
>
> In this case, although I reported my patch works with a bootstrap build, I
> need it to work with an --disable-bootstrap build.  I did the bootstrap
> just to make sure I hadn't broken something.  I anticipate using
> CXXFLAGS_FOR_COBOL during development.
>
> When I try
>
>         CXX=banana ../configure ... & make ...

For me:

obj> CXX=banana ~/src/gcc/configure --disable-bootstrap
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
...
checking whether banana supports C++14 features by default... no
checking whether banana supports C++14 features with -std=gnu++14... no
checking whether banana supports C++14 features with -std=gnu++1y... no
checking whether banana supports C++14 features with -std=c++14... no
checking whether banana supports C++14 features with +std=c++14... no
checking whether banana supports C++14 features with -h std=c++14... no
checking whether banana supports C++14 features with -std=c++1y... no
checking whether banana supports C++14 features with +std=c++1y... no
checking whether banana supports C++14 features with -h std=c++1y... no
configure: error: *** A compiler with support for C++14 language
features is required.

so setting CXX definitely makes a difference even with --disable-bootstrap.

It seems libcody alters CXX to force -std=c++11 but as CXXFLAGS comes
after it when you add -std=c++14 to it it will break.

So using CXX="g++ -std=c++14" should do the trick.  You do not need to
re-specify that at make time.  It works for me and builds libcody just fine.

Richard.

> and
>         make CXX=banana
>
> in both cases, the build succeeds.  The "CXX=banana" seems to do nothing
> when --disable-bootstrap is active.
>
> For a bootstrap build, the configure fails quickly:
>
>        checking whether banana supports C++14 features by default... no
>
> Furthermore, even if this method did work, I need the CXXFLAGS_FOR_COBOL
> options to appear at the end of the list, not the beginning, since they
> may need to override what came before.
>
> So, my request for agreement to apply the patch stands.
>
> >
> >       Rainer
> >
> > --
> >
> --------------------------------------------------------------------------
> > ---
> > Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to