|
From: | Pádraig Brady |
Subject: | Re: error: Support the compiler's control flow analysis better (was: copy-file: Silence gcc warnings) |
Date: | Sun, 28 May 2023 14:07:27 +0100 |
User-agent: | Mozilla Thunderbird |
On 28/05/2023 13:50, Pádraig Brady wrote:
On 28/05/2023 13:31, Pádraig Brady wrote:On 27/05/2023 21:53, Bruno Haible wrote:+# ifndef _GL_NO_INLINE_ERROR +# undef error +# define error(status, ...) \ + ((rpl_error)(0, __VA_ARGS__), (status) ? exit (status) : (void)0) +# endifWe might need to cast STATUS to bool to avoid the following failure from coreutils CI: In file included from src/die.h:22, from src/chroot.c:27: src/chroot.c: In function 'main': src/chroot.c:362:25: error: '?:'using integer constants in boolean context [-Werror=int-in-bool-context] 362 | error (warn ? 0 : EXIT_CANCELED, 0, "%s", (err)); ./lib/error.h:422:33: note: in definition of macro 'error' 422 | ((error)(0, __VA_ARGS__), (status) ? exit (status) : (void)0) | ^~~~~~Actually casting with (bool), or using !! does NOT help here. It looks to be due to the nested use of ?: that's triggering the issue. $ gcc --version gcc (Debian 10.2.1-6) 10.2.1 20210110
To avoid this one can use `(status) != 0`. There still is a gotcha (hit in dd.c in coreutils) where if you define an error macro yourself you get a macro redefinition error, but that's something we can/should handle on the coreutils side anyway. cheers, Pádraig
[Prev in Thread] | Current Thread | [Next in Thread] |