diff --git a/src/tools/mdbx_chk.c b/src/tools/mdbx_chk.c index 7a93d70d..f1619965 100644 --- a/src/tools/mdbx_chk.c +++ b/src/tools/mdbx_chk.c @@ -18,7 +18,14 @@ #pragma warning(disable : 4464) /* relative include path contains '..' */ #endif #pragma warning(disable : 4996) /* The POSIX name is deprecated... */ -#endif /* _MSC_VER */ +#if _MSC_VER == 1900 +/* LY: MSVC 2015 has buggy/inconsistent PRIuPTR/PRIxPTR macros and format-arg + checker for size_t typedef. */ +#pragma warning(disable : 4777) /* format string '%10u' requires an argument \ + of type 'unsigned int', but variadic \ + argument 1 has type 'std::size_t' */ +#endif +#endif /* _MSC_VER (warnings) */ #include "../bits.h" @@ -203,7 +210,7 @@ static void problem_add(const char *object, uint64_t entry_number, } } -static struct problem *problems_push() { +static struct problem *problems_push(void) { struct problem *p = problems_list; problems_list = NULL; return p; diff --git a/src/tools/mdbx_copy.c b/src/tools/mdbx_copy.c index 2e384cac..ec0856ca 100644 --- a/src/tools/mdbx_copy.c +++ b/src/tools/mdbx_copy.c @@ -18,7 +18,14 @@ #pragma warning(disable : 4464) /* relative include path contains '..' */ #endif #pragma warning(disable : 4996) /* The POSIX name is deprecated... */ -#endif /* _MSC_VER */ +#if _MSC_VER == 1900 +/* LY: MSVC 2015 has buggy/inconsistent PRIuPTR/PRIxPTR macros and format-arg + checker for size_t typedef. */ +#pragma warning(disable : 4777) /* format string '%10u' requires an argument \ + of type 'unsigned int', but variadic \ + argument 1 has type 'std::size_t' */ +#endif +#endif /* _MSC_VER (warnings) */ #include "../bits.h" diff --git a/src/tools/mdbx_dump.c b/src/tools/mdbx_dump.c index 71c300dd..19010c47 100644 --- a/src/tools/mdbx_dump.c +++ b/src/tools/mdbx_dump.c @@ -18,7 +18,14 @@ #pragma warning(disable : 4464) /* relative include path contains '..' */ #endif #pragma warning(disable : 4996) /* The POSIX name is deprecated... */ -#endif /* _MSC_VER */ +#if _MSC_VER == 1900 +/* LY: MSVC 2015 has buggy/inconsistent PRIuPTR/PRIxPTR macros and format-arg + checker for size_t typedef. */ +#pragma warning(disable : 4777) /* format string '%10u' requires an argument \ + of type 'unsigned int', but variadic \ + argument 1 has type 'std::size_t' */ +#endif +#endif /* _MSC_VER (warnings) */ #include "../bits.h" #include diff --git a/src/tools/mdbx_load.c b/src/tools/mdbx_load.c index 16180e86..0c20b1e7 100644 --- a/src/tools/mdbx_load.c +++ b/src/tools/mdbx_load.c @@ -18,7 +18,14 @@ #pragma warning(disable : 4464) /* relative include path contains '..' */ #endif #pragma warning(disable : 4996) /* The POSIX name is deprecated... */ -#endif /* _MSC_VER */ +#if _MSC_VER == 1900 +/* LY: MSVC 2015 has buggy/inconsistent PRIuPTR/PRIxPTR macros and format-arg + checker for size_t typedef. */ +#pragma warning(disable : 4777) /* format string '%10u' requires an argument \ + of type 'unsigned int', but variadic \ + argument 1 has type 'std::size_t' */ +#endif +#endif /* _MSC_VER (warnings) */ #include "../bits.h" #include diff --git a/src/tools/mdbx_stat.c b/src/tools/mdbx_stat.c index 7fbe924b..9b65d992 100644 --- a/src/tools/mdbx_stat.c +++ b/src/tools/mdbx_stat.c @@ -18,7 +18,14 @@ #pragma warning(disable : 4464) /* relative include path contains '..' */ #endif #pragma warning(disable : 4996) /* The POSIX name is deprecated... */ -#endif /* _MSC_VER */ +#if _MSC_VER == 1900 +/* LY: MSVC 2015 has buggy/inconsistent PRIuPTR/PRIxPTR macros and format-arg + checker for size_t typedef. */ +#pragma warning(disable : 4777) /* format string '%10u' requires an argument \ + of type 'unsigned int', but variadic \ + argument 1 has type 'std::size_t' */ +#endif +#endif /* _MSC_VER (warnings) */ #include "../bits.h" diff --git a/src/tools/wingetopt.c b/src/tools/wingetopt.c index 3762ecae..8059e5d9 100644 --- a/src/tools/wingetopt.c +++ b/src/tools/wingetopt.c @@ -20,9 +20,6 @@ #define ERR(s, c) \ if (opterr) { \ - char errbuf[2]; \ - errbuf[0] = (char)c; \ - errbuf[1] = '\n'; \ fputs(argv[0], stderr); \ fputs(s, stderr); \ fputc(c, stderr); \ @@ -38,13 +35,14 @@ int getopt(int argc, char *const argv[], const char *opts) { int c; char *cp; - if (sp == 1) + if (sp == 1) { if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') return EOF; else if (strcmp(argv[optind], "--") == 0) { optind++; return EOF; } + } optopt = c = argv[optind][sp]; if (c == ':' || (cp = strchr(opts, c)) == NULL) { ERR(": illegal option -- ", c);