[llvm] r193256 - llvm-c/Target.h: Tweak "inline" for msvc to use __inline instead.

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 06:41:48 PST 2017


Resending to new lists instead of old lists.

On Thu, Jan 19, 2017 at 9:40 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> On Wed, Oct 23, 2013 at 1:56 PM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
>> Author: chapuni
>> Date: Wed Oct 23 12:56:52 2013
>> New Revision: 193256
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=193256&view=rev
>> Log:
>> llvm-c/Target.h: Tweak "inline" for msvc to use __inline instead.
>>
>> FIXME: I don't think it'd be smart.
>>
>> Modified:
>>     llvm/trunk/include/llvm-c/Target.h
>>
>> Modified: llvm/trunk/include/llvm-c/Target.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Target.h?rev=193256&r1=193255&r2=193256&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm-c/Target.h (original)
>> +++ llvm/trunk/include/llvm-c/Target.h Wed Oct 23 12:56:52 2013
>> @@ -22,6 +22,10 @@
>>  #include "llvm-c/Core.h"
>>  #include "llvm/Config/llvm-config.h"
>>
>> +#if defined(_MSC_VER) && !defined(inline)
>> +#define inline __inline
>> +#endif
>
> It is undefined behavior to redefine a keyword like this, and it is
> causing me some problems because I am running into code where this
> macro expands in unfortunate places:
>
> namespace N {
> __inline namespace N2 {
> }
> }
>
> MSVC happens to accept this, but I can't help but wonder: what problem
> was this meant to solve? MSDN documents that __inline and inline are
> synonyms with identical behavior.
>
> ~Aaron
>
>> +
>>  #ifdef __cplusplus
>>  extern "C" {
>>  #endif
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

On Wed, Oct 23, 2013 at 1:56 PM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
> Author: chapuni
> Date: Wed Oct 23 12:56:52 2013
> New Revision: 193256
>
> URL: http://llvm.org/viewvc/llvm-project?rev=193256&view=rev
> Log:
> llvm-c/Target.h: Tweak "inline" for msvc to use __inline instead.
>
> FIXME: I don't think it'd be smart.
>
> Modified:
>     llvm/trunk/include/llvm-c/Target.h
>
> Modified: llvm/trunk/include/llvm-c/Target.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Target.h?rev=193256&r1=193255&r2=193256&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm-c/Target.h (original)
> +++ llvm/trunk/include/llvm-c/Target.h Wed Oct 23 12:56:52 2013
> @@ -22,6 +22,10 @@
>  #include "llvm-c/Core.h"
>  #include "llvm/Config/llvm-config.h"
>
> +#if defined(_MSC_VER) && !defined(inline)
> +#define inline __inline
> +#endif
> +
>  #ifdef __cplusplus
>  extern "C" {
>  #endif
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list