> -----Original Message-----
> From: James K. Lowden <jklow...@cobolworx.com>
> Sent: Tuesday, July 8, 2025 17:11
> To: Robert Dubner <rdub...@symas.com>
> Cc: Richard Biener <richard.guent...@gmail.com>; Rainer Orth
> <r...@cebitec.uni-bielefeld.de>; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH] cobol: Implement CXXFLAGS_FOR_COBOL.
>
> On Tue, 8 Jul 2025 14:11:19 -0500 (CDT)
> Robert Dubner <rdub...@symas.com> wrote:
>
> > But I have other requirements. I apologize if I keep repeating
> > myself, but I am being forced to.
> >
> > I want to be able to, for example,
> >
> > CXXFLAGS='-ggdb -O0'
> > CXXFLAGS_FOR_COBOL="-Wsomething_or_other" ../configure ....
> >
> > I want those warnings to apply to gcc/cobol and not to anything else.
> >
> > And then, later on, I want to be able to
> >
> > make CXXFLAGS_FOR_COBOL="-Wreplacement_warnings"
> >
> > <shrug> I can't do that with the CXXFLAGS= or CXX= solutions.
>
> I think you can, though. Richard is saying,
>
> $ CXX='g++ -std=c++14' ../configure
>
> will allow a build of the whole tree, including libcody, and
>
> $ make -C build/gcc/cobol CXXFLAGS='-Werror'
>
> can be used to set options for a particular build.
>
> I haven't tried it yet, but if that works and meets your needs, then
> the problem is solved. If it doesn't work in some circumstances, that's
> another issue.
>
> Does that not suffice?
I don't think it does.
I am forced, for roughly the fourth time, to establish my requirements:
1) I want, for development, to be able to establish flags for the COBOL
front end -- independently of flags established for other front ends and
for everything else -- with something like
CXXFLAGS="-ggdb -O0" CXXFLAGS_FOR_COBOL="-std=c++14 -Wall -Werror
-Wreally-cranky" ../configure ....
That will establish the baseline Makefiles for that configuration. I am
not looking for a particular set of flags; I want to be able to create
builds with flags as necessary.
Without that ability, I am forced to establish CXXFLAGS, every time, for
builds of gcc/cobol files, while keeping track of those admittedly rare
occasions when I modify files that aren't in the COBOL front end, and
setting CXXFLAGS separately.
Look. I just stuck a call to env(1) at the point where one of our
gcc/cobol files is being compiled.
Here are the environment variables that contain the text "FLAG" at that
time:
ADA_CFLAGS=
AR_FLAGS_FOR_TARGET=
AR_FLAGS=rc
BOOT_ADAFLAGS=-gnatpg
BOOT_CFLAGS=-g -O2
BOOT_LDFLAGS=
CFLAGS_FOR_BUILD=-g -O2
CFLAGS_FOR_TARGET=-g -O2
CFLAGS=-g -O2
CPPFLAGS_FOR_BUILD=
CPPFLAGS_FOR_TARGET=
CXXFLAGS_FOR_COBOL=
CXXFLAGS_FOR_TARGET=-g -O2 -D_GNU_SOURCE
CXXFLAGS=-g -O2
FLAGS_FOR_TARGET=-B/usr/local/x86_64-pc-linux-gnu/bin/
-B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem
/usr/local/x86_64-pc-linux-gnu/include -isystem
/usr/local/x86_64-pc-linux-gnu/sys-include
GDCFLAGS_FOR_TARGET=-O2 -g
GDCFLAGS=-g -O2
GM2FLAGS_FOR_TARGET=-O2 -g
GOCFLAGS_FOR_TARGET=-O2 -g
LDFLAGS_FOR_BUILD=
LDFLAGS_FOR_TARGET=
LDFLAGS=-static-libstdc++ -static-libgcc
LIBCFLAGS_FOR_TARGET=-g -O2
LIBCFLAGS=-g -O2
LIBCXXFLAGS_FOR_TARGET=-g -O2 -D_GNU_SOURCE -fno-implicit-templates
LIBCXXFLAGS=-g -O2 -fno-implicit-templates
MAKEFLAGS=s
MFLAGS=-s
PGO_BUILD_CFLAGS=
PGO_BUILD_LTO_CFLAGS=
RUNTESTFLAGS=
STAGE1_CFLAGS=-g
STAGE1_CXXFLAGS=-g -O2
STAGE1_GENERATOR_CFLAGS=
STAGE1_TFLAGS=-fno-checking
STAGE2_CFLAGS=-g -O2 -fno-checking
STAGE2_CXXFLAGS=-g -O2
STAGE2_GENERATOR_CFLAGS=
STAGE2_TFLAGS=-fno-checking
STAGE3_CFLAGS=-g -O2 -fchecking=1
STAGE3_CXXFLAGS=-g -O2
STAGE3_GENERATOR_CFLAGS=
STAGE3_TFLAGS=-fchecking=1
STAGE4_CFLAGS=-g -O2
STAGE4_CXXFLAGS=-g -O2
STAGE4_GENERATOR_CFLAGS=
STAGE4_TFLAGS=
STAGEautofeedback_CFLAGS=-g -O2 -fchecking=1
STAGEautofeedback_CXXFLAGS=-g -O2
STAGEautofeedback_GENERATOR_CFLAGS=
STAGEautofeedback_TFLAGS=-fchecking=1
STAGEautoprofile_CFLAGS=-g -O2 -fno-checking -g
STAGEautoprofile_CXXFLAGS=-g -O2
STAGEautoprofile_GENERATOR_CFLAGS=
STAGEautoprofile_TFLAGS=-fno-checking
STAGEfeedback_CFLAGS=-g -O2 -fprofile-use
-fprofile-reproducible=parallel-runs
STAGEfeedback_CXXFLAGS=-g -O2
STAGEfeedback_GENERATOR_CFLAGS=
STAGEfeedback_TFLAGS=
STAGEprofile_CFLAGS=-g -O2 -fno-checking -fprofile-generate
STAGEprofile_CXXFLAGS=-g -O2
STAGEprofile_GENERATOR_CFLAGS=
STAGEprofile_TFLAGS=-fno-checking
STAGEtrain_CFLAGS=-g -O2
STAGEtrain_CXXFLAGS=-g -O2
STAGEtrain_GENERATOR_CFLAGS=
STAGEtrain_TFLAGS=
TFLAGS=
XGCC_FLAGS_FOR_TARGET=-B/usr/local/x86_64-pc-linux-gnu/bin/
-B/usr/local/x86_64-pc-linux-gnu/lib/ -isystem
/usr/local/x86_64-pc-linux-gnu/include -isystem
/usr/local/x86_64-pc-linux-gnu/sys-include
I am going to invoke Tevye, from Fiddler on the Roof: Would it spoil some
vast eternal plan to add one additional variable that fifty percent of the
development team for one of the dozen GCC front ends would like to have so
that he can do his work?
I will happily change the name to, say, COBOL_CFLAGS, to match the style
of the existing ADA_CFLAGS which I see somehow got onto the list.
>
> --jkl