From a733e962286c1c05edcc3f7633bfed7d84df54d3 Mon Sep 17 00:00:00 2001 From: jatin Date: Wed, 20 Mar 2024 12:38:47 -0700 Subject: [PATCH 1/3] Avoiding name clashes in moodycamel headers if the user already has them available in their include path --- .../chowdsp_dsp_data_structures.h | 31 +++++++++++++++++-- .../Backend/chowdsp_ParameterListeners.h | 4 +++ .../chowdsp_DeferredMainThreadAction.h | 4 +++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h b/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h index 590847bc4..2968e1a80 100644 --- a/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h +++ b/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h @@ -29,10 +29,37 @@ BEGIN_JUCE_MODULE_DECLARATION #include #include + +/** Config: CHOWDSP_USE_MOODYCAMEL_READERWRITERQUEUE_FROM_INCLUDE_PATH + If your project already has moodycamel's readerwriterqueue.h in its + include paths, define this to use that instead of the internally + available header. +*/ +#ifndef CHOWDSP_USE_MOODYCAMEL_READERWRITERQUEUE_FROM_INCLUDE_PATH +#define CHOWDSP_USE_MOODYCAMEL_READERWRITERQUEUE_FROM_INCLUDE_PATH 0 +#endif + +/** Config: CHOWDSP_USE_MOODYCAMEL_CONCURRENTQUEUE_FROM_INCLUDE_PATH + If your project already has moodycamel's concurrentqueue.h in its + include paths, define this to use that instead of the internally + available header. +*/ +#ifndef CHOWDSP_USE_MOODYCAMEL_CONCURRENTQUEUE_FROM_INCLUDE_PATH +#define CHOWDSP_USE_MOODYCAMEL_CONCURRENTQUEUE_FROM_INCLUDE_PATH 0 +#endif + // third-party includes #if ! JUCE_TEENSY // readerwriterqueue does not compile with the Teensy toolchain -#include "third_party/moodycamel/readerwriterqueue.h" -#include "third_party/moodycamel/concurrentqueue.h" + #if CHOWDSP_USE_MOODYCAMEL_READERWRITERQUEUE_FROM_INCLUDE_PATH + #include + #else + #include "third_party/moodycamel/readerwriterqueue.h" + #endif + #if CHOWDSP_USE_MOODYCAMEL_CONCURRENTQUEUE_FROM_INCLUDE_PATH + #include + #else + #include "third_party/moodycamel/concurrentqueue.h" + #endif #endif #include "Other/chowdsp_SmoothedBufferValue.h" diff --git a/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h b/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h index 527868d7c..523dd8d0c 100644 --- a/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h +++ b/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h @@ -11,8 +11,12 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE #if JUCE_MODULE_AVAILABLE_chowdsp_dsp_data_structures #include #else +#if CHOWDSP_USE_MOODYCAMEL_READERWRITERQUEUE_FROM_INCLUDE_PATH +#include +#else #include "../../../dsp/chowdsp_dsp_data_structures/third_party/moodycamel/readerwriterqueue.h" #endif +#endif namespace chowdsp { diff --git a/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h b/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h index 4d0394284..3c4e20321 100644 --- a/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h +++ b/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h @@ -11,8 +11,12 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE #if JUCE_MODULE_AVAILABLE_chowdsp_dsp_data_structures #include #else +#if CHOWDSP_USE_MOODYCAMEL_CONCURRENTQUEUE_FROM_INCLUDE_PATH +#include +#else #include "../../../dsp/chowdsp_dsp_data_structures/third_party/moodycamel/concurrentqueue.h" #endif +#endif namespace chowdsp { From aa89b20552a98de76bdea59e5f4333368865459b Mon Sep 17 00:00:00 2001 From: jatin Date: Wed, 20 Mar 2024 14:07:03 -0700 Subject: [PATCH 2/3] Using __has_include --- .../chowdsp_dsp_data_structures.h | 23 ++----------------- .../Backend/chowdsp_ParameterListeners.h | 2 +- .../chowdsp_DeferredMainThreadAction.h | 2 +- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h b/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h index 2968e1a80..b2cd7cf92 100644 --- a/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h +++ b/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h @@ -29,33 +29,14 @@ BEGIN_JUCE_MODULE_DECLARATION #include #include - -/** Config: CHOWDSP_USE_MOODYCAMEL_READERWRITERQUEUE_FROM_INCLUDE_PATH - If your project already has moodycamel's readerwriterqueue.h in its - include paths, define this to use that instead of the internally - available header. -*/ -#ifndef CHOWDSP_USE_MOODYCAMEL_READERWRITERQUEUE_FROM_INCLUDE_PATH -#define CHOWDSP_USE_MOODYCAMEL_READERWRITERQUEUE_FROM_INCLUDE_PATH 0 -#endif - -/** Config: CHOWDSP_USE_MOODYCAMEL_CONCURRENTQUEUE_FROM_INCLUDE_PATH - If your project already has moodycamel's concurrentqueue.h in its - include paths, define this to use that instead of the internally - available header. -*/ -#ifndef CHOWDSP_USE_MOODYCAMEL_CONCURRENTQUEUE_FROM_INCLUDE_PATH -#define CHOWDSP_USE_MOODYCAMEL_CONCURRENTQUEUE_FROM_INCLUDE_PATH 0 -#endif - // third-party includes #if ! JUCE_TEENSY // readerwriterqueue does not compile with the Teensy toolchain - #if CHOWDSP_USE_MOODYCAMEL_READERWRITERQUEUE_FROM_INCLUDE_PATH + #if __has_include () #include #else #include "third_party/moodycamel/readerwriterqueue.h" #endif - #if CHOWDSP_USE_MOODYCAMEL_CONCURRENTQUEUE_FROM_INCLUDE_PATH + #if __has_include () #include #else #include "third_party/moodycamel/concurrentqueue.h" diff --git a/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h b/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h index 523dd8d0c..69c81daa8 100644 --- a/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h +++ b/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h @@ -11,7 +11,7 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE #if JUCE_MODULE_AVAILABLE_chowdsp_dsp_data_structures #include #else -#if CHOWDSP_USE_MOODYCAMEL_READERWRITERQUEUE_FROM_INCLUDE_PATH +#if __has_include () #include #else #include "../../../dsp/chowdsp_dsp_data_structures/third_party/moodycamel/readerwriterqueue.h" diff --git a/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h b/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h index 3c4e20321..7b5dea07a 100644 --- a/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h +++ b/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h @@ -11,7 +11,7 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE #if JUCE_MODULE_AVAILABLE_chowdsp_dsp_data_structures #include #else -#if CHOWDSP_USE_MOODYCAMEL_CONCURRENTQUEUE_FROM_INCLUDE_PATH +#if __has_include () #include #else #include "../../../dsp/chowdsp_dsp_data_structures/third_party/moodycamel/concurrentqueue.h" From 2afdbbf3a1096b8e5ac254497124e98435cee54d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 20 Mar 2024 21:08:39 +0000 Subject: [PATCH 3/3] Apply clang-format --- .../chowdsp_dsp_data_structures.h | 20 +++++++++---------- .../Backend/chowdsp_ParameterListeners.h | 2 +- .../chowdsp_DeferredMainThreadAction.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h b/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h index b2cd7cf92..726f10d25 100644 --- a/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h +++ b/modules/dsp/chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h @@ -31,16 +31,16 @@ BEGIN_JUCE_MODULE_DECLARATION // third-party includes #if ! JUCE_TEENSY // readerwriterqueue does not compile with the Teensy toolchain - #if __has_include () - #include - #else - #include "third_party/moodycamel/readerwriterqueue.h" - #endif - #if __has_include () - #include - #else - #include "third_party/moodycamel/concurrentqueue.h" - #endif +#if __has_include() +#include +#else +#include "third_party/moodycamel/readerwriterqueue.h" +#endif +#if __has_include() +#include +#else +#include "third_party/moodycamel/concurrentqueue.h" +#endif #endif #include "Other/chowdsp_SmoothedBufferValue.h" diff --git a/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h b/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h index 69c81daa8..5f332949e 100644 --- a/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h +++ b/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParameterListeners.h @@ -11,7 +11,7 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE #if JUCE_MODULE_AVAILABLE_chowdsp_dsp_data_structures #include #else -#if __has_include () +#if __has_include() #include #else #include "../../../dsp/chowdsp_dsp_data_structures/third_party/moodycamel/readerwriterqueue.h" diff --git a/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h b/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h index 7b5dea07a..35260b012 100644 --- a/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h +++ b/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h @@ -11,7 +11,7 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE #if JUCE_MODULE_AVAILABLE_chowdsp_dsp_data_structures #include #else -#if __has_include () +#if __has_include() #include #else #include "../../../dsp/chowdsp_dsp_data_structures/third_party/moodycamel/concurrentqueue.h"