Skip to content

Commit 00985b6

Browse files
committed
Use a custom WARNING() macro instead of relying on #warning
Signed-off-by: falkTX <falktx@falktx.com>
1 parent e5ce30a commit 00985b6

6 files changed

Lines changed: 16 additions & 9 deletions

File tree

distrho/DistrhoUIMain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#elif defined(DISTRHO_PLUGIN_TARGET_LV2)
3939
# if defined(DISTRHO_PLUGIN_AND_UI_IN_SINGLE_OBJECT)
4040
# if ! DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
41-
# warning Using single/monolithic LV2 target while DISTRHO_PLUGIN_WANT_DIRECT_ACCESS is 0
41+
WARNING("Using single/monolithic LV2 target while DISTRHO_PLUGIN_WANT_DIRECT_ACCESS is 0")
4242
# endif
4343
# else
4444
# define DISTRHO_PLUGIN_AND_UI_IN_SINGLE_OBJECT DISTRHO_PLUGIN_WANT_DIRECT_ACCESS

distrho/extra/Mutex.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
// FIXME make Mutex stop relying on pthread
3131
#ifdef _MSC_VER
3232
#define DISTRHO_OS_WINDOWS__TODO
33-
#pragma NOTE(DPF Mutex implementation is TODO on MSVC)
33+
WARNING("DPF Mutex implementation is TODO on MSVC")
3434
#else
3535
#include <pthread.h>
3636
#endif

distrho/src/DistrhoDefines.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 480
8787
# define DISTRHO_DEPRECATED __attribute__((deprecated))
8888
#elif defined(_MSC_VER)
89-
# define DISTRHO_DEPRECATED [[deprecated]] /* Note: __declspec(deprecated) it not applicable to enum members */
89+
# define DISTRHO_DEPRECATED [[deprecated]] /* Note: __declspec(deprecated) is not applicable to enum members */
9090
#else
9191
# define DISTRHO_DEPRECATED
9292
#endif
@@ -221,6 +221,13 @@ private: \
221221
#define CPP_AGGREGATE_INIT(ClassName) (ClassName)
222222
#endif
223223

224+
#define _PRAGMA_HELPER(x) _Pragma(#x)
225+
#if defined(_MSC_VER)
226+
#define WARNING(msg) _PRAGMA_HELPER(message(__FILE__ ": warning: " msg))
227+
#elif defined(__GNUC__)
228+
#define WARNING(msg) _PRAGMA_HELPER(GCC warning msg)
229+
#endif
230+
224231
/* Useful typedefs */
225232
typedef unsigned char uchar;
226233
typedef unsigned short int ushort;

distrho/src/DistrhoPluginChecks.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
// Test for wrong compiler macros
149149

150150
#if defined(DISTRHO_PLUGIN_HAS_EMBED_UI)
151-
# warning DISTRHO_PLUGIN_HAS_EMBED_UI has been removed, it is now always on
151+
WARNING("DISTRHO_PLUGIN_HAS_EMBED_UI has been removed, it is now always on")
152152
#endif
153153

154154
#if defined(DISTRHO_PLUGIN_HAS_EXTERNAL_UI)
@@ -202,7 +202,7 @@
202202
// Enable state if plugin wants state files (deprecated)
203203

204204
#ifdef DISTRHO_PLUGIN_WANT_STATEFILES
205-
# warning DISTRHO_PLUGIN_WANT_STATEFILES is deprecated
205+
WARNING("DISTRHO_PLUGIN_WANT_STATEFILES is deprecated")
206206
# undef DISTRHO_PLUGIN_WANT_STATEFILES
207207
# if ! DISTRHO_PLUGIN_WANT_STATE
208208
# undef DISTRHO_PLUGIN_WANT_STATE
@@ -214,7 +214,7 @@
214214
// Enable full state if plugin exports presets
215215

216216
#if DISTRHO_PLUGIN_WANT_PROGRAMS && DISTRHO_PLUGIN_WANT_STATE && defined(DISTRHO_PLUGIN_WANT_FULL_STATE_WAS_NOT_SET)
217-
# warning Plugins with programs and state should implement full state API too
217+
WARNING("Plugins with programs and state should implement full state API too")
218218
# undef DISTRHO_PLUGIN_WANT_FULL_STATE
219219
# define DISTRHO_PLUGIN_WANT_FULL_STATE 1
220220
#endif

distrho/src/DistrhoPluginLADSPA+DSSI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#endif
2828

2929
#if DISTRHO_PLUGIN_WANT_TIMEPOS && !defined(DISTRHO_NO_WARNINGS)
30-
# warning LADSPA/DSSI does not support TimePos
30+
WARNING("LADSPA/DSSI does not support TimePos")
3131
#endif
3232

3333
#ifdef DISTRHO_PLUGIN_TARGET_DSSI
@@ -38,7 +38,7 @@
3838
# error Cannot use MIDI with LADSPA
3939
# endif
4040
# if DISTRHO_PLUGIN_WANT_STATE && !defined(DISTRHO_NO_WARNINGS)
41-
# warning LADSPA cannot handle states
41+
WARNING("LADSPA cannot handle states")
4242
# endif
4343
#endif
4444

distrho/src/DistrhoPluginVST2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ class PluginVst : public ParameterAndNotesHelper
426426
fUsingNsView = true;
427427
#else
428428
#ifndef DISTRHO_NO_WARNINGS
429-
#warning 32bit VST UIs on macOS only work if the host supports "hasCockosViewAsConfig"
429+
WARNING("32bit VST UIs on macOS only work if the host supports 'hasCockosViewAsConfig'")
430430
#endif
431431
fUsingNsView = false;
432432
#endif

0 commit comments

Comments
 (0)