diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-06 15:55:33 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-06 15:55:33 +0200 |
| commit | fc41f7917531693680b5baf71ffe38c47333fe84 (patch) | |
| tree | a6e62232e05e7779034c5f9d1bf743b6f1c198e3 /test/140_appendsolution | |
| parent | fe534f1497da6447153064d7bba00243000f803b (diff) | |
| download | nissy-core-fc41f7917531693680b5baf71ffe38c47333fe84.tar.gz nissy-core-fc41f7917531693680b5baf71ffe38c47333fe84.zip | |
Make the project build with Microsoft's broken C compiler.
MSVC is not fully C11-compliant, even when compiling with /std:c11.
Some changes were needed to make the codebase compatible. Notably, the
notation a[static N] and a[n] for function parameters of array type is
not supported, so that had to be hidden behind a macro. Atomic types
are also an experimental feature, apparently, but at least they work
with the correct compiler flag.
One thing that MSVC does well, however, is warning on integer conversions
on /W4 level. I am not sure if Clang and GCC have something similar,
so I took this chance to fix some of these.
Diffstat (limited to 'test/140_appendsolution')
| -rw-r--r-- | test/140_appendsolution/appendsolution_tests.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/140_appendsolution/appendsolution_tests.c b/test/140_appendsolution/appendsolution_tests.c index f9620ab..3f4fb15 100644 --- a/test/140_appendsolution/appendsolution_tests.c +++ b/test/140_appendsolution/appendsolution_tests.c | |||
| @@ -16,12 +16,12 @@ See below for the output format. | |||
| 16 | 16 | ||
| 17 | uint8_t readtrans(const char [NISSY_SIZE_TRANSFORMATION]); | 17 | uint8_t readtrans(const char [NISSY_SIZE_TRANSFORMATION]); |
| 18 | int64_t readmoves(const char *, size_t n, size_t m, | 18 | int64_t readmoves(const char *, size_t n, size_t m, |
| 19 | size_t *, size_t *, uint8_t [n], uint8_t [m]); | 19 | size_t *, size_t *, uint8_t *, uint8_t *); |
| 20 | void solution_moves_reset(solution_moves_t [static 1]); | 20 | void solution_moves_reset(solution_moves_t [NON_NULL]); |
| 21 | bool solution_list_init(solution_list_t [static 1], size_t n, char [n]); | 21 | bool solution_list_init(solution_list_t [NON_NULL], size_t n, char *); |
| 22 | int64_t appendsolution(const solution_moves_t [static 1], | 22 | int64_t appendsolution(const solution_moves_t [NON_NULL], |
| 23 | size_t, const uint64_t *, const solution_settings_t [static 1], | 23 | size_t, const uint64_t *, const solution_settings_t [NON_NULL], |
| 24 | solution_list_t [static 1]); | 24 | solution_list_t [NON_NULL]); |
| 25 | 25 | ||
| 26 | void run(void) { | 26 | void run(void) { |
| 27 | int i, j, nnt, ntrans; | 27 | int i, j, nnt, ntrans; |
| @@ -39,7 +39,7 @@ void run(void) { | |||
| 39 | .unniss = false, | 39 | .unniss = false, |
| 40 | .maxmoves = 20, | 40 | .maxmoves = 20, |
| 41 | .maxsolutions = 100, | 41 | .maxsolutions = 100, |
| 42 | .optimal = -1, | 42 | .optimal = 0, |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | fgets(str, STRLENMAX, stdin); | 45 | fgets(str, STRLENMAX, stdin); |
| @@ -48,8 +48,8 @@ void run(void) { | |||
| 48 | printf("Test error reading moves\n"); | 48 | printf("Test error reading moves\n"); |
| 49 | return; | 49 | return; |
| 50 | } | 50 | } |
| 51 | moves.nmoves = nm; | 51 | moves.nmoves = (uint8_t)nm; |
| 52 | moves.npremoves = np; | 52 | moves.npremoves = (uint8_t)np; |
| 53 | fgets(str, STRLENMAX, stdin); | 53 | fgets(str, STRLENMAX, stdin); |
| 54 | settings.unniss = (bool)atoi(str); | 54 | settings.unniss = (bool)atoi(str); |
| 55 | 55 | ||
| @@ -64,7 +64,7 @@ void run(void) { | |||
| 64 | } | 64 | } |
| 65 | } | 65 | } |
| 66 | fgets(str, STRLENMAX, stdin); | 66 | fgets(str, STRLENMAX, stdin); |
| 67 | settings.orientation = atoi(str); | 67 | settings.orientation = (uint8_t)atoi(str); |
| 68 | 68 | ||
| 69 | appendsolution(&moves, nnt, tmask, &settings, &list); | 69 | appendsolution(&moves, nnt, tmask, &settings, &list); |
| 70 | 70 | ||
