From fc41f7917531693680b5baf71ffe38c47333fe84 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 6 Apr 2026 15:55:33 +0200 Subject: 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. --- tools/420_solvetest_h48_symmetric/solvetest.c | 2 +- tools/solvetest.h | 4 ++-- tools/tool.h | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'tools') 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 @@ -#define SOLVER "h48h3k2" +#define SOLVER "h48h3" #define NISSFLAG NISSY_NISSFLAG_NORMAL #define MINMOVES 0 #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( const char *aname, const char *bstr, const char *bname, - bool exp[static MAXSOLUTIONS] + bool *exp ) { size_t i, j, nn, lb; char b[MAX_SOLUTION_LEN]; @@ -130,7 +130,7 @@ int main(int argc, char **argv) { printf("Using user-specified solver %s\n", solver); } - srand(time(NULL)); + srand((unsigned)time(NULL)); nissy_setlogger(log_stderr, NULL); 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 @@ static void log_stderr(const char *, void *); static double timerun(void (*)(void)); static void writetable(const unsigned char *, int64_t, const char *); -static long long int generatetable(const char *, unsigned char **, - char [static NISSY_SIZE_DATAID]); +static long long int generatetable(const char *, unsigned char **, char *); static int getdata(const char *, unsigned char **, const char *); -static void gendata_run(const char *, uint64_t[static 21]); +static void gendata_run(const char *, uint64_t *); static void log_stderr(const char *str, void *unused) @@ -113,7 +112,7 @@ static long long int generatetable( const char *solver, unsigned char **buf, - char dataid[static NISSY_SIZE_DATAID] + char *dataid ) { long long int size, gensize; @@ -183,7 +182,7 @@ getdata_error_nofree: static void gendata_run( const char *solver, - uint64_t expected[static 21] + uint64_t *expected ) { long long int size; char filename[1024], dataid[NISSY_SIZE_DATAID]; -- cgit v1.3