Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Empty struct warning? #3552

Closed
anpete opened this issue Nov 5, 2019 · 10 comments
Closed

Empty struct warning? #3552

anpete opened this issue Nov 5, 2019 · 10 comments
Labels

Comments

@anpete
Copy link

anpete commented Nov 5, 2019

Native compiler is generating the following warning:

/var/folders/5_/ps5dhtf93d3gykbtr9stv7qh0000gn/T/konan_temp2849286529694188944/api.cpp:1033:15: warning: empty struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
              struct {
              ^

Can I ignore this? If so, how can I suppress it?

@olonho
Copy link
Contributor

olonho commented Nov 5, 2019

As clang suggests, use -Wno-extern-c-compat. This warning is harmless.

@anpete
Copy link
Author

anpete commented Nov 5, 2019

Thanks. I'm having trouble figuring out how to specify that using the Gradle multiplatform plugin. Any help would be much appreciated.

@artdfel
Copy link
Contributor

artdfel commented Nov 6, 2019

Hello @anpete! Can you please share at which stage of the project build you're facing this warning?

@anpete
Copy link
Author

anpete commented Nov 6, 2019

The warning is produced when executing any of the link gradle tasks that are provided via the kotlin multiplatform plugin. The warnings started appearing after I made several types and global functions internal. Could it be related to kotlin files that only have internal declarations?

@artdfel
Copy link
Contributor

artdfel commented Nov 7, 2019

Please try to add the flag to the linkerOpts property of your binary. Example of its usage one can find in this document.

@olonho
Copy link
Contributor

olonho commented Nov 8, 2019

compilerOpts, not linker one.

@anpete
Copy link
Author

anpete commented Nov 11, 2019

Assuming you mean freeCompilerArgs?

I tried this:

mingwX64("mingw") {
        binaries {
            sharedLib {
                baseName = "mylib"
                freeCompilerArgs = mutableListOf("-Wno-extern-c-compat")
            }
        }
    }

And got this:

e: Invalid argument: -Wno-extern-c-compat

@artdfel artdfel added the bug label Nov 28, 2019
@artdfel
Copy link
Contributor

artdfel commented Nov 28, 2019

Hello again, @anpete, and sorry for such a long period of silence!
Finally, we managed to find the root cause of this warning. It has to be fixed in the compiler, so nothing can be done from your side.
Also, I got to mention that this issue should not cause any problems(except the fact that it is quietly annoying😅). So, please don't
worry about it, and wait for an update in this thread.

@anpete
Copy link
Author

anpete commented Dec 2, 2019

OK, thanks!

Feel free to close the issue when appropriate.

@vvlevchenko
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants