Skip to content

Commit

Permalink
Add _MSC_VER guards around gnu-specific attributes to avoid warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
medoc92 committed Jan 29, 2024
1 parent 4a31db4 commit 0f9c23e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions inc/upnpdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ EXPORT_SPEC FILE *UpnpGetDebugFile(
Dbg_Module module);

/* This enables printf like format checking by the compiler. */
#ifndef _MSC_VER
#ifdef __MINGW32__
[[gnu::format(__MINGW_PRINTF_FORMAT, 5, 6)]]
#else
[[gnu::format(printf, 5, 6)]]
#endif
#endif // !_MSC_VER
/** @brief Prints the debug statement to the current output */
EXPORT_SPEC void UpnpPrintf(
/** [in] Message level, to be compared to the current verbosity. */
Expand Down
2 changes: 2 additions & 0 deletions src/dispatcher/miniserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,13 @@ static int available_port(int reqport)
}

/* This enables printf like format checking by the compiler. */
#ifndef _MSC_VER
#ifdef __MINGW32__
[[gnu::format(__MINGW_PRINTF_FORMAT, 2, 0)]]
#else
[[gnu::format(printf, 2, 0)]]
#endif
#endif // !_MSC_VER
static void mhdlogger(void *, const char *fmt, va_list ap)
{
char buf[1024];
Expand Down

0 comments on commit 0f9c23e

Please sign in to comment.