This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 0/6] Move gdbsupport to top level
On 1/16/20 5:38 PM, Christian Biesinger wrote:
> On Thu, Jan 16, 2020 at 11:23 AM Pedro Alves <palves@redhat.com> wrote:
>>> For that patch, why not just use AM_CFLAGS/AM_CXXFLAGS?
>>
>> I was mainly following what GDB does, with:
>>
>> COMPILE.pre = $(CXX) -x c++ $(CXX_DIALECT)
>>
>> I guess I was the one who did that, so that's not going to be
>> a strong explanation. :-)
>>
>> It's just that I feel like the compiler mode is more about
>> picking a different compiler than about picking some flags
>> like warnings flags or compilation levels. I think that
>> in practice the only difference is that you see the
>> -std=gnu++11 next to the compiler command:
>>
>> $ rm -f selftest.o && make V=1 selftest.o
>> /opt/gcc-4.8/bin/g++ -std=gnu++11 -DHAVE_CONFIG_H -I. -I/home/pedro/gdb/binutils-gdb/src/gdbsupport -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/config.h -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/../include -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/../gdb -I../gnulib/import -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/../gnulib/import -I.. -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/.. -I../bfd -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/../bfd -g3 -O0 -MT selftest.o -MD -MP -MF .deps/selftest.Tpo -c -o selftest.o /home/pedro/gdb/binutils-gdb/src/gdbsupport/selftest.c
>> mv -f .deps/selftest.Tpo .deps/selftest.Po
>>
>> vs, with AM_CFLAGS:
>>
>> $ rm -f selftest.o && make V=1 selftest.o
>> /opt/gcc-4.8/bin/g++ -DHAVE_CONFIG_H -I. -I/home/pedro/gdb/binutils-gdb/src/gdbsupport -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/config.h -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/../include -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/../gdb -I../gnulib/import -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/../gnulib/import -I.. -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/.. -I../bfd -I/home/pedro/gdb/binutils-gdb/src/gdbsupport/../bfd -std=gnu++11 -g3 -O0 -MT selftest.o -MD -MP -MF .deps/selftest.Tpo -c -o selftest.o /home/pedro/gdb/binutils-gdb/src/gdbsupport/selftest.c
>> mv -f .deps/selftest.Tpo .deps/selftest.Po
>>
>> AFAICT, overriding CXXFLAGS or CXX in the make invocation works
>> the same in either case.
>
> How so? override is documented to override commandline variables?
> https://www.gnu.org/software/make/manual/html_node/Override-Directive.html#Override-Directive
>
Because it is defined in terms of CXX, which gets filled with whatever
was specified on the command line, I believe:
override CXX := $(CXX) $(CXX_DIALECT)
I guess I should write instead:
override CXX += $(CXX_DIALECT)
> But yes, that's what I was thinking of, and just in general that
> override seems a bit ugly.
Other than aesthetic reasons, do you see an issue? I like seeing
the -std=gnu++11 at the left side of the command invocation,
basically for quick diagnostics, but that's about my only reason
for preferring it.
Thanks,
Pedro Alves