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

John Ericson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 21 14:38:42 PDT 2018


Ericson2314 added a comment.

One that that might make my position clearer is to substitute the name "build", "host", and "target" for "build", "run", and "emit". [A colleague of mine proposed these alternative names and I do think they are vastly more human friendly.]

Then if we write

  int main(void) {
  
  #if __is_run(window)
    printf("Hello, Satya");
  #elif __is_run(darwin)
    printf("Hello, Tim");
  #else
    prinf("Unclear who I am talking too.");
  #endif
  
  #if __is_emit(darwin)
    #error "What's a Mach-O?"
  #else
    /* do something with binutils */
  #endif
  
    return 0;
  }

and run

  clang -emit something main.c

it is clear the intention is *not* for `-emit` to control `__is_emit`.

To me, this makes clear that the problem isn't the name-shift I am proposing, but the inherent vagary of the terms "host" and "target" relative to their specific meaning in Autoconf's jargon.


Repository:
  rC Clang

https://reviews.llvm.org/D44753





More information about the cfe-commits mailing list