aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-04-06 15:55:33 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2026-04-06 15:55:33 +0200
commitfc41f7917531693680b5baf71ffe38c47333fe84 (patch)
treea6e62232e05e7779034c5f9d1bf743b6f1c198e3 /tools
parentfe534f1497da6447153064d7bba00243000f803b (diff)
downloadnissy-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 'tools')
-rw-r--r--tools/420_solvetest_h48_symmetric/solvetest.c2
-rw-r--r--tools/solvetest.h4
-rw-r--r--tools/tool.h9
3 files changed, 7 insertions, 8 deletions
diff --git a/tools/420_solvetest_h48_symmetric/solvetest.c b/tools/420_solvetest_h48_symmetric/solvetest.c
index 245b7fe..45345eb 100644
--- a/tools/420_solvetest_h48_symmetric/solvetest.c
+++ b/tools/420_solvetest_h48_symmetric/solvetest.c
@@ -1,4 +1,4 @@
1#define SOLVER "h48h3k2" 1#define SOLVER "h48h3"
2#define NISSFLAG NISSY_NISSFLAG_NORMAL 2#define NISSFLAG NISSY_NISSFLAG_NORMAL
3#define MINMOVES 0 3#define MINMOVES 0
4#define MAXMOVES 20 4#define MAXMOVES 20
diff --git a/tools/solvetest.h b/tools/solvetest.h
index 75f7aab..8c93d21 100644
--- a/tools/solvetest.h
+++ b/tools/solvetest.h
@@ -13,7 +13,7 @@ bool check_one(
13 const char *aname, 13 const char *aname,
14 const char *bstr, 14 const char *bstr,
15 const char *bname, 15 const char *bname,
16 bool exp[static MAXSOLUTIONS] 16 bool *exp
17) { 17) {
18 size_t i, j, nn, lb; 18 size_t i, j, nn, lb;
19 char b[MAX_SOLUTION_LEN]; 19 char b[MAX_SOLUTION_LEN];
@@ -130,7 +130,7 @@ int main(int argc, char **argv) {
130 printf("Using user-specified solver %s\n", solver); 130 printf("Using user-specified solver %s\n", solver);
131 } 131 }
132 132
133 srand(time(NULL)); 133 srand((unsigned)time(NULL));
134 nissy_setlogger(log_stderr, NULL); 134 nissy_setlogger(log_stderr, NULL);
135 135
136 size = nissy_solverinfo(solver, dataid); 136 size = nissy_solverinfo(solver, dataid);
diff --git a/tools/tool.h b/tools/tool.h
index 96e7f27..582e2ce 100644
--- a/tools/tool.h
+++ b/tools/tool.h
@@ -18,10 +18,9 @@
18static void log_stderr(const char *, void *); 18static void log_stderr(const char *, void *);
19static double timerun(void (*)(void)); 19static double timerun(void (*)(void));
20static void writetable(const unsigned char *, int64_t, const char *); 20static void writetable(const unsigned char *, int64_t, const char *);
21static long long int generatetable(const char *, unsigned char **, 21static long long int generatetable(const char *, unsigned char **, char *);
22 char [static NISSY_SIZE_DATAID]);
23static int getdata(const char *, unsigned char **, const char *); 22static int getdata(const char *, unsigned char **, const char *);
24static void gendata_run(const char *, uint64_t[static 21]); 23static void gendata_run(const char *, uint64_t *);
25 24
26static void 25static void
27log_stderr(const char *str, void *unused) 26log_stderr(const char *str, void *unused)
@@ -113,7 +112,7 @@ static long long int
113generatetable( 112generatetable(
114 const char *solver, 113 const char *solver,
115 unsigned char **buf, 114 unsigned char **buf,
116 char dataid[static NISSY_SIZE_DATAID] 115 char *dataid
117) 116)
118{ 117{
119 long long int size, gensize; 118 long long int size, gensize;
@@ -183,7 +182,7 @@ getdata_error_nofree:
183static void 182static void
184gendata_run( 183gendata_run(
185 const char *solver, 184 const char *solver,
186 uint64_t expected[static 21] 185 uint64_t *expected
187) { 186) {
188 long long int size; 187 long long int size;
189 char filename[1024], dataid[NISSY_SIZE_DATAID]; 188 char filename[1024], dataid[NISSY_SIZE_DATAID];

Generated with cgit - Back to sebastiano.tronto.net