Skip to content

Commit

Permalink
fix printf format for MinGW (#942)
Browse files Browse the repository at this point in the history
With gcc, mingw uses gnu_printf. With clang, printf is used as it does
not support gnu_printf. Use the internal header to match this properly.

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb authored Dec 3, 2023
1 parent ed0420f commit e6bb912
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions al/effects/effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class effect_exception final : public al::base_exception {
ALenum mErrorCode;

public:
#ifdef __USE_MINGW_ANSI_STDIO
[[gnu::format(gnu_printf, 3, 4)]]
#ifdef __MINGW32__
[[gnu::format(__MINGW_PRINTF_FORMAT, 3, 4)]]
#else
[[gnu::format(printf, 3, 4)]]
#endif
Expand Down
4 changes: 2 additions & 2 deletions al/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class filter_exception final : public al::base_exception {
ALenum mErrorCode;

public:
#ifdef __USE_MINGW_ANSI_STDIO
[[gnu::format(gnu_printf, 3, 4)]]
#ifdef __MINGW32__
[[gnu::format(__MINGW_PRINTF_FORMAT, 3, 4)]]
#else
[[gnu::format(printf, 3, 4)]]
#endif
Expand Down
4 changes: 2 additions & 2 deletions alc/backends/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ class backend_exception final : public base_exception {
backend_error mErrorCode;

public:
#ifdef __USE_MINGW_ANSI_STDIO
[[gnu::format(gnu_printf, 3, 4)]]
#ifdef __MINGW32__
[[gnu::format(__MINGW_PRINTF_FORMAT, 3, 4)]]
#else
[[gnu::format(printf, 3, 4)]]
#endif
Expand Down
4 changes: 2 additions & 2 deletions alc/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase {
*/
void applyAllUpdates();

#ifdef __USE_MINGW_ANSI_STDIO
[[gnu::format(gnu_printf, 3, 4)]]
#ifdef __MINGW32__
[[gnu::format(__MINGW_PRINTF_FORMAT, 3, 4)]]
#else
[[gnu::format(printf, 3, 4)]]
#endif
Expand Down
4 changes: 2 additions & 2 deletions core/ambdec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ enum class ReaderScope {
HFMatrix,
};

#ifdef __USE_MINGW_ANSI_STDIO
[[gnu::format(gnu_printf,2,3)]]
#ifdef __MINGW32__
[[gnu::format(__MINGW_PRINTF_FORMAT,2,3)]]
#else
[[gnu::format(printf,2,3)]]
#endif
Expand Down
4 changes: 2 additions & 2 deletions core/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ struct DeviceBase {
void renderSamples(void *outBuffer, const uint numSamples, const size_t frameStep);

/* Caller must lock the device state, and the mixer must not be running. */
#ifdef __USE_MINGW_ANSI_STDIO
[[gnu::format(gnu_printf,2,3)]]
#ifdef __MINGW32__
[[gnu::format(__MINGW_PRINTF_FORMAT,2,3)]]
#else
[[gnu::format(printf,2,3)]]
#endif
Expand Down
4 changes: 2 additions & 2 deletions core/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ using LogCallbackFunc = void(*)(void *userptr, char level, const char *message,
void al_set_log_callback(LogCallbackFunc callback, void *userptr);


#ifdef __USE_MINGW_ANSI_STDIO
[[gnu::format(gnu_printf,2,3)]]
#ifdef __MINGW32__
[[gnu::format(__MINGW_PRINTF_FORMAT,2,3)]]
#else
[[gnu::format(printf,2,3)]]
#endif
Expand Down

0 comments on commit e6bb912

Please sign in to comment.