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 /tools/tool.h | |
| 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 'tools/tool.h')
| -rw-r--r-- | tools/tool.h | 9 |
1 files changed, 4 insertions, 5 deletions
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 @@ | |||
| 18 | static void log_stderr(const char *, void *); | 18 | static void log_stderr(const char *, void *); |
| 19 | static double timerun(void (*)(void)); | 19 | static double timerun(void (*)(void)); |
| 20 | static void writetable(const unsigned char *, int64_t, const char *); | 20 | static void writetable(const unsigned char *, int64_t, const char *); |
| 21 | static long long int generatetable(const char *, unsigned char **, | 21 | static long long int generatetable(const char *, unsigned char **, char *); |
| 22 | char [static NISSY_SIZE_DATAID]); | ||
| 23 | static int getdata(const char *, unsigned char **, const char *); | 22 | static int getdata(const char *, unsigned char **, const char *); |
| 24 | static void gendata_run(const char *, uint64_t[static 21]); | 23 | static void gendata_run(const char *, uint64_t *); |
| 25 | 24 | ||
| 26 | static void | 25 | static void |
| 27 | log_stderr(const char *str, void *unused) | 26 | log_stderr(const char *str, void *unused) |
| @@ -113,7 +112,7 @@ static long long int | |||
| 113 | generatetable( | 112 | generatetable( |
| 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: | |||
| 183 | static void | 182 | static void |
| 184 | gendata_run( | 183 | gendata_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]; |
