managarm / mlibc

Portable C standard library
Other
827 stars 126 forks source link

fix: options/ansi make UINT_MAX unsigned #1116

Closed awewsomegamer closed 2 weeks ago

awewsomegamer commented 2 weeks ago

Compiling MPFR yielded the following messages:

/host/usr/include/limits.h:76:31: warning: integer overflow in expression of type 'int' results in '-2' [-Woverflow]
   76 | #define UINT_MAX (__INT_MAX__ * 2 + 1)
../../mpfr-src/src/invert_limb.h:136:7: note: in expansion of macro 'MPFR_STAT_STATIC_ASSERT'
  136 |       MPFR_STAT_STATIC_ASSERT (4182025 <= UINT_MAX);   

After some time looking through at possible fixes, I have discovered that UINT_MAX is evaluated to be a signed integer rather than an unsigned one in ansi/include/limits.h, this can be fixed by adding 2 U's.

awewsomegamer commented 2 weeks ago

Added fix for __SHRTMAX typo.