Skip to content

Commit

Permalink
Reduce reliance on <Windows.h>
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-craig-cs authored and jxy-s committed Oct 8, 2024
1 parent a3c22aa commit 2ea2a3f
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 17 deletions.
1 change: 1 addition & 0 deletions radiant/Algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/TypeTraits.h"
#include "radiant/Utility.h"
#include "radiant/TotallyRad.h"
Expand Down
1 change: 1 addition & 0 deletions radiant/Atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/detail/AtomicIntrinsics.h"

namespace rad
Expand Down
1 change: 1 addition & 0 deletions radiant/EmptyOptimizedPair.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/Utility.h"

namespace rad
Expand Down
1 change: 1 addition & 0 deletions radiant/Integer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "radiant/TotallyRad.h"
#include "radiant/TypeTraits.h"
#include "radiant/Res.h"

Expand Down
1 change: 1 addition & 0 deletions radiant/Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/Utility.h"

namespace rad
Expand Down
1 change: 1 addition & 0 deletions radiant/Locks.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/TypeTraits.h"

namespace rad
Expand Down
1 change: 1 addition & 0 deletions radiant/Res.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/Result.h"

namespace rad
Expand Down
1 change: 1 addition & 0 deletions radiant/Result.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/TypeWrapper.h"

#include <initializer_list>
Expand Down
1 change: 1 addition & 0 deletions radiant/ScopeExit.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/Utility.h"

namespace rad
Expand Down
1 change: 1 addition & 0 deletions radiant/SharedPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/Memory.h"
#include "radiant/Atomic.h"
#include "radiant/Locks.h"
Expand Down
1 change: 1 addition & 0 deletions radiant/Span.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/Iterator.h"
#include "radiant/Byte.h"

Expand Down
20 changes: 3 additions & 17 deletions radiant/TotallyRad.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,26 +152,12 @@ static_assert(!(RAD_WINDOWS && RAD_MACOS), "env invalid os");
#error unsupported hardware
#endif

#define RAD_UNUSED(x) ((void)x)

#include <stdint.h>

#if RAD_WINDOWS
#if RAD_KERNEL_MODE
#if RAD_WINDOWS && RAD_KERNEL_MODE
#include <wdm.h>
#else
#define WIN32_LEAN_AND_MEAN
#define WIN32_NO_STATUS
#include <Windows.h>
#undef WIN32_NO_STATUS
#include <ntstatus.h>
#endif
#endif

#if RAD_WINDOWS
#define RAD_UNUSED(x) UNREFERENCED_PARAMETER(x)
#define RAD_YIELD_PROCESSOR() YieldProcessor()
#else
#define RAD_UNUSED(x) ((void)x)
#define RAD_YIELD_PROCESSOR() sched_yield()
#endif

#define RAD_CONCAT_INNER(x, y) x##y
Expand Down
1 change: 1 addition & 0 deletions radiant/TypeWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/Utility.h"

#if RAD_ENABLE_STD
Expand Down
1 change: 1 addition & 0 deletions radiant/UniqueResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/Utility.h"

namespace rad
Expand Down
1 change: 1 addition & 0 deletions radiant/Utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/TypeTraits.h"

namespace rad
Expand Down
1 change: 1 addition & 0 deletions radiant/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/Memory.h"
#include "radiant/EmptyOptimizedPair.h"
#include "radiant/detail/VectorOperations.h"
Expand Down
15 changes: 15 additions & 0 deletions radiant/detail/AtomicIntrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,27 @@

#pragma once

#include "radiant/TotallyRad.h"
#include "radiant/Utility.h"

#if RAD_WINDOWS && RAD_KERNEL_MODE
#include <ntddk.h>
#endif

#if RAD_WINDOWS && RAD_USER_MODE
#define WIN32_LEAN_AND_MEAN
#define WIN32_NO_STATUS
#include <Windows.h>
#undef WIN32_NO_STATUS
#include <ntstatus.h>
#endif

#if RAD_WINDOWS
#define RAD_YIELD_PROCESSOR() YieldProcessor()
#else
#define RAD_YIELD_PROCESSOR() sched_yield()
#endif

namespace rad
{
enum class MemoryOrder : int
Expand Down

0 comments on commit 2ea2a3f

Please sign in to comment.