On 19.06.2015 15:11, Alan Bateman wrote:
On 18/06/2015 21:40, Xueming Shen wrote:
Hi,

Please help review the change to resolve the disabled "parentheses" warnings for libzip

issue: https://bugs.openjdk.java.net/browse/JDK-8074819
webrev: http://cr.openjdk.java.net/~sherman/8074819
Looks okay to me, although I have to admit that parentheses warning is new to me (I had to look it up).


I think this warning would be avoided if ZIP_FORMAT_ERROR weren't defined as if..else
#define ZIP_FORMAT_ERROR(message) \
    if (1) { zip->msg = message; goto Catch; } else ((void)0)

Because of this, the compiler sees "if () if () {} else {}" and issues warning, as it looks errorprone.


I believe a more common idiom is using do..while(0) instead:
#define ZIP_FORMAT_ERROR(message) \
    do { zip->msg = message; goto Catch; }while (0)

Sincerely yours,
Ivan

Reply via email to