Skip to content

Commit

Permalink
explicitly set the C version to C99, fix linux-clang which seems to h…
Browse files Browse the repository at this point in the history
…ave gotten a bit more pedantic (#214)

* explicitly set the C version to C99, fix linux-clang which seems to have gotten a bit more pedantic

* silence declaration-after-statement now that C++17/C99 are guaranteed

* placate this stupid new warning
  • Loading branch information
charlesnicholson authored Apr 24, 2022
1 parent 3f7cf35 commit 6835c79
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ endif()

################ Common compile flags

set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 17)

if (MSVC)
Expand Down
1 change: 1 addition & 0 deletions nanoprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ NPF_VISIBILITY int npf_vpprintf(npf_putc pc, void *pc_ctx, char const *format,
#if NANOPRINTF_CLANG
#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic"
#pragma GCC diagnostic ignored "-Wcovered-switch-default"
#pragma GCC diagnostic ignored "-Wdeclaration-after-statement"
#elif NANOPRINTF_GCC_PAST_4_6
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
Expand Down
2 changes: 1 addition & 1 deletion tests/include_multiple.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#include <stdio.h>

int main(int c, char const *v[]) {
char buf[64];
(void)c;
(void)v;
char buf[64];
npf_snprintf(buf, sizeof(buf), "%s", "hello");
printf("%s\n", buf);
}

0 comments on commit 6835c79

Please sign in to comment.