> -----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 ...
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