bcraig added a comment.

In http://reviews.llvm.org/D17741#365457, @thakis wrote:

> > I think we can do this separately. A "basename" macro is easier for 
> > programmers to use and no build system change needed.
>
>
> Hm, I would think that adding a flag to your CFLAGS is easier than getting 
> all your dependencies to use a clang-only new macro…


Depends a lot on the person and code base.
**Pro-macro situations:**
I've had code bases where the bulk of the code refused to use compiler / 
environment provided preprocessor tokens.  In those environments, all of the 
uses of __FILE__ and the like were in one place.  Adding a compiler test and 
switching to __CLANG_FILE_BASENAME__ would be easy in those code bases.  
Changing CFLAGS in dozens of different compiles wouldn't.

I've also seen uses of __FILE__ that would break if the file name changed 
drastically and unexpectedly.

**Pro-compilation switch situation:**
If __FILE__ is used in a lot of places, and the files are compiled with 
multiple compilers, then switching to a different macro would be problematic.  
If it is easy to change CFLAGS in all of your builds then the compilation 
switch makes sense.


http://reviews.llvm.org/D17741



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to