diff --git a/compiler/testData/codegen/box/cinterop/auxiliarySources.kt b/compiler/testData/codegen/box/cinterop/auxiliarySources.kt index 21dc6922ba3..447a97bc84d 100644 --- a/compiler/testData/codegen/box/cinterop/auxiliarySources.kt +++ b/compiler/testData/codegen/box/cinterop/auxiliarySources.kt @@ -9,11 +9,11 @@ // FILE: auxiliaryCppSources.h #ifdef __cplusplus extern "C" { - #endif +#endif - const char* name(); +const char* name(); - #ifdef __cplusplus +#ifdef __cplusplus } #endif @@ -23,7 +23,7 @@ extern "C" { static std::string _name = "OK"; -const char* name() { +extern "C" const char* name() { return _name.c_str(); } diff --git a/compiler/testData/codegen/box/cinterop/incompleteTypes.kt b/compiler/testData/codegen/box/cinterop/incompleteTypes.kt index 52f980911dd..245b67aa337 100644 --- a/compiler/testData/codegen/box/cinterop/incompleteTypes.kt +++ b/compiler/testData/codegen/box/cinterop/incompleteTypes.kt @@ -9,29 +9,29 @@ // FILE: incompleteTypes.h #ifdef __cplusplus extern "C" { - #endif +#endif // Forward declaration. - struct S; - extern struct S s; +struct S; +extern struct S s; - const char* getContent(struct S* s); - void setContent(struct S* s, const char* name); +const char* getContent(struct S* s); +void setContent(struct S* s, const char* name); - union U; - extern union U u; +union U; +extern union U u; - double getDouble(union U* u); - void setDouble(union U* u, double value); +double getDouble(union U* u); +void setDouble(union U* u, double value); // Global array of unknown size. - extern char array[]; +extern char array[]; - int arrayLength(); - void setArrayValue(char* array, char value); +int arrayLength(); +void setArrayValue(char* array, char value); - #ifdef __cplusplus +#ifdef __cplusplus } #endif @@ -41,52 +41,52 @@ extern "C" { extern "C" { - struct S { - std::string name; - }; +struct S { + std::string name; +}; - S s = { - .name = "initial" - }; +S s = { + .name = "initial" +}; - void setContent(struct S* s, const char* name) { - // Note that copy here is intentional: we use it as a workaround - // for short lifetime of copy of the passed Kotlin string. - s->name = name; - } +void setContent(struct S* s, const char* name) { + // Note that copy here is intentional: we use it as a workaround + // for short lifetime of copy of the passed Kotlin string. + s->name = name; +} - const char* getContent(struct S* s) { - return s->name.c_str(); - } +const char* getContent(struct S* s) { + return s->name.c_str(); +} - union U { - float f; - double d; - }; +union U { + float f; + double d; +}; - void setDouble(union U* u, double value) { - u->d = value; - } +void setDouble(union U* u, double value) { + u->d = value; +} - double getDouble(union U* u) { - return u->d; - } +double getDouble(union U* u) { + return u->d; +} - union U u = { - .d = 0.0 - }; +union U u = { + .d = 0.0 +}; - char array[5] = { 0, 0, 0, 0, 0 }; +char array[5] = { 0, 0, 0, 0, 0 }; - void setArrayValue(char* array, char value) { - for (int i = 0; i < 5; ++i) { - array[i] = value; - } - } +void setArrayValue(char* array, char value) { + for (int i = 0; i < 5; ++i) { + array[i] = value; +} +} - int arrayLength() { - return sizeof(array) / sizeof(char); - } +int arrayLength() { + return sizeof(array) / sizeof(char); +} } diff --git a/compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt b/compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt index 1d24e97e6ea..ae507a31558 100644 --- a/compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt +++ b/compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt @@ -7,11 +7,11 @@ void test_RunInNewThread(void (*)()); // FILE: leakMemoryWithRunningThreadUnchecked.h #ifdef __cplusplus extern "C" { - #endif +#endif - void test_RunInNewThread(void (*)()); +void test_RunInNewThread(void (*)()); - #ifdef __cplusplus +#ifdef __cplusplus } #endif