Skip to content

Commit cbe7eaf

Browse files
authored
Bump to Swift 6.1 toolchain (#129)
* Bump to Swift 6.1 toolchain * Remove OG_COUNTED_BY usage * Fix OG_COUNTED_BY issue on Linux and macOS
1 parent b710112 commit cbe7eaf

File tree

9 files changed

+25
-8
lines changed

9 files changed

+25
-8
lines changed

.github/workflows/compatibility_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
include:
1616
- os: macos-15
17-
xcode-version: "16.0" # Swift 6.0
17+
xcode-version: "16.3" # Swift 6.1
1818
runs-on: ${{ matrix.os }}
1919
env:
2020
OPENGRAPH_WERROR: 1

.github/workflows/ios.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [macos-15]
16-
xcode-version: ["16.0"] # Swift 6.0
16+
xcode-version: ["16.3"] # Swift 6.1
1717
ios-version: ["18.0"]
1818
include:
1919
- ios-version: "18.0"

.github/workflows/macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [macos-15]
16-
xcode-version: ["16.0"] # Swift 6.0
16+
xcode-version: ["16.3"] # Swift 6.1
1717
runs-on: ${{ matrix.os }}
1818
env:
1919
OPENGRAPH_WERROR: 1

.github/workflows/ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
swift_version: ["6.0"]
15+
swift_version: ["6.1"]
1616
runs-on: ubuntu-22.04
1717
env:
1818
OPENGRAPH_WERROR: 1

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 6.0
1+
// swift-tools-version: 6.1
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import Foundation

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ The project is for the following purposes:
2525

2626
Currently, this project is in early development.
2727

28+
## Build
29+
30+
The current suggested toolchain to build the project is Swift 6.1 / Xcode 16.3.
31+
2832
## Credits
2933

3034
OpenGraph_SPI's Data, Graph, Vector and more is modified based on [Compute](https://github.com/jcmosc/Compute)'s implementations.

Sources/OpenGraph_SPI/include/OGBase.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,19 @@
4343
#define OG_CONSTEXPR
4444
#endif
4545

46+
#if __has_include(<ptrcheck.h>) // Fix conflict define issue of the SDK
47+
#include <ptrcheck.h>
48+
#define OG_COUNTED_BY(N) __counted_by(N)
49+
#else
4650
#if !defined(__counted_by)
4751
#if __has_attribute(__counted_by__)
4852
#define __counted_by(N) __attribute__((__counted_by__(N)))
4953
#else
5054
#define __counted_by(N)
5155
#endif
5256
#endif
53-
5457
#define OG_COUNTED_BY(N) __counted_by(N)
58+
#endif
5559

5660
#include "OGSwiftSupport.h"
5761
#include "OGTargetConditionals.h"

Sources/OpenGraph_SPI/include/OGGraph.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,18 @@ OG_EXPORT
103103
OG_REFINED_FOR_SWIFT
104104
void OGGraphSetNeedsUpdate(OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.setNeedsUpdate(self:));
105105

106+
#if OG_TARGET_OS_DARWIN
106107
OG_EXPORT
107108
OG_REFINED_FOR_SWIFT
108109
bool OGGraphAnyInputsChanged(const OGAttribute *inputs OG_COUNTED_BY(count), size_t count);
110+
#else
111+
// __counted_by__ is supported with Swift 6.1+ toolchain's clang on Linux.
112+
// But it required the count to be declared first which is not required on Apple clang.
113+
// See https://github.com/OpenSwiftUIProject/OpenGraph/issues/130
114+
OG_EXPORT
115+
OG_REFINED_FOR_SWIFT
116+
bool OGGraphAnyInputsChanged(const OGAttribute *inputs, size_t count);
117+
#endif
109118

110119
OG_EXTERN_C_END
111120

0 commit comments

Comments
 (0)