From 3ccb62538dac24326c15dca198755316b88d180b Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sat, 6 Jul 2024 19:38:34 +0200 Subject: [PATCH] Added more SkipLocalsInit --- HPPH.Generators/Features/Colors.cs | 4 ++++ HPPH/Data/Generic3ByteData.cs | 5 ++++- HPPH/Data/Generic3ByteMinMax.cs | 5 ++++- HPPH/Data/Generic4ByteData.cs | 5 ++++- HPPH/Data/Generic4ByteMinMax.cs | 5 ++++- HPPH/Data/Generic4LongData.cs | 5 ++++- .../HPPH.Generators.ColorSourceGenerator/ColorABGR.g.cs | 2 ++ .../HPPH.Generators.ColorSourceGenerator/ColorARGB.g.cs | 2 ++ .../HPPH.Generators.ColorSourceGenerator/ColorBGR.g.cs | 2 ++ .../HPPH.Generators.ColorSourceGenerator/ColorBGRA.g.cs | 2 ++ .../HPPH.Generators.ColorSourceGenerator/ColorRGB.g.cs | 2 ++ .../HPPH.Generators.ColorSourceGenerator/ColorRGBA.g.cs | 2 ++ HPPH/Images/Image.cs | 1 + 13 files changed, 37 insertions(+), 5 deletions(-) diff --git a/HPPH.Generators/Features/Colors.cs b/HPPH.Generators/Features/Colors.cs index d60bc18..1e5835c 100644 --- a/HPPH.Generators/Features/Colors.cs +++ b/HPPH.Generators/Features/Colors.cs @@ -30,6 +30,7 @@ internal class Colors : IGeneratorFeature // ReSharper disable ReplaceWithPrimaryConstructorParameter using System.Diagnostics; + using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace HPPH; @@ -44,6 +45,7 @@ internal class Colors : IGeneratorFeature /// The {{colorFormat.SecondEntryName}}-component of the color. /// The {{colorFormat.ThirdEntryName}}-component of the color. [DebuggerDisplay("[A: {A}, R: {R}, G: {G}, B: {B}]")] + [SkipLocalsInit] [StructLayout(LayoutKind.Sequential)] public readonly partial struct {{colorFormat.TypeName}}(byte {{colorFormat.FirstEntry}}, byte {{colorFormat.SecondEntry}}, byte {{colorFormat.ThirdEntry}}): IColor { @@ -89,6 +91,7 @@ internal class Colors : IGeneratorFeature // ReSharper disable ReplaceWithPrimaryConstructorParameter using System.Diagnostics; + using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace HPPH; @@ -104,6 +107,7 @@ internal class Colors : IGeneratorFeature /// The {{colorFormat.ThirdEntryName}}-component of the color. /// The {{colorFormat.FourthEntryName}}-component of the color. [DebuggerDisplay("[A: {A}, R: {R}, G: {G}, B: {B}]")] + [SkipLocalsInit] [StructLayout(LayoutKind.Sequential)] public readonly partial struct {{colorFormat.TypeName}}(byte {{colorFormat.FirstEntry}}, byte {{colorFormat.SecondEntry}}, byte {{colorFormat.ThirdEntry}}, byte {{colorFormat.FourthEntry}}) : IColor { diff --git a/HPPH/Data/Generic3ByteData.cs b/HPPH/Data/Generic3ByteData.cs index d2d239e..45595ed 100644 --- a/HPPH/Data/Generic3ByteData.cs +++ b/HPPH/Data/Generic3ByteData.cs @@ -1,5 +1,8 @@ -namespace HPPH; +using System.Runtime.CompilerServices; +namespace HPPH; + +[SkipLocalsInit] internal readonly struct Generic3ByteData(byte b1, byte b2, byte b3) { public readonly byte B1 = b1; diff --git a/HPPH/Data/Generic3ByteMinMax.cs b/HPPH/Data/Generic3ByteMinMax.cs index ad9c9b8..c4a226a 100644 --- a/HPPH/Data/Generic3ByteMinMax.cs +++ b/HPPH/Data/Generic3ByteMinMax.cs @@ -1,5 +1,8 @@ -namespace HPPH; +using System.Runtime.CompilerServices; +namespace HPPH; + +[SkipLocalsInit] internal readonly struct Generic3ByteMinMax(byte b1Min, byte b1Max, byte b2Min, byte b2Max, byte b3Min, byte b3Max) { public readonly byte B1Min = b1Min; diff --git a/HPPH/Data/Generic4ByteData.cs b/HPPH/Data/Generic4ByteData.cs index 1163c61..f3adcc8 100644 --- a/HPPH/Data/Generic4ByteData.cs +++ b/HPPH/Data/Generic4ByteData.cs @@ -1,5 +1,8 @@ -namespace HPPH; +using System.Runtime.CompilerServices; +namespace HPPH; + +[SkipLocalsInit] internal readonly struct Generic4ByteData(byte b1, byte b2, byte b3, byte b4) { public readonly byte B1 = b1; diff --git a/HPPH/Data/Generic4ByteMinMax.cs b/HPPH/Data/Generic4ByteMinMax.cs index b256660..09b191f 100644 --- a/HPPH/Data/Generic4ByteMinMax.cs +++ b/HPPH/Data/Generic4ByteMinMax.cs @@ -1,5 +1,8 @@ -namespace HPPH; +using System.Runtime.CompilerServices; +namespace HPPH; + +[SkipLocalsInit] internal readonly struct Generic4ByteMinMax(byte b1Min, byte b1Max, byte b2Min, byte b2Max, byte b3Min, byte b3Max, byte b4Min, byte b4Max) { public readonly byte B1Min = b1Min; diff --git a/HPPH/Data/Generic4LongData.cs b/HPPH/Data/Generic4LongData.cs index 122c1fc..c4e4370 100644 --- a/HPPH/Data/Generic4LongData.cs +++ b/HPPH/Data/Generic4LongData.cs @@ -1,5 +1,8 @@ -namespace HPPH; +using System.Runtime.CompilerServices; +namespace HPPH; + +[SkipLocalsInit] internal readonly struct Generic4LongData(long l1, long l2, long l3, long l4) { public readonly long L1 = l1; diff --git a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorABGR.g.cs b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorABGR.g.cs index 5adf3e4..a652165 100644 --- a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorABGR.g.cs +++ b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorABGR.g.cs @@ -3,6 +3,7 @@ // ReSharper disable ReplaceWithPrimaryConstructorParameter using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace HPPH; @@ -18,6 +19,7 @@ namespace HPPH; /// The Green-component of the color. /// The Red-component of the color. [DebuggerDisplay("[A: {A}, R: {R}, G: {G}, B: {B}]")] +[SkipLocalsInit] [StructLayout(LayoutKind.Sequential)] public readonly partial struct ColorABGR(byte a, byte b, byte g, byte r) : IColor { diff --git a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorARGB.g.cs b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorARGB.g.cs index 19d95a1..2c1950f 100644 --- a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorARGB.g.cs +++ b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorARGB.g.cs @@ -3,6 +3,7 @@ // ReSharper disable ReplaceWithPrimaryConstructorParameter using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace HPPH; @@ -18,6 +19,7 @@ namespace HPPH; /// The Green-component of the color. /// The Blue-component of the color. [DebuggerDisplay("[A: {A}, R: {R}, G: {G}, B: {B}]")] +[SkipLocalsInit] [StructLayout(LayoutKind.Sequential)] public readonly partial struct ColorARGB(byte a, byte r, byte g, byte b) : IColor { diff --git a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorBGR.g.cs b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorBGR.g.cs index 6133d7b..8d75a41 100644 --- a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorBGR.g.cs +++ b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorBGR.g.cs @@ -3,6 +3,7 @@ // ReSharper disable ReplaceWithPrimaryConstructorParameter using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace HPPH; @@ -17,6 +18,7 @@ namespace HPPH; /// The Green-component of the color. /// The Red-component of the color. [DebuggerDisplay("[A: {A}, R: {R}, G: {G}, B: {B}]")] +[SkipLocalsInit] [StructLayout(LayoutKind.Sequential)] public readonly partial struct ColorBGR(byte b, byte g, byte r): IColor { diff --git a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorBGRA.g.cs b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorBGRA.g.cs index da510c4..70d5d72 100644 --- a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorBGRA.g.cs +++ b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorBGRA.g.cs @@ -3,6 +3,7 @@ // ReSharper disable ReplaceWithPrimaryConstructorParameter using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace HPPH; @@ -18,6 +19,7 @@ namespace HPPH; /// The Red-component of the color. /// The Alpha-component of the color. [DebuggerDisplay("[A: {A}, R: {R}, G: {G}, B: {B}]")] +[SkipLocalsInit] [StructLayout(LayoutKind.Sequential)] public readonly partial struct ColorBGRA(byte b, byte g, byte r, byte a) : IColor { diff --git a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorRGB.g.cs b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorRGB.g.cs index 34b6b9d..6746521 100644 --- a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorRGB.g.cs +++ b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorRGB.g.cs @@ -3,6 +3,7 @@ // ReSharper disable ReplaceWithPrimaryConstructorParameter using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace HPPH; @@ -17,6 +18,7 @@ namespace HPPH; /// The Green-component of the color. /// The Blue-component of the color. [DebuggerDisplay("[A: {A}, R: {R}, G: {G}, B: {B}]")] +[SkipLocalsInit] [StructLayout(LayoutKind.Sequential)] public readonly partial struct ColorRGB(byte r, byte g, byte b): IColor { diff --git a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorRGBA.g.cs b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorRGBA.g.cs index 134a1a2..07f9997 100644 --- a/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorRGBA.g.cs +++ b/HPPH/Generated/HPPH.Generators/HPPH.Generators.ColorSourceGenerator/ColorRGBA.g.cs @@ -3,6 +3,7 @@ // ReSharper disable ReplaceWithPrimaryConstructorParameter using System.Diagnostics; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace HPPH; @@ -18,6 +19,7 @@ namespace HPPH; /// The Blue-component of the color. /// The Alpha-component of the color. [DebuggerDisplay("[A: {A}, R: {R}, G: {G}, B: {B}]")] +[SkipLocalsInit] [StructLayout(LayoutKind.Sequential)] public readonly partial struct ColorRGBA(byte r, byte g, byte b, byte a) : IColor { diff --git a/HPPH/Images/Image.cs b/HPPH/Images/Image.cs index 2bcb48a..cd37633 100644 --- a/HPPH/Images/Image.cs +++ b/HPPH/Images/Image.cs @@ -5,6 +5,7 @@ using System.Runtime.InteropServices; namespace HPPH; /// +[SkipLocalsInit] public sealed class Image : IImage where TColor : struct, IColor {