about summary refs log tree commit diff
path: root/pkgs/applications/audio/ensemble-chorus/juice-cxx-packing-fix.diff
blob: 041f252a81e025d157bf11637590a13770a64c8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
diff --git a/thirdparty/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h b/thirdparty/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h
index 69a66e4..3e50635 100644
--- a/thirdparty/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h
+++ b/thirdparty/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h
@@ -111,18 +111,10 @@ public:
     forcedinline uint8 getGreen() const noexcept      { return components.g; }
     forcedinline uint8 getBlue() const noexcept       { return components.b; }
 
-   #if JUCE_GCC
-    // NB these are here as a workaround because GCC refuses to bind to packed values.
-    forcedinline uint8& getAlpha() noexcept           { return comps [indexA]; }
-    forcedinline uint8& getRed() noexcept             { return comps [indexR]; }
-    forcedinline uint8& getGreen() noexcept           { return comps [indexG]; }
-    forcedinline uint8& getBlue() noexcept            { return comps [indexB]; }
-   #else
     forcedinline uint8& getAlpha() noexcept           { return components.a; }
     forcedinline uint8& getRed() noexcept             { return components.r; }
     forcedinline uint8& getGreen() noexcept           { return components.g; }
     forcedinline uint8& getBlue() noexcept            { return components.b; }
-   #endif
 
     //==============================================================================
     /** Copies another pixel colour over this one.
@@ -336,21 +328,22 @@ private:
         uint8 b, g, r, a;
        #endif
       #endif
-    } JUCE_PACKED;
+    };
+
+    // structure must be packed but using the packed attribute causes compile
+    // failures with newer c++ compilers. Verify default packing produces same layout
+    static_assert(sizeof(Components) == 4, "Components struct is not packed");
 
     union
     {
         uint32 internal;
         Components components;
-       #if JUCE_GCC
-        uint8 comps[4];  // helper struct needed because gcc does not allow references to packed union members
-       #endif
     };
-}
-#ifndef DOXYGEN
- JUCE_PACKED
-#endif
-;
+};
+
+// class must be packed but using the packed attribute causes compile
+// failures with newer c++ compilers. Verify default packing produces same layout
+static_assert(sizeof(PixelARGB) == 4, "PixelARGB class is not packed");
 
 
 //==============================================================================