From c707dc4da2d2a60ee80124b3a7f392465c69d83d Mon Sep 17 00:00:00 2001 From: Charles Nicholson Date: Sat, 3 Dec 2022 15:57:18 -0500 Subject: [PATCH] New MSVC support, license update, tiny simplification (#237) * just write 1 to cbuf_len instead of incrementing, for percent and char * shut up msvc about implicit fall-through, it's intentional * shut up msvc about doctest * more msvc fixing * bump paland * shut up msvc about doctest * shut up msvc about doctest --- LICENSE | 4 ++++ nanoprintf.h | 11 ++++++----- tests/conformance.cc | 1 + tests/doctest_main.cc | 2 ++ tests/mpaland-conformance | 2 +- tests/unit_nanoprintf.h | 1 + 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/LICENSE b/LICENSE index f5c43559..039373b6 100644 --- a/LICENSE +++ b/LICENSE @@ -4,6 +4,10 @@ structure is to make nanoprintf as consumable as possible in as many environments / countries / companies as possible without encumbering users. +This license applies to all of the nanoprintf source code, build code, +and tests, with the explicit exception of doctest.h, which exists under +its own license and is included in this repository. + The text of the two licenses follows below: ============================== UNLICENSE ============================== diff --git a/nanoprintf.h b/nanoprintf.h index 755590af..214b0919 100644 --- a/nanoprintf.h +++ b/nanoprintf.h @@ -162,13 +162,14 @@ NPF_VISIBILITY int npf_vpprintf( #pragma warning(push) #pragma warning(disable:4514) // unreferenced inline function removed #pragma warning(disable:4505) // unreferenced function removed - #pragma warning(disable:4820) // padding after data member - #pragma warning(disable:5039) // extern "C" throw - #pragma warning(disable:5045) // spectre mitigation #pragma warning(disable:4701) // possibly uninitialized #pragma warning(disable:4706) // assignment in conditional #pragma warning(disable:4710) // not inlined #pragma warning(disable:4711) // selected for inline + #pragma warning(disable:4820) // padding after data member + #pragma warning(disable:5039) // extern "C" throw + #pragma warning(disable:5045) // spectre mitigation + #pragma warning(disable:5262) // implicit switch fall-through #endif #if (NANOPRINTF_USE_FIELD_WIDTH_FORMAT_SPECIFIERS == 1) || \ @@ -751,12 +752,12 @@ int npf_vpprintf(npf_putc pc, void *pc_ctx, char const *format, va_list args) { switch (fs.conv_spec) { case NPF_FMT_SPEC_CONV_PERCENT: *cbuf = '%'; - ++cbuf_len; + cbuf_len = 1; break; case NPF_FMT_SPEC_CONV_CHAR: *cbuf = (char)va_arg(args, int); - ++cbuf_len; + cbuf_len = 1; break; case NPF_FMT_SPEC_CONV_STRING: { diff --git a/tests/conformance.cc b/tests/conformance.cc index 1c8ab59a..2fe8d334 100644 --- a/tests/conformance.cc +++ b/tests/conformance.cc @@ -7,6 +7,7 @@ #pragma warning(disable:5039) // extern "c" throw #pragma warning(disable:4710) // function not inlined #pragma warning(disable:4711) // selected for inline + #pragma warning(disable:5264) // const variable not used (shut up doctest) #endif #define NANOPRINTF_IMPLEMENTATION diff --git a/tests/doctest_main.cc b/tests/doctest_main.cc index ad158d98..b8081c3e 100644 --- a/tests/doctest_main.cc +++ b/tests/doctest_main.cc @@ -1,5 +1,7 @@ #ifdef _MSC_VER #pragma warning(disable:5246) // initialization of subobject needs braces + #pragma warning(disable:5262) // implicit switch fall-through + #pragma warning(disable:5264) // unused const variable #endif #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN diff --git a/tests/mpaland-conformance b/tests/mpaland-conformance index fc2ecae3..d0c67966 160000 --- a/tests/mpaland-conformance +++ b/tests/mpaland-conformance @@ -1 +1 @@ -Subproject commit fc2ecae36fc3e11d98cbe76c9ab027ee2642274f +Subproject commit d0c67966b538efa18ef8d2b767492072c6f20c69 diff --git a/tests/unit_nanoprintf.h b/tests/unit_nanoprintf.h index 3af18973..2ea8b765 100644 --- a/tests/unit_nanoprintf.h +++ b/tests/unit_nanoprintf.h @@ -30,6 +30,7 @@ #pragma warning(disable:4711) // function was inlined #pragma warning(disable:4514) // unreferenced inline function has been removed #pragma warning(disable:5039) // could throw inside extern c function + #pragma warning(disable:5264) // const variable not used (shut up doctest) #endif #include "doctest.h"