|
From: | Daniel Colascione |
Subject: | Re: Preview: portable dumper |
Date: | Fri, 16 Feb 2018 13:23:36 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 02/16/2018 01:09 PM, Paul Eggert wrote:
On 02/16/2018 12:43 PM, Daniel Colascione wrote:IMHO, we should enable -Wconversion more broadly.My experience is just the opposite: i.e., that -Wconversion causes more trouble than it cures. The pdumper change to INTEGER_TO_CONS is an example of trouble. The only reason for that change is to work around a compiler bug in GCC that is caused by -Wconversion, a bug that leads to a false alarm. I suggest at least the attached patch, which limits the damage to pdumper.c instead of letting it spread to other Emacs modules. But better yet, I suggest dropping the idea of using -Wconversion even on pdumper.c, as it's counterproductive and in high-quality code almost inevitably leads to further obfuscation like ALLOW_IMPLICIT_CONVERSION and DISALLOW_IMPLICIT_CONVERSION.
-Wconversion helped me find real bugs and otherwise mysterious bugs in pdumper. It also, apparently, found a longstanding subtle bug in a completely different part of Emacs. Outside of certain specialized casting facilities, -Wconversion ought to warn only on things that are actually problems. Have a counter-example?
The ALLOW_IMPLICIT_CONVERSION and DISALLOW_IMPLICIT_CONVERSION macros are there in pdumper to account for the rest of Emacs not being conversion-clean; if everything worked with -Wconversion, we wouldn't need the bracketing.
PS. Double-parens like that shouldn't be needed in macro bodies, as each macro must parenthesize its argument properly anyway.
Thanks.
[Prev in Thread] | Current Thread | [Next in Thread] |