[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:25:57 PDT 2020


coti marked an inline comment as done.
coti added a comment.

Replied inline comment from @klausler



================
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");
----------------
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
 ```


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

https://reviews.llvm.org/D84334





More information about the flang-commits mailing list