On 06/26/2018 01:14 PM, Liu Hao wrote:
> 在 2018年06月26日 18:35, Jacek Caban 写道:
>> I still need to run some test, but I it seems ready for review.
>>
>> The important change is __forceinline. We add extern to GCC macro,
>> because that matches closer intended behaviour. clang supports
>> __forceinline itself if -fms-extensions is used, so we should just leave
>> it to the compiler in that case (also __ptr32, __unaligned and __w64, so
>> I changed them as well while I was at it). Without -fms-extensions,
>> __always_inline__ is expected and as far as I can tell (and my testing
>> conforms that), it matches intended behaviour without additional attributes.
>>
>> Signed-off-by: Jacek Caban <ja...@codeweavers.com>
>> ---
>>  mingw-w64-headers/crt/_mingw.h.in | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>>
>>
> In C99 mode `extern inline` and `inline` (with no `extern` on every
> declaration) behaves differently. The former will result in an external
> definition where a function definition is seen and results in multiple
> definitions if the function is defined multiple times in different
> translate units. The latter doesn't result in an external definitions at
> all, even in case of inline failure, where a call to the external
> function is emitted (this is the `__gnu_inline__` behavior). This has to
> be carefully tested with different optimizations levels in all of C89,
> C99 and C++.

Sure, I know that. Note that I'm changing about __forceinline, not
inline itself. GCC has always_inline, which is not really compatible
with __forceinline and that's why we add inline attributes to the macro.
With proper compiler support, we should just let compiler handle
__forceinline and that's what my patch intends to do for clang.

I did tests with c89 and c99 before submitting the patch (C++ is
irrelevant, I don't change behaviour there). I'm also able to build
Firefox with this patch (which in the past revealed a few inline
problems, so that's a nice test). Is there anything in particular that
you think we should test?

Thanks,
Jacek

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to