[Lldb-commits] [PATCH] debugserver: Disable four-char-constants and format-pedantic warnings

Justin Bogner via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 27 22:21:10 PDT 2016


Pavel Labath <labath at google.com> writes:
> On 19 October 2016 at 00:20, Justin Bogner <mail at justinbogner.com> wrote:
>> Pavel Labath <labath at google.com> writes:
>>> Thanks for the patch. Could you submit the patch through phabricator
>>> <https://reviews.llvm.org> and add Greg Clayton as a reviewer.
>>
>> Maybe later. I don't have time to fight with phabricator today.
>>
>>> That said, my preference would be to actually fix those warnings
>>> instead of silencing them.
>>
>> If you think that's best, but do note that neither of these warnings is
>> flagging much of a problem:
>>
>> - The four-character-literal warning is flagging implementation defined
>>   behaviour four spelling a 32 bit hex constant in ascii instead of
>>   something like 0x46445343. This is a portability vs readability thing,
>>   and pretty minor.
>
> Agreed, but it also is pretty easily workaroundable without hurting
> readability by defining a symbolic constant.

Sure, I'd be fine with that too.

>> - The format-pedantic is warning about passing typed pointers to a %p
>>   format specifier. The "fix" is to cast these arguments to `void *`,
>>   which IMO hurts readability for no gain. I'm pretty sure this warning
>>   only exists to preserve portability to some hypothetical ABI whose
>>   calling convention depends on the type of the pointer.
>
> This one actually annoys me as well, but if we do that, I think it
> should be done at the project level. BTW, does the flag disable
> anything else apart from the void *-cast issue. I'd hate to lose other
> checks, as it's extremely easy to write non-portable format strings.

The format-pedantic warning is specifically for %p with any pointer type
other than `void *`. It also looks like clang applies this for some sort
of freebsd kernel extension %D arg, but that doesn't seem relevant.


More information about the lldb-commits mailing list