This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 0/5] Remove a few hurdles of compiling with clang


On 2017-06-13 21:22, Eli Zaretskii wrote:
See, I don't consider the proposed solution to be elegant, because it
tweaks a perfectly valid code to placate a stupid compiler warning.

It replaces perfectly valid code with some other perfectly valid code. That the compiler warning is stupid is your opinion. I think it's useful (even though it may trigger false positives sometimes).

Someone at some point might rightfully ask why didn't we use
ALL_DEBUG_ADDRESS_REGISTERS instead, and might even reinstate the code
you are about to change. So I prefer to have a seemingly "ugly"
workaround, which nonetheless points out exactly which warning of what
compiler caused it.  That way, at some future point, when clang
hopefully gets its act together, we could revisit the issue and see
that the workaround is no longer needed.

We can always add comments like

/* Don't use ALL_DEBUG_ADDRESS_REGISTERS here to silence Clang's -Wfor-loop-analysis warning. */

like we have right now for GCC warnings:

breakpoint.c:14747: /* Initialize it just to avoid a GCC false warning. */

Even though I have a slight preference for not silencing warnings when possible, it's really not a strong opinion, I would also be fine with the #pragma if that's what people prefer.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]