[PATCH] D44753: [Preprocessor] Rename __is_{target -> host}_* function-like builtin macros

Steven Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 21 14:55:06 PDT 2018


steven_wu added a comment.

It is not about matching command line name to builtin marco name. "target" is the platform we are compiling for, whether it is host or device or something else. It is a different concept when you talking about cross-compiling, which "target" is strictly not host and "build" or "host" doesn't matter to compiler at all.

> #if __is_run(window)
> 
>   printf("Hello, Satya");
> 
> #elif __is_run(darwin)
> 
>   printf("Hello, Tim");
> 
> #else
> 
>   prinf("Unclear who I am talking too.");
> 
> #endif

This example is bad because you do not know about runtime when you do compilation. Putting runtime environment onto #if is just wrong in many ways. If autoconf really has to name it to something else, you can always write a "#define" to rename __is_target.


Repository:
  rC Clang

https://reviews.llvm.org/D44753





More information about the cfe-commits mailing list