[llvm-dev] lit conditional compilation/checking?

Jonathan Roelofs via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 14 15:17:31 PDT 2016



On 4/14/16 3:42 PM, <Alexander G. Riccio> via llvm-dev wrote:
>     Clang should be setting up the usual preprocessor defines based on
>     the target.
>
> placeholder text
> It doesn't seem like that works as I'd expect: an #if defined(_WIN32)
> didn't seem to fire on my local Windows machine. What #defines can I use?

What did you set the target to in the test? Clang is a cross compiler...


Jon

>
> Sincerely,
> Alexander Riccio
> --
> "Change the world or go home."
> about.me/ariccio <http://about.me/ariccio>
>
> <http://about.me/ariccio>
> If left to my own devices, I will build more.
>>
> On Wed, Apr 13, 2016 at 7:05 PM, Robinson, Paul
> <Paul_Robinson at playstation.sony.com
> <mailto:Paul_Robinson at playstation.sony.com>> wrote:
>
>     Clang should be setting up the usual preprocessor defines based on
>     the target.  So, you can bracket chunks of C/C++ source in a lit
>     test with #if to guard target-dependent stuff.  Charles Li has been
>     updating a bunch of tests to have sections guarded by tests on the
>     value of __cplusplus, for example (e.g. see r266239).____
>
>     If you're asking about conditionally executing RUN lines, I don't
>     think there's a way to do that; you'd need to split the new stuff
>     into its own file and use REQUIRES to set the correct conditions.____
>
>     --paulr____
>
>     __ __
>
>     *From:*llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org
>     <mailto:llvm-dev-bounces at lists.llvm.org>] *On Behalf Of *<Alexander
>     G. Riccio> via llvm-dev
>     *Sent:* Wednesday, April 13, 2016 1:56 PM
>     *To:* llvm-dev
>     *Subject:* [llvm-dev] lit conditional compilation/checking?____
>
>     __ __
>
>     How can I platform-conditionally compile/check sections of code with
>     lit? Can I rely on preprocessor defines like _WIN32?____
>
>     __ __
>
>     Specifically, I'm adding new tests to existing lit tests, but the
>     new tests should only be compiled and run on Windows.____
>
>     __ __
>
>
>     ____
>
>     Sincerely,
>     Alexander Riccio
>     --
>     "Change the world or go home."____
>
>     about.me/ariccio <http://about.me/ariccio>____
>
>
>     <http://about.me/ariccio>____
>
>     If left to my own devices, I will build more.____
>
>     ⁂____
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded


More information about the llvm-dev mailing list