[flang-commits] [PATCH] D84334: Version information in flang/f18

Richard Barton via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jul 28 01:33:12 PDT 2020


richard.barton.arm added a comment.

Although LLVM flang is the spiritual successor to classic flang, I don't think we are specifically aiming for any sort of compatibility between the two compilers, for example on option names, feature support, language support, processor defined behavior, 'bug compatibility', etc. so in this sense the two are completely different compilers. I think it unlikely that a user of classic flang that has conditionalized some code on `__FLANG` due to some quirk of classic flang or some bug in classic flang that they are working around will necessarily need or want to run the same code for LLVM flang for the same reason. I think this would steer us strongly away from supporting `__FLANG` in LLVM flang to indicate that it and classic flang are connected in this way.

Could we simply follow what clang does here and use lowercase for the macro name, i.e. `__flang_major__` ? That would make LLVM flang totally distinct from classic flang whilst also preserving the obvious meanings of the macros.

I would also suggest matching clang a bit more closely, so using the trailing underscores across the piece and also making `__flang__` defined to `1` and adding `__flang_version__` to hold the full version number.

I think keeping `__F18` for backwards compatibility is fine, but given that the community today is very small (just the developers) if we can take this opportunity to delete it now before more users can come to depend on it then we should do so. I guess the only likely existing users might be @AlexisPerry or someone in @sscalpone 's team?

My proposal would be to support

  #define __flang__            1 
  #define __flang_major__      "@LLVM_VERSION_MAJOR@"
  #define __flang_minor__      "@LLVM_VERSION_MINOR@"
  #define __flang_patchlevel__ "@LLVM_VERSION_PATCH@"
  #define __flang_version__    "@LLVM_VERSION_MAJOR at .@LLVM_VERSION_MINOR at .@LLVM_VERSION_PATCH@"

+ the existing `__F18...` flags for backwards compatibility if we absolutely need to.

I also think we should ask to cherry pick this to the LLVM 10 release branch.

Thanks for the patch @coti , we should have thought of this sooner :-)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84334/new/

https://reviews.llvm.org/D84334



More information about the flang-commits mailing list