[flang-commits] [PATCH] D84334: Version information in flang/f18
Camille Coti via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Jul 22 15:29:15 PDT 2020
coti marked an inline comment as done.
coti added a comment.
Fixed an error in my reply
================
Comment at: flang/tools/f18/f18.cpp:414
+ options.predefinitions.emplace_back("__F18_PATCHLEVEL__", "0");
+ options.predefinitions.emplace_back("__FLANG", "12.0.0");
+ options.predefinitions.emplace_back("__FLANG_MAJOR__", "12");
----------------
coti wrote:
> klausler wrote:
> > coti wrote:
> > > klausler wrote:
> > > > The older flang compiler reportedly defines `__FLANG`. If so, it might be a bad idea to also define `__FLANG` in this newer flang compiler,; how would conditionally compiled code distinguish one flang compiler from the other?
> > > So I have a question here: what is the rule regarding compatibility between old and new flang? I came across situations where I needed these because I tried to compile software that knew the old flang and used these values.
> > Does that software that you mentioned use `#ifdef __FLANG` or `#if __FLANG`, as opposed to checking the value of the macro?
> This is in SuperLU.
>
> It looks for all of them but `__FLANG ` only needs to be defined:
>
> ```
> #elif defined(__FLANG)
> PRINT *, 'INFO:compiler[Flang]'
> # define COMPILER_VERSION_MAJOR DEC(__FLANG_MAJOR__)
> # define COMPILER_VERSION_MINOR DEC(__FLANG_MINOR__)
> # if defined(__FLANG_PATCHLEVEL__)
> # define COMPILER_VERSION_PATCH DEC(__FLANG_PATCHLEVEL__)
> # endif
> ```
Sorry, not in SuperLU, but in CMake 3.17.0
https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/CMakeFortranCompilerId.F.in
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84334/new/
https://reviews.llvm.org/D84334
More information about the flang-commits
mailing list