Try to bumping a C library from Swift 6.0 toolchain to Swift 6.1.
And it just stop compiling for some message related with __counted_by__
. (Can be build with Swift 6.0 toolchain)
I have tried to explicitly set a cLanguageStandard for different values. And it does not seem to work.
In file included from <redacted>/OpenGraph/Sources/OpenGraph_SPI/Attribute/AttributeID.cpp:8:
In file included from <redacted>/OpenGraph/Sources/OpenGraph_SPI/Attribute/AttributeID.hpp:12:
In file included from <redacted>/OpenGraph/Sources/OpenGraph_SPI/include/OGAttribute.h:12:
<redacted>/OpenGraph/Sources/OpenGraph_SPI/include/OGGraph.h:108:70: error: use of undeclared identifier 'count'; did you mean 'round'?
108 | bool OGGraphAnyInputsChanged(const OGAttribute *inputs OG_COUNTED_BY(count), size_t count);
| ^~~~~
| round
<redacted>/OpenGraph/Sources/OpenGraph_SPI/include/OGBase.h:54:39: note: expanded from macro 'OG_COUNTED_BY'
54 | #define OG_COUNTED_BY(N) __counted_by(N)
| ^
<redacted>/OpenGraph/Sources/OpenGraph_SPI/include/OGBase.h:48:55: note: expanded from macro '__counted_by'
48 | #define __counted_by(N) __attribute__((__counted_by__(N)))
| ^
/usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/math.h:107:12: note: 'round' declared here
107 | using std::round;
| ^
In file included from <redacted>/OpenGraph/Sources/OpenGraph_SPI/Attribute/AttributeID.cpp:8:
In file included from <redacted>/OpenGraph/Sources/OpenGraph_SPI/Attribute/AttributeID.hpp:12:
In file included from <redacted>/OpenGraph/Sources/OpenGraph_SPI/include/OGAttribute.h:12:
<redacted>/OpenGraph/Sources/OpenGraph_SPI/include/OGGraph.h:108:56: warning: '__counted_by__' attribute ignored [-Wignored-attributes]
108 | bool OGGraphAnyInputsChanged(const OGAttribute *inputs OG_COUNTED_BY(count), size_t count);
| ^
<redacted>/OpenGraph/Sources/OpenGraph_SPI/include/OGBase.h:54:26: note: expanded from macro 'OG_COUNTED_BY'
54 | #define OG_COUNTED_BY(N) __counted_by(N)
| ^
<redacted>/OpenGraph/Sources/OpenGraph_SPI/include/OGBase.h:48:40: note: expanded from macro '__counted_by'
48 | #define __counted_by(N) __attribute__((__counted_by__(N)))
| ^
1 warning and 1 error generated.
error: fatalError
The code related with it is as the following
#if !defined(__counted_by)
#if __has_attribute(__counted_by__)
#define __counted_by(N) __attribute__((__counted_by__(N)))
#else
#define __counted_by(N)
#endif
#endif
#define OG_COUNTED_BY(N) __counted_by(N)
bool OGGraphAnyInputsChanged(const OGAttribute *inputs OG_COUNTED_BY(count), size_t count);