Skip to content

Commit a3a122b

Browse files
committed
Update a test
1 parent 6c9aeb0 commit a3a122b

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

build_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ func TestAssembleFlags_OptBuild(t *testing.T) {
6161
proj := detectProject()
6262
flags := assembleFlags(proj, BuildOptions{Opt: true})
6363

64-
assertFlagPresent(t, flags.CFlags, "-Ofast")
64+
if isEffectivelyClang(flags.Compiler) {
65+
// clang 17+ deprecated -Ofast; the code uses -O3 -ffast-math instead
66+
assertFlagPresent(t, flags.CFlags, "-O3")
67+
assertFlagPresent(t, flags.CFlags, "-ffast-math")
68+
} else {
69+
assertFlagPresent(t, flags.CFlags, "-Ofast")
70+
}
6571
assertFlagPresent(t, flags.CFlags, "-flto")
6672
}
6773

@@ -85,8 +91,11 @@ func TestAssembleFlags_TinyBuild(t *testing.T) {
8591
proj := detectProject()
8692
flags := assembleFlags(proj, BuildOptions{Small: true, Tiny: true})
8793

88-
assertFlagPresent(t, flags.CFlags, "-nostdlib")
8994
assertFlagPresent(t, flags.CFlags, "-fno-rtti")
95+
if !isDarwin() {
96+
// -nostdlib is macOS-incompatible and only added on non-Darwin platforms
97+
assertFlagPresent(t, flags.CFlags, "-nostdlib")
98+
}
9099
}
91100

92101
func TestAssembleFlags_StrictBuild(t *testing.T) {

0 commit comments

Comments
 (0)