[Bug?] SIG2STR_MAX not good for #if
Mingye Wang
arthur200126@gmail.com
Mon Jun 19 06:15:52 GMT 2023
When building schilytools on MSYS2, I got hit with:
```
defs.h:1288:21: error: missing binary operator before token "("
1288 | #if NUMBUFLEN < SIG2STR_MAX
```
For context, the source goes:
```
#define NUMBUFLEN 21 /* big enough for 64 bits */
#if NUMBUFLEN < SIG2STR_MAX
#undef NUMBUFLEN
#define NUMBUFLEN (SIG2STR_MAX-1)
#endif
```
A cursory inspection of /usr/include leads me to this "#define
SIG2STR_MAX (sizeof("RTMAX+") + sizeof("4294967295") - 1)" definition;
redefining it with a plain number makes the build go through. Looking
up the newlib source code, it appears that the definition is not
specific to MSYS2 or Cygwin, but common to all newlib distributions.
The wording proposed for SIG2STR_MAX by geoffclare in comment 4975[1]
under the POSIX issue 8 bug report requires that the definition is
suitable for #if, which newlib currently violates. Now this isn't
quite standard yet and is subject to change, so I can't say for sure
this is newlib's bug.
[1]: https://www.austingroupbugs.net/view.php?id=1138#c4975
Regards,
Mingye Wang (Artoria2e5)
More information about the Newlib
mailing list