Where is __builtin_launder?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Where is __builtin_launder?

Joerg Sonnenberger via cfe-dev
Hi,

I'm trying to use __builtin_launder with Clang 6 RC2, but it doesn't seem to be available. I'm on Windows, but Wandbox's Clang HEAD doesn't seem to have this builtin either.

Am I doing something wrong, or is the builtin actually missing?

C:\Temp>type meow.cpp
#include <stdio.h>

int main() {
#ifdef __has_builtin
    #define PRINT(X) printf(#X " is %d\n", X)
    PRINT(__has_builtin(__builtin_meow));
    PRINT(__has_builtin(__builtin_huge_val));
    PRINT(__has_builtin(__builtin_launder));
#else
    puts("__has_builtin is NOT available.");
#endif

#ifdef USE_LAUNDER
    int * p = nullptr;
    int * q = __builtin_launder(p);
    (void) q;
#endif
}

C:\Temp>cl /EHsc /nologo /W4 /std:c++latest meow.cpp && meow
meow.cpp
__has_builtin is NOT available.

C:\Temp>clang-cl -v
clang version 6.0.0 (tags/RELEASE_600/rc2)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: S:\msvc\src\vctools\NonShip\ClangLLVM\bin

C:\Temp>clang-cl -m32 /EHsc /nologo /W4 /std:c++latest meow.cpp && meow
__has_builtin(__builtin_meow) is 0
__has_builtin(__builtin_huge_val) is 1
__has_builtin(__builtin_launder) is 0

C:\Temp>clang-cl -m32 /EHsc /nologo /W4 /std:c++latest /DUSE_LAUNDER meow.cpp && meow
meow.cpp(15,15):  error: use of undeclared identifier '__builtin_launder'
    int * q = __builtin_launder(p);
              ^
1 error generated.

Thanks,
STL
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Where is __builtin_launder?

Joerg Sonnenberger via cfe-dev
> On Feb 22, 2018, at 11:52 PM, Stephan T. Lavavej via cfe-dev <[hidden email]> wrote:
>
> Hi,
>
> I'm trying to use __builtin_launder with Clang 6 RC2, but it doesn't seem to be available. I'm on Windows, but Wandbox's Clang HEAD doesn't seem to have this builtin either.
>
> Am I doing something wrong, or is the builtin actually missing?

The patch implementing it literally hasn't been committed to Clang trunk yet.  I'm not sure how you got the impression it was available for use.

John.

>
> C:\Temp>type meow.cpp
> #include <stdio.h>
>
> int main() {
> #ifdef __has_builtin
>    #define PRINT(X) printf(#X " is %d\n", X)
>    PRINT(__has_builtin(__builtin_meow));
>    PRINT(__has_builtin(__builtin_huge_val));
>    PRINT(__has_builtin(__builtin_launder));
> #else
>    puts("__has_builtin is NOT available.");
> #endif
>
> #ifdef USE_LAUNDER
>    int * p = nullptr;
>    int * q = __builtin_launder(p);
>    (void) q;
> #endif
> }
>
> C:\Temp>cl /EHsc /nologo /W4 /std:c++latest meow.cpp && meow
> meow.cpp
> __has_builtin is NOT available.
>
> C:\Temp>clang-cl -v
> clang version 6.0.0 (tags/RELEASE_600/rc2)
> Target: x86_64-pc-windows-msvc
> Thread model: posix
> InstalledDir: S:\msvc\src\vctools\NonShip\ClangLLVM\bin
>
> C:\Temp>clang-cl -m32 /EHsc /nologo /W4 /std:c++latest meow.cpp && meow
> __has_builtin(__builtin_meow) is 0
> __has_builtin(__builtin_huge_val) is 1
> __has_builtin(__builtin_launder) is 0
>
> C:\Temp>clang-cl -m32 /EHsc /nologo /W4 /std:c++latest /DUSE_LAUNDER meow.cpp && meow
> meow.cpp(15,15):  error: use of undeclared identifier '__builtin_launder'
>    int * q = __builtin_launder(p);
>              ^
> 1 error generated.
>
> Thanks,
> STL
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Where is __builtin_launder?

Joerg Sonnenberger via cfe-dev
[STL]
> Am I doing something wrong, or is the builtin actually missing?

[John McCall]
> The patch implementing it literally hasn't been committed to Clang trunk yet.
> I'm not sure how you got the impression it was available for use.

Aha, thanks! I was confused because libc++ marked std::launder() as "Complete, 6.0" at https://libcxx.llvm.org/cxx1z_status.html .

STL
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Where is __builtin_launder?

Joerg Sonnenberger via cfe-dev
> On Feb 23, 2018, at 12:20 AM, Stephan T. Lavavej <[hidden email]> wrote:
>
> [STL]
>> Am I doing something wrong, or is the builtin actually missing?
>
> [John McCall]
>> The patch implementing it literally hasn't been committed to Clang trunk yet.
>> I'm not sure how you got the impression it was available for use.
>
> Aha, thanks! I was confused because libc++ marked std::launder() as "Complete, 6.0" at https://libcxx.llvm.org/cxx1z_status.html .

That's an interesting choice on their part.

John.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev