Fix some issues with signedness in preprocessor expressions. Do also disallow

comma expressions since the aren't compliant and collide with macro invocations.
This commit is contained in:
Kugel Fuhr
2024-09-17 11:45:46 +02:00
parent fe6afa621b
commit 9c69aac097
3 changed files with 39 additions and 24 deletions

3
test/err/bug2523.c Normal file
View File

@@ -0,0 +1,3 @@
#if (1, 0) < 0
#error
#endif

29
test/val/bug2523.c Normal file
View File

@@ -0,0 +1,29 @@
#if (0u - 1) < 0
#error
#endif
#if !1u - 1 > 0
#error
#endif
#if (1 & 1u) - 2 < 0
#error
#endif
#if (1 | 1u) - 2 < 0
#error
#endif
#if (1 ^ 1u) - 2 < 0
#error
#endif
#if (1u >> 1) - 2 < 0
#error
#endif
#if (0u << 1) - 1 < 0
#error
#endif
int main() { return 0; }