[PATCH] gdb: put user-supplied CFLAGS at the end

Simon Marchi simon.marchi@efficios.com
Wed Oct 7 14:25:03 GMT 2020


On 2020-10-07 8:10 a.m., Pedro Alves wrote:
> On 10/5/20 5:40 PM, Simon Marchi via Gdb-patches wrote:
>> gdb/ChangeLog:
>>
>> 	* Makefile (INTERNAL_CFLAGS_BASE): Move CXXFLAGS at the end.
>
> Typo: Makefile.in.

Thanks, fixed.

> $(CXXFLAGS) in INTERNAL_CFLAGS_BASE looks a little bit buried, IMHO.
> The intent that CXXFLAGS must be last isn't very explicit.
>
> Also, while compiling python files, CXXFLAGS won't be at the end:
>
>  # Python files need special flags.
>  python/%.o: INTERNAL_CFLAGS += $(PYTHON_CFLAGS)
>
>
> Maybe it would be better to tweak the two spots to use INTERNAL_CFLAGS
> and add CXXFLAGS there explicitly:
>
>  + # Add comment about wanting CXXFLAGS to remain last.
>  -COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
>  +COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $CXXFLAGS $(COMPILE.post)
>
> Which would be kind of similar to what automake outputs in gdbsupport/Makefile.in :
>
>   CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
>   	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)

Makes sense, I'll do that.

> Also, I think gdbserver/Makefile.in needs the same tweak?

Probably, I'll check and apply it there if needed.

Thanks for the review.

Simon



More information about the Gdb-patches mailing list