Skip to content

Commit 1b8b061

Browse files
committed
Addressed remaining review feedback
Bool -> MaybeBool<int> Keep UnmanagedCallersOnly attributes Mark JobContext as Experimental Removed unnecessary warning disable from tests
1 parent 21d73e0 commit 1b8b061

File tree

45 files changed

+343
-1233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+343
-1233
lines changed

generator.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
"sources/**/helper-types/BOOL.gen.cs",
5656
"sources/**/helper-types/HSTRING.gen.cs"
5757
],
58+
"InjectedRemappedNames": {
59+
"BOOL": "MaybeBool<int>"
60+
},
5861
"InjectedGeneratorOptions": [
5962
"--config",
6063
"dont-use-using-statics-for-guid-members"
@@ -121,9 +124,6 @@
121124
]
122125
},
123126
"TransformFunctions": {
124-
"BoolTypes": {
125-
"BOOL": null
126-
}
127127
},
128128
"PrettifyNames": {
129129
"NameOverrides": {
@@ -161,10 +161,12 @@
161161
"GeneratedToRemove": [
162162
"sources/**/helper-types/*.gen.cs",
163163
"!sources/**/helper-types/Hresult.gen.cs",
164-
"!sources/**/helper-types/Bool.gen.cs",
165164
"!sources/**/helper-types/Hstring.gen.cs",
166165
"!sources/**/helper-types/Handle.gen.cs"
167166
],
167+
"InjectedRemappedNames": {
168+
"BOOL": "MaybeBool<int>"
169+
},
168170
"InjectedGeneratorOptions": [
169171
"--config",
170172
"dont-use-using-statics-for-guid-members"
@@ -192,9 +194,6 @@
192194
]
193195
},
194196
"TransformFunctions": {
195-
"BoolTypes": {
196-
"BOOL": null
197-
}
198197
},
199198
"PrettifyNames": {
200199
"NameOverrides": {

sources/Core/Core/BOOL.Manual.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

sources/Core/Core/PublicAPI/net8.0/PublicAPI.Unshipped.txt

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#nullable enable
2-
override Silk.NET.Core.Bool.Equals(object? obj) -> bool
3-
override Silk.NET.Core.Bool.GetHashCode() -> int
4-
override Silk.NET.Core.Bool.ToString() -> string!
52
override Silk.NET.Core.Handle.Equals(object? obj) -> bool
63
override Silk.NET.Core.Handle.GetHashCode() -> int
74
override Silk.NET.Core.Handle.ToString() -> string!
@@ -36,7 +33,6 @@ override Silk.NET.Core.Ref3D<T>.GetHashCode() -> int
3633
override Silk.NET.Core.Ref<T>.Equals(object? obj) -> bool
3734
override Silk.NET.Core.Ref<T>.GetHashCode() -> int
3835
override Silk.NET.Core.Utf8String.ToString() -> string!
39-
readonly Silk.NET.Core.Bool.Value -> int
4036
readonly Silk.NET.Core.Handle.Value -> void*
4137
readonly Silk.NET.Core.HResult.Value -> int
4238
readonly Silk.NET.Core.HString.Value -> void*
@@ -112,15 +108,6 @@ Silk.NET.Core.AsyncIUnknown.QueryInterface(Silk.NET.Core.Ref<System.Guid> riid,
112108
Silk.NET.Core.AsyncIUnknown.QueryInterface(System.Guid* riid, void** ppvObject) -> Silk.NET.Core.HResult
113109
Silk.NET.Core.AsyncIUnknown.QueryInterface<TCom>(out TCom ppvObject) -> Silk.NET.Core.HResult
114110
Silk.NET.Core.AsyncIUnknown.Release() -> uint
115-
Silk.NET.Core.Bool
116-
Silk.NET.Core.Bool.Bool() -> void
117-
Silk.NET.Core.Bool.Bool(int value) -> void
118-
Silk.NET.Core.Bool.CompareTo(object? obj) -> int
119-
Silk.NET.Core.Bool.CompareTo(Silk.NET.Core.Bool other) -> int
120-
Silk.NET.Core.Bool.CompareTo(Silk.NET.Core.MaybeBool<Silk.NET.Core.Bool> other) -> int
121-
Silk.NET.Core.Bool.Equals(Silk.NET.Core.Bool other) -> bool
122-
Silk.NET.Core.Bool.Equals(Silk.NET.Core.MaybeBool<Silk.NET.Core.Bool> other) -> bool
123-
Silk.NET.Core.Bool.ToString(string? format, System.IFormatProvider? formatProvider) -> string!
124111
Silk.NET.Core.BreakneckLock
125112
Silk.NET.Core.BreakneckLock.BreakneckLock() -> void
126113
Silk.NET.Core.BreakneckLock.Enter(ref bool taken) -> void
@@ -210,15 +197,15 @@ Silk.NET.Core.IClassFactory.IClassFactory(Silk.NET.Core.Ptr<Silk.NET.Core.IClass
210197
Silk.NET.Core.IClassFactory.Interface
211198
Silk.NET.Core.IClassFactory.Interface.CreateInstance(Silk.NET.Core.IUnknown pUnkOuter, Silk.NET.Core.Ref<System.Guid> riid, Silk.NET.Core.Ref2D ppvObject) -> Silk.NET.Core.HResult
212199
Silk.NET.Core.IClassFactory.Interface.CreateInstance(Silk.NET.Core.IUnknown pUnkOuter, System.Guid* riid, void** ppvObject) -> Silk.NET.Core.HResult
213-
Silk.NET.Core.IClassFactory.Interface.LockServer(Silk.NET.Core.Bool fLock) -> Silk.NET.Core.HResult
214-
Silk.NET.Core.IClassFactory.LockServer(Silk.NET.Core.Bool fLock) -> Silk.NET.Core.HResult
200+
Silk.NET.Core.IClassFactory.Interface.LockServer(Silk.NET.Core.MaybeBool<int> fLock) -> Silk.NET.Core.HResult
201+
Silk.NET.Core.IClassFactory.LockServer(Silk.NET.Core.MaybeBool<int> fLock) -> Silk.NET.Core.HResult
215202
Silk.NET.Core.IClassFactory.LpVtbl -> Silk.NET.Core.IClassFactory.Native*
216203
Silk.NET.Core.IClassFactory.Native
217204
Silk.NET.Core.IClassFactory.Native.AddRef() -> uint
218205
Silk.NET.Core.IClassFactory.Native.CreateInstance(Silk.NET.Core.IUnknown pUnkOuter, Silk.NET.Core.Ref<System.Guid> riid, Silk.NET.Core.Ref2D ppvObject) -> Silk.NET.Core.HResult
219206
Silk.NET.Core.IClassFactory.Native.CreateInstance(Silk.NET.Core.IUnknown pUnkOuter, System.Guid* riid, void** ppvObject) -> Silk.NET.Core.HResult
220207
Silk.NET.Core.IClassFactory.Native.CreateInstance<TCom>(Silk.NET.Core.IUnknown pUnkOuter, out TCom ppvObject) -> Silk.NET.Core.HResult
221-
Silk.NET.Core.IClassFactory.Native.LockServer(Silk.NET.Core.Bool fLock) -> Silk.NET.Core.HResult
208+
Silk.NET.Core.IClassFactory.Native.LockServer(Silk.NET.Core.MaybeBool<int> fLock) -> Silk.NET.Core.HResult
222209
Silk.NET.Core.IClassFactory.Native.lpVtbl -> void**
223210
Silk.NET.Core.IClassFactory.Native.Native() -> void
224211
Silk.NET.Core.IClassFactory.Native.QueryInterface(Silk.NET.Core.Ref<System.Guid> riid, Silk.NET.Core.Ref2D ppvObject) -> Silk.NET.Core.HResult
@@ -228,7 +215,7 @@ Silk.NET.Core.IClassFactory.Native.Release() -> uint
228215
Silk.NET.Core.IClassFactory.Native.Vtbl<TSelf>
229216
Silk.NET.Core.IClassFactory.Native.Vtbl<TSelf>.AddRef -> delegate* unmanaged<TSelf*, uint>
230217
Silk.NET.Core.IClassFactory.Native.Vtbl<TSelf>.CreateInstance -> delegate* unmanaged<TSelf*, Silk.NET.Core.IUnknown.Native*, System.Guid*, void**, int>
231-
Silk.NET.Core.IClassFactory.Native.Vtbl<TSelf>.LockServer -> delegate* unmanaged<TSelf*, Silk.NET.Core.Bool, int>
218+
Silk.NET.Core.IClassFactory.Native.Vtbl<TSelf>.LockServer -> delegate* unmanaged<TSelf*, Silk.NET.Core.MaybeBool<int>, int>
232219
Silk.NET.Core.IClassFactory.Native.Vtbl<TSelf>.QueryInterface -> delegate* unmanaged<TSelf*, System.Guid*, void**, int>
233220
Silk.NET.Core.IClassFactory.Native.Vtbl<TSelf>.Release -> delegate* unmanaged<TSelf*, uint>
234221
Silk.NET.Core.IClassFactory.Native.Vtbl<TSelf>.Vtbl() -> void
@@ -552,39 +539,6 @@ static Silk.NET.Core.AsyncIUnknown.implicit operator Silk.NET.Core.IUnknown(Silk
552539
static Silk.NET.Core.AsyncIUnknown.implicit operator Silk.NET.Core.Ptr3D(Silk.NET.Core.AsyncIUnknown value) -> Silk.NET.Core.Ptr3D
553540
static Silk.NET.Core.AsyncIUnknown.implicit operator Silk.NET.Core.Ptr<Silk.NET.Core.AsyncIUnknown.Native>(Silk.NET.Core.AsyncIUnknown value) -> Silk.NET.Core.Ptr<Silk.NET.Core.AsyncIUnknown.Native>
554541
static Silk.NET.Core.AsyncIUnknown.implicit operator void***(Silk.NET.Core.AsyncIUnknown value) -> void***
555-
static Silk.NET.Core.Bool.explicit operator byte(Silk.NET.Core.Bool value) -> byte
556-
static Silk.NET.Core.Bool.explicit operator nuint(Silk.NET.Core.Bool value) -> nuint
557-
static Silk.NET.Core.Bool.explicit operator sbyte(Silk.NET.Core.Bool value) -> sbyte
558-
static Silk.NET.Core.Bool.explicit operator short(Silk.NET.Core.Bool value) -> short
559-
static Silk.NET.Core.Bool.explicit operator Silk.NET.Core.Bool(long value) -> Silk.NET.Core.Bool
560-
static Silk.NET.Core.Bool.explicit operator Silk.NET.Core.Bool(nint value) -> Silk.NET.Core.Bool
561-
static Silk.NET.Core.Bool.explicit operator Silk.NET.Core.Bool(nuint value) -> Silk.NET.Core.Bool
562-
static Silk.NET.Core.Bool.explicit operator Silk.NET.Core.Bool(uint value) -> Silk.NET.Core.Bool
563-
static Silk.NET.Core.Bool.explicit operator Silk.NET.Core.Bool(ulong value) -> Silk.NET.Core.Bool
564-
static Silk.NET.Core.Bool.explicit operator uint(Silk.NET.Core.Bool value) -> uint
565-
static Silk.NET.Core.Bool.explicit operator ulong(Silk.NET.Core.Bool value) -> ulong
566-
static Silk.NET.Core.Bool.explicit operator ushort(Silk.NET.Core.Bool value) -> ushort
567-
static Silk.NET.Core.Bool.FALSE.get -> Silk.NET.Core.Bool
568-
static Silk.NET.Core.Bool.implicit operator bool(Silk.NET.Core.Bool value) -> bool
569-
static Silk.NET.Core.Bool.implicit operator int(Silk.NET.Core.Bool value) -> int
570-
static Silk.NET.Core.Bool.implicit operator long(Silk.NET.Core.Bool value) -> long
571-
static Silk.NET.Core.Bool.implicit operator nint(Silk.NET.Core.Bool value) -> nint
572-
static Silk.NET.Core.Bool.implicit operator Silk.NET.Core.Bool(bool value) -> Silk.NET.Core.Bool
573-
static Silk.NET.Core.Bool.implicit operator Silk.NET.Core.Bool(byte value) -> Silk.NET.Core.Bool
574-
static Silk.NET.Core.Bool.implicit operator Silk.NET.Core.Bool(int value) -> Silk.NET.Core.Bool
575-
static Silk.NET.Core.Bool.implicit operator Silk.NET.Core.Bool(sbyte value) -> Silk.NET.Core.Bool
576-
static Silk.NET.Core.Bool.implicit operator Silk.NET.Core.Bool(short value) -> Silk.NET.Core.Bool
577-
static Silk.NET.Core.Bool.implicit operator Silk.NET.Core.Bool(ushort value) -> Silk.NET.Core.Bool
578-
static Silk.NET.Core.Bool.operator !=(Silk.NET.Core.Bool left, Silk.NET.Core.Bool right) -> bool
579-
static Silk.NET.Core.Bool.operator ++(Silk.NET.Core.Bool value) -> Silk.NET.Core.Bool
580-
static Silk.NET.Core.Bool.operator <(Silk.NET.Core.Bool left, Silk.NET.Core.Bool right) -> bool
581-
static Silk.NET.Core.Bool.operator <=(Silk.NET.Core.Bool left, Silk.NET.Core.Bool right) -> bool
582-
static Silk.NET.Core.Bool.operator ==(Silk.NET.Core.Bool left, Silk.NET.Core.Bool right) -> bool
583-
static Silk.NET.Core.Bool.operator >(Silk.NET.Core.Bool left, Silk.NET.Core.Bool right) -> bool
584-
static Silk.NET.Core.Bool.operator >=(Silk.NET.Core.Bool left, Silk.NET.Core.Bool right) -> bool
585-
static Silk.NET.Core.Bool.operator false(Silk.NET.Core.Bool value) -> bool
586-
static Silk.NET.Core.Bool.operator true(Silk.NET.Core.Bool value) -> bool
587-
static Silk.NET.Core.Bool.TRUE.get -> Silk.NET.Core.Bool
588542
static Silk.NET.Core.BreakneckLock.Create() -> Silk.NET.Core.BreakneckLock
589543
static Silk.NET.Core.Constant<TUnderlying, TEnum1, TEnum2>.implicit operator Silk.NET.Core.Constant<TUnderlying, TEnum1, TEnum2>(TEnum1 value) -> Silk.NET.Core.Constant<TUnderlying, TEnum1, TEnum2>
590544
static Silk.NET.Core.Constant<TUnderlying, TEnum1, TEnum2>.implicit operator Silk.NET.Core.Constant<TUnderlying, TEnum1, TEnum2>(TEnum2 value) -> Silk.NET.Core.Constant<TUnderlying, TEnum1, TEnum2>

sources/Core/Core/Windows/other/helper-types/BOOL.gen.cs

Lines changed: 0 additions & 105 deletions
This file was deleted.

sources/Core/Core/Windows/um/Unknwnbase/IClassFactory.gen.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Ref2D ppvObject
3939
);
4040

4141
[VtblIndex(4)]
42-
HResult LockServer(Bool fLock);
42+
HResult LockServer([NativeTypeName("BOOL")] MaybeBool<int> fLock);
4343
}
4444

4545
/// <include file='IClassFactory.xml' path='doc/member[@name="IClassFactory"]/*'/>
@@ -69,7 +69,7 @@ public partial struct Vtbl<TSelf>
6969
public delegate* unmanaged<TSelf*, IUnknown.Native*, Guid*, void**, int> CreateInstance;
7070

7171
[NativeTypeName("HRESULT (BOOL) __attribute__((stdcall))")]
72-
public delegate* unmanaged<TSelf*, Bool, int> LockServer;
72+
public delegate* unmanaged<TSelf*, MaybeBool<int>, int> LockServer;
7373
}
7474

7575
/// <inheritdoc cref = "IUnknown.AddRef"/>
@@ -132,9 +132,9 @@ public HResult CreateInstance<TCom>(IUnknown pUnkOuter, out TCom ppvObject)
132132

133133
[MethodImpl(MethodImplOptions.AggressiveInlining)]
134134
[VtblIndex(4)]
135-
public HResult LockServer(Bool fLock)
135+
public HResult LockServer([NativeTypeName("BOOL")] MaybeBool<int> fLock)
136136
{
137-
return ((delegate* unmanaged<IClassFactory.Native*, Bool, int>)(lpVtbl[4]))(
137+
return ((delegate* unmanaged<IClassFactory.Native*, MaybeBool<int>, int>)(lpVtbl[4]))(
138138
(IClassFactory.Native*)Unsafe.AsPointer(ref this),
139139
fLock
140140
);
@@ -327,7 +327,8 @@ public readonly Ptr2D<TNativeInterface> GetAddressOf<TNativeInterface>()
327327

328328
[MethodImpl(MethodImplOptions.AggressiveInlining)]
329329
[VtblIndex(4)]
330-
public HResult LockServer(Bool fLock) => LpVtbl->LockServer(fLock);
330+
public HResult LockServer([NativeTypeName("BOOL")] MaybeBool<int> fLock) =>
331+
LpVtbl->LockServer(fLock);
331332

332333
/// <inheritdoc cref = "IUnknown.QueryInterface"/>
333334

sources/SilkTouch/SilkTouch/Clang/ClangScraper.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,6 @@ public async Task ExecuteAsync(IModContext ctx, CancellationToken ct = default)
514514
Dictionary<string, string> remappedNames = cfg.InjectedRemappedNames ?? [];
515515
if (!remappedNames.ContainsKey("HANDLE"))
516516
remappedNames.Add("HANDLE", "Handle");
517-
if (!remappedNames.ContainsKey("BOOL"))
518-
remappedNames.Add("BOOL", "Bool");
519517

520518
// Read the response files.
521519
logger.LogInformation("Reading response files for {}, please wait...", ctx.JobKey);

sources/SilkTouch/SilkTouch/JobContext.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Concurrent;
66
using System.Collections.Generic;
7+
using System.Diagnostics.CodeAnalysis;
78
using System.Linq;
89
using System.Text;
910
using System.Threading.Tasks;
@@ -13,6 +14,10 @@ namespace Silk.NET.SilkTouch
1314
/// <summary>
1415
/// Information on the current Job
1516
/// </summary>
17+
[Experimental(
18+
"ST0005",
19+
UrlFormat = "https://dotnet.github.io/Silk.NET/docs/v3/silk.net/diagnostics/{0}"
20+
)]
1621
public class JobContext
1722
{
1823
private readonly AsyncLocal<string?> _key = new AsyncLocal<string?>();

sources/SilkTouch/SilkTouch/Logging/ProgressService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class ProgressService : IProgressService
1919
{
2020
private ConcurrentDictionary<string, (string, float)> Progress =
2121
new ConcurrentDictionary<string, (string, float)>();
22+
23+
#pragma warning disable ST0005 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
2224
private JobContext _jobContext;
2325

2426
/// <summary>
@@ -29,6 +31,8 @@ public ProgressService(JobContext context)
2931
{
3032
_jobContext = context;
3133
}
34+
#pragma warning restore ST0005 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
35+
3236

3337
/// <inheritdoc/>
3438
public IEnumerable<KeyValuePair<string, (string, float)>> GetAllProgress() => Progress;

sources/SilkTouch/SilkTouch/Logging/SilkLogger.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ namespace Silk.NET.SilkTouch.Logging
1818
internal class SilkLogger<T> : ILogger<T>
1919
{
2020
private readonly ILogger _innerLogger;
21+
22+
#pragma warning disable ST0005 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
2123
private readonly JobContext _jobContext;
2224

2325
/// <summary>
@@ -30,6 +32,7 @@ public SilkLogger(ILoggerFactory loggerfactory, JobContext jobContext)
3032
_innerLogger = loggerfactory.CreateLogger<T>();
3133
_jobContext = jobContext;
3234
}
35+
#pragma warning restore ST0005 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
3336

3437
/// <inheritdoc/>
3538
public IDisposable? BeginScope<TState>(TState state)

sources/SilkTouch/SilkTouch/Mods/DisableWarnings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public override async Task ExecuteAsync(IModContext ctx, CancellationToken ct =
5252
);
5353

5454
ctx.SourceProject = await DisableWarningsAsync(ctx.SourceProject, pragmaDirective, ct);
55-
ctx.TestProject = await DisableWarningsAsync(ctx.TestProject, pragmaDirective, ct);
5655
}
5756

5857
private async Task<Microsoft.CodeAnalysis.Project?> DisableWarningsAsync(

0 commit comments

Comments
 (0)