[PATCH] RFC: C99: rewrote some extern inline to static inline

Albert Lee trisk at forkgnu.org
Thu Apr 15 13:33:09 CDT 2010


On Thu, 15 Apr 2010 11:56:32 +0200, Yann Droneaud <yann at droneaud.fr>
wrote:
> In order to build with CLANG with default arguments, extern inline
> declaration
> must be changed.
> 
> By default CLANG uses C99's "extern inline" semantic which is like
> gcc's "inline", and not the expected gcc's "extern inline" behavor.
> 
> Additionnaly LLVM/CLANG don't support multiple function definitions with
> different linkage in the same module (source file) : so it's not
> possible to have a static inline definition in a header included in a
> source file with a externally visible function of the same name.
> 

C99's inline differs from GNU C's in that it will never cause a function
definition to be emitted, so you should be able to replace GNU C's "extern
inline" with plain inline.

This has an advantage over static inline if you need to define an
externally visible function, since you can avoid the copying the definition
from the header to a source file by making sure the translation unit
declares the function as C99 extern inline before including the inline
definition.

> This patch convert extern inline to static inline, so 
> embedded functions are not globally visible.
> 
> This could be a problem if those symbols are needed. But currently,
> I'm not able to give you any status: i was only able to run "cmd.exe",
> before going further with LLVM/CLANG. I'm fighting with LLVM/CLANG bug
> instead.
> 
> If they are so symbols needed or if the binaries size grow to much,
> the "extern inline" attribute will have to be converted to a macro,
> expanded to "extern inline" with gcc in default behavor, and "inline"
with
> a C99 compatible compiler.
> 

With C99 static inline, there should be no function definitions emitted so
the size should not be much different.

> See for example how this work in GMP:
> http://gmplib.org:8000/gmp/file/da5903b6e386/gmp-h.in#l414
> 

Thanks for helping Wine get closer to C standards conformance!

-Albert




More information about the wine-devel mailing list