Skip to content

Commit 22b859a

Browse files
committed
Define the WEAK_NATIVEINT conditional on Delphi 12+
1 parent 6a2da83 commit 22b859a

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Support for the `WEAK_NATIVEINT` symbol, which is defined from Delphi 12 onward.
13+
1014
### Changed
1115

1216
- Exclude types annotated with attributes in `UnusedType`.

delphi-frontend/src/main/java/au/com/integradev/delphi/compiler/PredefinedConditionals.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ private Set<String> getAvailabilityConditionalDefines() {
226226
result.add("WEAKINTFREF");
227227
}
228228

229+
if (compilerVersion.compareTo(VERSION_ATHENS) >= 0) {
230+
result.add("WEAK_NATIVEINT");
231+
}
232+
229233
if (checkToolchain(Toolchain.DCCIOSSIMARM64)) {
230234
result.add("IOSSIMULATOR");
231235
}

delphi-frontend/src/test/java/au/com/integradev/delphi/compiler/PredefinedConditionalsTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,4 +406,11 @@ void testToolchainsBeforeDelphiAthensShouldNotDefineLLVM(Toolchain toolchain) {
406406
assertThat(PredefinedConditionals.getConditionalDefines(toolchain, VERSION_ALEXANDRIA))
407407
.doesNotContain("LLVM");
408408
}
409+
410+
@ParameterizedTest
411+
@EnumSource(value = Toolchain.class)
412+
void testAllToolchainsAfterDelphiAlexandriaShouldDefineWeakNativeInt(Toolchain toolchain) {
413+
assertThat(PredefinedConditionals.getConditionalDefines(toolchain, VERSION_ATHENS))
414+
.contains("WEAK_NATIVEINT");
415+
}
409416
}

0 commit comments

Comments
 (0)