git » sdk » commit b343f0f

Tell clang/swift these are real, closed enums

author Stephen Paul Weber
2024-03-25 15:23:15 UTC
committer Stephen Paul Weber
2024-03-25 15:23:15 UTC
parent ec4b636f1bfac804f3fdc4073390a73b19b1b0fa

Tell clang/swift these are real, closed enums

HaxeCBridge.hx +1 -1

diff --git a/HaxeCBridge.hx b/HaxeCBridge.hx
index ce0af8c..e7db3a8 100644
--- a/HaxeCBridge.hx
+++ b/HaxeCBridge.hx
@@ -1110,7 +1110,7 @@ class CPrinter {
 				case Typedef(type, declarators):
 					'typedef ${printType(type)}' + (declarators.length > 0 ? ' ${declarators.join(', ')}' :'');
 				case Enum(name, fields):
-					'enum $name {\n'
+					'enum\n#ifdef __clang__\n__attribute__((enum_extensibility(closed)))\n#endif\n$name {\n'
 					+ fields.map(f -> '\t' + f.name + (f.value != null ? ' = ${f.value}' : '')).join(',\n') + '\n'
 					+ '}';
 				case Struct(name, {fields: fields}):