diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2025-07-18 10:15:30 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2025-07-18 10:53:08 +0200 |
commit | 73600d68227e125af24b7de7c3fccbd4eb66ee03 (patch) | |
tree | 3bbfbd7c5914e7a44027c1bedfecb5f06e972a1e /newlib/libc/stdio | |
parent | ae64eddce5d9902f4c13977977755462de874161 (diff) | |
download | newlib-73600d68227e125af24b7de7c3fccbd4eb66ee03.zip newlib-73600d68227e125af24b7de7c3fccbd4eb66ee03.tar.gz newlib-73600d68227e125af24b7de7c3fccbd4eb66ee03.tar.bz2 |
Cygwin: sys/termios.h: define struct winsize before using it
Long-standing bug in the sys/termios.h file which, for some reason,
has never been encountered before.
STC:
#include <sys/termios.h>
int main()
{
struct winsize win;
tcgetwinsize (0, &win);
}
Result with gcc 12.4.0:
termios-bug.c: In function ‘main’:
termios-bug.c:7:20: warning: passing argument 2 of ‘tcgetwinsize’ from incompatible pointer type [-Wincompatible-pointer-types]
7 | tcgetwinsize (0, &win);
| ^~~~
| |
| struct winsize *
In file included from termios-bug.c:1:
/usr/include/sys/termios.h:304:42: note: expected ‘struct winsize *’ but argument is of type ‘struct winsize *’
304 | int tcgetwinsize(int fd, struct winsize *winsz);
| ~~~~~~~~~~~~~~~~^~~~~
This warning apparently becomes an error with C23.
The reason is that struct winsize is defined in sys/termios.h after
using it as argument type in function declarations. From the compil;er
perspective it's now a different type , regardless of having the same
name.
Move declaration of struct winsize up so it's defined before being used.
Reported-by: Zachary Santer <zsanter@gmail.com>
Suggested-by: Zachary Santer <zsanter@gmail.com>
Addresses: https://cygwin.com/pipermail/cygwin/2025-July/258474.html
Fixes: 1fd5e000ace55 ("import winsup-2000-02-17 snapshot")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/stdio')
0 files changed, 0 insertions, 0 deletions