Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 7c3d6d8

Browse files
committed
Merge pull request #3030 from krytarowski/netbsd-support-32
Fix build on NetBSD: Walkaround compiler strictness regarding const c…
2 parents 86f87db + 5f38e16 commit 7c3d6d8

File tree

10 files changed

+26
-10
lines changed

10 files changed

+26
-10
lines changed

src/pal/tests/palsuite/c_runtime/sscanf/test4/test4.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
int __cdecl main(int argc, char *argv[])
2121
{
22+
int n65535 = 65535; /* Walkaround compiler strictness */
23+
2224
if (PAL_Initialize(argc, argv))
2325
{
2426
return FAIL;
@@ -29,7 +31,7 @@ int __cdecl main(int argc, char *argv[])
2931
DoNumTest("-1", "%d", -1);
3032
DoNumTest("0x1234", "%d", 0);
3133
DoNumTest("012", "%d", 12);
32-
DoShortNumTest("-1", "%hd", 65535);
34+
DoShortNumTest("-1", "%hd", n65535);
3335
DoShortNumTest("65536", "%hd", 0);
3436
DoNumTest("-1", "%ld", -1);
3537
DoNumTest("65536", "%ld", 65536);

src/pal/tests/palsuite/c_runtime/sscanf/test5/test5.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
int __cdecl main(int argc, char *argv[])
2020
{
21+
int n65535 = 65535; /* Walkaround compiler strictness */
22+
2123
if (PAL_Initialize(argc, argv))
2224
{
2325
return FAIL;
@@ -28,7 +30,7 @@ int __cdecl main(int argc, char *argv[])
2830
DoNumTest("-1", "%i", -1);
2931
DoNumTest("0x1234", "%i", 0x1234);
3032
DoNumTest("012", "%i", 10);
31-
DoShortNumTest("-1", "%hi", 65535);
33+
DoShortNumTest("-1", "%hi", n65535);
3234
DoShortNumTest("65536", "%hi", 0);
3335
DoNumTest("-1", "%li", -1);
3436
DoNumTest("65536", "%li", 65536);

src/pal/tests/palsuite/c_runtime/sscanf/test6/test6.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
int __cdecl main(int argc, char *argv[])
2020
{
21+
int n65535 = 65535; /* Walkaround compiler strictness */
2122

2223
if (PAL_Initialize(argc, argv))
2324
{
@@ -29,7 +30,7 @@ int __cdecl main(int argc, char *argv[])
2930
DoNumTest("-1", "%o", -1);
3031
DoNumTest("0x1234", "%o", 0);
3132
DoNumTest("012", "%o", 10);
32-
DoShortNumTest("-1", "%ho", 65535);
33+
DoShortNumTest("-1", "%ho", n65535);
3334
DoShortNumTest("200000", "%ho", 0);
3435
DoNumTest("-1", "%lo", -1);
3536
DoNumTest("200000", "%lo", 65536);

src/pal/tests/palsuite/c_runtime/sscanf/test7/test7.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
int __cdecl main(int argc, char *argv[])
2020
{
21+
int n65535 = 65535; /* Walkaround compiler strictness */
22+
2123
if (PAL_Initialize(argc, argv))
2224
{
2325
return FAIL;
@@ -28,7 +30,7 @@ int __cdecl main(int argc, char *argv[])
2830
DoNumTest("-1", "%x", -1);
2931
DoNumTest("0x1234", "%x", 0x1234);
3032
DoNumTest("012", "%x", 0x12);
31-
DoShortNumTest("-1", "%hx", 65535);
33+
DoShortNumTest("-1", "%hx", n65535);
3234
DoShortNumTest("10000", "%hx", 0);
3335
DoNumTest("-1", "%lx", -1);
3436
DoNumTest("10000", "%lx", 65536);

src/pal/tests/palsuite/c_runtime/sscanf/test8/test8.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
int __cdecl main(int argc, char *argv[])
2020
{
21+
int n65535 = 65535; /* Walkaround compiler strictness */
22+
2123
if (PAL_Initialize(argc, argv))
2224
{
2325
return FAIL;
@@ -28,7 +30,7 @@ int __cdecl main(int argc, char *argv[])
2830
DoNumTest("-1", "%u", -1);
2931
DoNumTest("0x1234", "%u", 0);
3032
DoNumTest("012", "%u", 12);
31-
DoShortNumTest("-1", "%hu", 65535);
33+
DoShortNumTest("-1", "%hu", n65535);
3234
DoShortNumTest("65536", "%hu", 0);
3335
DoNumTest("-1", "%lu", -1);
3436
DoNumTest("65536", "%lu", 65536);

src/pal/tests/palsuite/c_runtime/swscanf/test4/test4.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
int __cdecl main(int argc, char *argv[])
2121
{
22+
int n65535 = 65535; /* Walkaround compiler strictness */
2223

2324
if (PAL_Initialize(argc, argv))
2425
{
@@ -30,7 +31,7 @@ int __cdecl main(int argc, char *argv[])
3031
DoNumTest(convert("-1"), convert("%d"), -1);
3132
DoNumTest(convert("0x1234"), convert("%d"), 0);
3233
DoNumTest(convert("012"), convert("%d"), 12);
33-
DoShortNumTest(convert("-1"), convert("%hd"), 65535);
34+
DoShortNumTest(convert("-1"), convert("%hd"), n65535);
3435
DoShortNumTest(convert("65536"), convert("%hd"), 0);
3536
DoNumTest(convert("-1"), convert("%ld"), -1);
3637
DoNumTest(convert("65536"), convert("%ld"), 65536);

src/pal/tests/palsuite/c_runtime/swscanf/test5/test5.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
int __cdecl main(int argc, char *argv[])
2121
{
22+
int n65535 = 65535; /* Walkaround compiler strictness */
2223

2324
if (PAL_Initialize(argc, argv))
2425
{
@@ -30,7 +31,7 @@ int __cdecl main(int argc, char *argv[])
3031
DoNumTest(convert("-1"), convert("%i"), -1);
3132
DoNumTest(convert("0x1234"), convert("%i"), 0x1234);
3233
DoNumTest(convert("012"), convert("%i"), 10);
33-
DoShortNumTest(convert("-1"), convert("%hi"), 65535);
34+
DoShortNumTest(convert("-1"), convert("%hi"), n65535);
3435
DoShortNumTest(convert("65536"), convert("%hi"), 0);
3536
DoNumTest(convert("-1"), convert("%li"), -1);
3637
DoNumTest(convert("65536"), convert("%li"), 65536);

src/pal/tests/palsuite/c_runtime/swscanf/test6/test6.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
int __cdecl main(int argc, char *argv[])
2121
{
22+
int n65535 = 65535; /* Walkaround compiler strictness */
23+
2224
if (PAL_Initialize(argc, argv))
2325
{
2426
return FAIL;
@@ -29,7 +31,7 @@ int __cdecl main(int argc, char *argv[])
2931
DoNumTest(convert("-1"), convert("%o"), -1);
3032
DoNumTest(convert("0x1234"), convert("%o"), 0);
3133
DoNumTest(convert("012"), convert("%o"), 10);
32-
DoShortNumTest(convert("-1"), convert("%ho"), 65535);
34+
DoShortNumTest(convert("-1"), convert("%ho"), n65535);
3335
DoShortNumTest(convert("200000"), convert("%ho"), 0);
3436
DoNumTest(convert("-1"), convert("%lo"), -1);
3537
DoNumTest(convert("200000"), convert("%lo"), 65536);

src/pal/tests/palsuite/c_runtime/swscanf/test7/test7.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
int __cdecl main(int argc, char *argv[])
2121
{
22+
int n65535 = 65535; /* Walkaround compiler strictness */
2223

2324
if (PAL_Initialize(argc, argv))
2425
{
@@ -30,7 +31,7 @@ int __cdecl main(int argc, char *argv[])
3031
DoNumTest(convert("-1"), convert("%x"), -1);
3132
DoNumTest(convert("0x1234"), convert("%x"), 0x1234);
3233
DoNumTest(convert("012"), convert("%x"), 0x12);
33-
DoShortNumTest(convert("-1"), convert("%hx"), 65535);
34+
DoShortNumTest(convert("-1"), convert("%hx"), n65535);
3435
DoShortNumTest(convert("10000"), convert("%hx"), 0);
3536
DoNumTest(convert("-1"), convert("%lx"), -1);
3637
DoNumTest(convert("10000"), convert("%lx"), 65536);

src/pal/tests/palsuite/c_runtime/swscanf/test8/test8.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
int __cdecl main(int argc, char *argv[])
2121
{
22+
int n65535 = 65535; /* Walkaround compiler strictness */
23+
2224
if (PAL_Initialize(argc, argv))
2325
{
2426
return FAIL;
@@ -29,7 +31,7 @@ int __cdecl main(int argc, char *argv[])
2931
DoNumTest(convert("-1"), convert("%u"), -1);
3032
DoNumTest(convert("0x1234"), convert("%u"), 0);
3133
DoNumTest(convert("012"), convert("%u"), 12);
32-
DoShortNumTest(convert("-1"), convert("%hu"), 65535);
34+
DoShortNumTest(convert("-1"), convert("%hu"), n65535);
3335
DoShortNumTest(convert("65536"), convert("%hu"), 0);
3436
DoNumTest(convert("-1"), convert("%lu"), -1);
3537
DoNumTest(convert("65536"), convert("%lu"), 65536);

0 commit comments

Comments
 (0)