Re: [PATCH 1/6] Fix GCC compile warning for "declaration-after-statement"
On 2023-06-09 16:53, Martin Dorey wrote: Primed by our earlier discussion, I wondered "How does that fix the bad-function-cast warning?", before belatedly noticing the Subject. This particular patch does not address the bad cast, it's addressed in patch 6 of the series. -- *From:* bug-make-bounces+martin.dorey=hds@gnu.org on behalf of Torbjörn SVENSSON *Sent:* Friday, June 9, 2023 07:39 *To:* bug-make@gnu.org *Cc:* Torbjörn SVENSSON *Subject:* [PATCH 1/6] Fix GCC compile warning for "declaration-after-statement" * EXTERNAL EMAIL * Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON --- src/w32/w32os.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/w32/w32os.c b/src/w32/w32os.c index 33828010..015b685e 100644 --- a/src/w32/w32os.c +++ b/src/w32/w32os.c @@ -35,6 +35,7 @@ unsigned int check_io_state () { static unsigned int state = IO_UNKNOWN; + HANDLE outfd, errfd; /* We only need to compute this once per process. */ if (state != IO_UNKNOWN) @@ -42,8 +43,8 @@ check_io_state () /* Could have used GetHandleInformation, but that isn't supported on Windows 9X. */ - HANDLE outfd = (HANDLE)_get_osfhandle (fileno (stdout)); - HANDLE errfd = (HANDLE)_get_osfhandle (fileno (stderr)); + outfd = (HANDLE)_get_osfhandle (fileno (stdout)); + errfd = (HANDLE)_get_osfhandle (fileno (stderr)); if ((HANDLE)_get_osfhandle (fileno (stdin)) != INVALID_HANDLE_VALUE) state |= IO_STDIN_OK; -- 2.25.1
Re: [PATCH 1/6] Fix GCC compile warning for "declaration-after-statement"
Primed by our earlier discussion, I wondered "How does that fix the bad-function-cast warning?", before belatedly noticing the Subject. From: bug-make-bounces+martin.dorey=hds@gnu.org on behalf of Torbjörn SVENSSON Sent: Friday, June 9, 2023 07:39 To: bug-make@gnu.org Cc: Torbjörn SVENSSON Subject: [PATCH 1/6] Fix GCC compile warning for "declaration-after-statement" * EXTERNAL EMAIL * Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON --- src/w32/w32os.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/w32/w32os.c b/src/w32/w32os.c index 33828010..015b685e 100644 --- a/src/w32/w32os.c +++ b/src/w32/w32os.c @@ -35,6 +35,7 @@ unsigned int check_io_state () { static unsigned int state = IO_UNKNOWN; + HANDLE outfd, errfd; /* We only need to compute this once per process. */ if (state != IO_UNKNOWN) @@ -42,8 +43,8 @@ check_io_state () /* Could have used GetHandleInformation, but that isn't supported on Windows 9X. */ - HANDLE outfd = (HANDLE)_get_osfhandle (fileno (stdout)); - HANDLE errfd = (HANDLE)_get_osfhandle (fileno (stderr)); + outfd = (HANDLE)_get_osfhandle (fileno (stdout)); + errfd = (HANDLE)_get_osfhandle (fileno (stderr)); if ((HANDLE)_get_osfhandle (fileno (stdin)) != INVALID_HANDLE_VALUE) state |= IO_STDIN_OK; -- 2.25.1
[PATCH 1/6] Fix GCC compile warning for "declaration-after-statement"
Contributed by STMicroelectronics Signed-off-by: Torbjörn SVENSSON --- src/w32/w32os.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/w32/w32os.c b/src/w32/w32os.c index 33828010..015b685e 100644 --- a/src/w32/w32os.c +++ b/src/w32/w32os.c @@ -35,6 +35,7 @@ unsigned int check_io_state () { static unsigned int state = IO_UNKNOWN; + HANDLE outfd, errfd; /* We only need to compute this once per process. */ if (state != IO_UNKNOWN) @@ -42,8 +43,8 @@ check_io_state () /* Could have used GetHandleInformation, but that isn't supported on Windows 9X. */ - HANDLE outfd = (HANDLE)_get_osfhandle (fileno (stdout)); - HANDLE errfd = (HANDLE)_get_osfhandle (fileno (stderr)); + outfd = (HANDLE)_get_osfhandle (fileno (stdout)); + errfd = (HANDLE)_get_osfhandle (fileno (stderr)); if ((HANDLE)_get_osfhandle (fileno (stdin)) != INVALID_HANDLE_VALUE) state |= IO_STDIN_OK; -- 2.25.1