Skip to content

Commit 92a32ff

Browse files
jdolanCopilot
andcommitted
Move <math.h> include to umbrella header; remove from Math.h
Math.h must not include <math.h> — on case-insensitive filesystems the preprocessor resolves <math.h> back to Math.h, breaking the include guard and leaving sqrtf etc. undeclared. Same pattern Objectively uses: String.h does not include <string.h>. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 92deb63 commit 92a32ff

4 files changed

Lines changed: 9 additions & 18 deletions

File tree

Examples/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ noinst_PROGRAMS = \
55
HelloCompute
66

77
CFLAGS += \
8-
-isystem $(top_srcdir)/Sources \
8+
-I$(top_srcdir)/Sources \
99
@HOST_CFLAGS@ \
1010
@OBJECTIVELY_CFLAGS@ \
1111
@SDL3_CFLAGS@

Sources/ObjectivelyGPU.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#pragma once
2525

26+
#include <math.h>
27+
2628
#include <ObjectivelyGPU/CommandBuffer.h>
2729
#include <ObjectivelyGPU/ComputePass.h>
2830
#include <ObjectivelyGPU/CopyPass.h>

Sources/ObjectivelyGPU/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AUTOMAKE_OPTIONS = nostdinc
2-
AM_CPPFLAGS = -isystem $(top_srcdir)/Sources -iquote$(top_builddir)/Sources/ObjectivelyGPU
2+
AM_CPPFLAGS = -I$(top_srcdir)/Sources -iquote$(top_builddir)/Sources/ObjectivelyGPU
33

44
noinst_HEADERS = \
55
Config.h

Sources/ObjectivelyGPU/Math.h

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,14 @@
2323

2424
#pragma once
2525

26-
#include <math.h>
2726
#include <stdbool.h>
2827
#include <string.h>
2928

3029
#ifndef M_PI
3130
#define M_PI 3.14159265358979323846
3231
#endif
3332

34-
// ---------------------------------------------------------------------------
35-
// Scalar
36-
// ---------------------------------------------------------------------------
33+
#pragma mark - float
3734

3835
/**
3936
* @return `degrees` converted to radians.
@@ -85,9 +82,7 @@ static inline float float_sign(float f) {
8582
return (f > 0.f) - (f < 0.f);
8683
}
8784

88-
// ---------------------------------------------------------------------------
89-
// float2
90-
// ---------------------------------------------------------------------------
85+
#pragma mark - float2
9186

9287
/**
9388
* @brief Two-component single-precision vector. Component layout matches HLSL `float2`.
@@ -132,9 +127,7 @@ static inline float2 float2_lerp(float2 a, float2 b, float t) {
132127

133128
static inline bool float2_equal(float2 a, float2 b) { return a.x == b.x && a.y == b.y; }
134129

135-
// ---------------------------------------------------------------------------
136-
// float3
137-
// ---------------------------------------------------------------------------
130+
#pragma mark - float3
138131

139132
/**
140133
* @brief Three-component single-precision vector. Component layout matches HLSL `float3`.
@@ -196,9 +189,7 @@ static inline float3 float3_reflect(float3 v, float3 n) {
196189

197190
static inline bool float3_equal(float3 a, float3 b) { return a.x == b.x && a.y == b.y && a.z == b.z; }
198191

199-
// ---------------------------------------------------------------------------
200-
// float4
201-
// ---------------------------------------------------------------------------
192+
#pragma mark - float4
202193

203194
/**
204195
* @brief Four-component single-precision vector. Component layout matches HLSL `float4`.
@@ -246,9 +237,7 @@ static inline float4 float4_lerp(float4 a, float4 b, float t) {
246237

247238
static inline bool float4_equal(float4 a, float4 b) { return a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w; }
248239

249-
// ---------------------------------------------------------------------------
250-
// float4x4
251-
// ---------------------------------------------------------------------------
240+
#pragma mark - float4x4
252241

253242
/**
254243
* @brief Column-major 4x4 single-precision matrix. Layout matches HLSL `float4x4`.

0 commit comments

Comments
 (0)