Skip to content

Commit 63f1c86

Browse files
fix xcode 26 -Ofast deprecation warning (#2606)
1 parent f7fc559 commit 63f1c86

File tree

2 files changed

+81
-2
lines changed

2 files changed

+81
-2
lines changed

modules/xcode/tests/test_xcode_project.lua

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,6 +2461,57 @@
24612461
]]
24622462
end
24632463

2464+
2465+
function suite.XCBuildConfigurationProject_OnOptimizeOff()
2466+
optimize "Off"
2467+
prepare()
2468+
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
2469+
test.capture [[
2470+
A14350AC4595EE5E57CE36EC /* Debug */ = {
2471+
isa = XCBuildConfiguration;
2472+
buildSettings = {
2473+
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
2474+
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
2475+
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
2476+
GCC_OPTIMIZATION_LEVEL = 0;
2477+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
2478+
GCC_WARN_ABOUT_RETURN_TYPE = YES;
2479+
GCC_WARN_UNUSED_VARIABLE = YES;
2480+
OBJROOT = obj/Debug;
2481+
ONLY_ACTIVE_ARCH = NO;
2482+
SYMROOT = bin/Debug;
2483+
};
2484+
name = Debug;
2485+
};
2486+
]]
2487+
end
2488+
2489+
2490+
function suite.XCBuildConfigurationProject_OnOptimizeOn()
2491+
optimize "On"
2492+
prepare()
2493+
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
2494+
test.capture [[
2495+
A14350AC4595EE5E57CE36EC /* Debug */ = {
2496+
isa = XCBuildConfiguration;
2497+
buildSettings = {
2498+
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
2499+
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
2500+
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
2501+
GCC_OPTIMIZATION_LEVEL = 3;
2502+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
2503+
GCC_WARN_ABOUT_RETURN_TYPE = YES;
2504+
GCC_WARN_UNUSED_VARIABLE = YES;
2505+
OBJROOT = obj/Debug;
2506+
ONLY_ACTIVE_ARCH = NO;
2507+
SYMROOT = bin/Debug;
2508+
};
2509+
name = Debug;
2510+
};
2511+
]]
2512+
end
2513+
2514+
24642515
function suite.XCBuildConfigurationProject_OnOptimizeSize()
24652516
optimize "Size"
24662517
prepare()
@@ -2511,6 +2562,34 @@
25112562
end
25122563

25132564

2565+
function suite.XCBuildConfigurationProject_OnOptimizeFull()
2566+
optimize "Full"
2567+
prepare()
2568+
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
2569+
test.capture [[
2570+
A14350AC4595EE5E57CE36EC /* Debug */ = {
2571+
isa = XCBuildConfiguration;
2572+
buildSettings = {
2573+
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
2574+
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
2575+
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
2576+
GCC_OPTIMIZATION_LEVEL = 3;
2577+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
2578+
GCC_WARN_ABOUT_RETURN_TYPE = YES;
2579+
GCC_WARN_UNUSED_VARIABLE = YES;
2580+
OBJROOT = obj/Debug;
2581+
ONLY_ACTIVE_ARCH = NO;
2582+
OTHER_CFLAGS = (
2583+
"-ffast-math",
2584+
);
2585+
SYMROOT = bin/Debug;
2586+
};
2587+
name = Debug;
2588+
};
2589+
]]
2590+
end
2591+
2592+
25142593
function suite.XCBuildConfigurationProject_OnStaticRuntime()
25152594
staticruntime "On"
25162595
prepare()

modules/xcode/xcode_common.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@
14991499
settings['GCC_ENABLE_OBJC_EXCEPTIONS'] = 'NO'
15001500
end
15011501

1502-
local optimizeMap = { On = 3, Size = 's', Speed = 3, Full = 'fast', Debug = 'g' }
1502+
local optimizeMap = { On = 3, Size = 's', Speed = 3, Full = 3, Debug = 'g' }
15031503
settings['GCC_OPTIMIZATION_LEVEL'] = optimizeMap[cfg.optimize] or 0
15041504

15051505
if cfg.pchheader and cfg.enablepch ~= p.OFF then
@@ -1565,7 +1565,7 @@
15651565

15661566
-- build list of "other" C/C++ flags
15671567
local checks = {
1568-
["-ffast-math"] = cfg.floatingpoint == "Fast",
1568+
["-ffast-math"] = cfg.floatingpoint == "Fast" or cfg.optimize == "Full",
15691569
["-fomit-frame-pointer"] = cfg.omitframepointer == "On",
15701570
["-fno-omit-frame-pointer"] = cfg.omitframepointer == "Off",
15711571
["-fopenmp"] = cfg.openmp == "On"

0 commit comments

Comments
 (0)