Skip to content

Commit

Permalink
wm_error: Allow the use of __FUNCTION__ or __func__ when available,
Browse files Browse the repository at this point in the history
.. and disable -Wpedantic for gcc >= 4.6 and clang. This uncripples
debug messages when not building in c99 mode since commit 4731033
Reference issue: #243
  • Loading branch information
sezero committed Apr 4, 2024
1 parent 1cf3908 commit 77edece
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions include/wm_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,29 @@ enum {
extern char * _WM_Global_ErrorS;
extern int _WM_Global_ErrorI;

/* This is for https://github.com/Mindwerks/wildmidi/pull/243
* Change to 0 if you really want to see -Wpedantic warnings. */
#define KILL_PEDANTIC_WARNS 1

/* TODO: add more here as needed. */
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined(__cplusplus) && __cplusplus >= 201103L)
#define _WM_FUNCTION __func__
#elif defined(__clang__)
#define _WM_FUNCTION __func__
#if KILL_PEDANTIC_WARNS
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#elif defined(__GNUC__) && (__GNUC__ >= 3)
#define _WM_FUNCTION __func__
#if (__GNUC__ >= 5) && KILL_PEDANTIC_WARNS
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#elif defined(__GNUC__)
#define _WM_FUNCTION __FUNCTION__
#elif defined(__WATCOMC__)
#define _WM_FUNCTION __FUNCTION__
#elif defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__FUNCTION__) /* VC7 (Visual Studio .NET) and newer. */
#define _WM_FUNCTION __FUNCTION__
#else
#define _WM_FUNCTION "<unknown>"
#endif
Expand Down

0 comments on commit 77edece

Please sign in to comment.