Changeset View
Standalone View
flang/tools/f18/f18.cpp
Context not available. | |||||
#include <string> | #include <string> | ||||
#include <vector> | #include <vector> | ||||
#include "f18_version.h" | |||||
static std::list<std::string> argList(int argc, char *const argv[]) { | static std::list<std::string> argList(int argc, char *const argv[]) { | ||||
std::list<std::string> result; | std::list<std::string> result; | ||||
for (int j = 0; j < argc; ++j) { | for (int j = 0; j < argc; ++j) { | ||||
Context not available. | |||||
Exec(argv, driver.verbose); | Exec(argv, driver.verbose); | ||||
} | } | ||||
int printVersion() { | |||||
llvm::errs() << "\nf18 compiler (under development), version " | |||||
<< __FLANG_MAJOR__ << "." << __FLANG_MINOR__ << "." | |||||
<< __FLANG_PATCHLEVEL__ << "\n"; | |||||
return exitStatus; | |||||
} | |||||
int main(int argc, char *const argv[]) { | int main(int argc, char *const argv[]) { | ||||
atexit(CleanUpAtExit); | atexit(CleanUpAtExit); | ||||
AlexisPerry: Should we use "flang" instead of "f18" to better align with the project's name? | |||||
Not Done ReplyInline ActionsGood question. I left the original message, I let senior developers make a decision here. coti: Good question. I left the original message, I let senior developers make a decision here. | |||||
Not Done ReplyInline ActionsIf we adopt @richard.barton.arm's proposal, I think it would be a good idea to make use of the __flang_version__ macro here so that the output actually prints the version number. AlexisPerry: If we adopt @richard.barton.arm's proposal, I think it would be a good idea to make use of the… | |||||
Not Done ReplyInline ActionsPerhaps the message could be "flang front end" ? sscalpone: Perhaps the message could be "flang front end" ? | |||||
Context not available. | |||||
options.predefinitions.emplace_back("__F18_MAJOR__", "1"); | options.predefinitions.emplace_back("__F18_MAJOR__", "1"); | ||||
options.predefinitions.emplace_back("__F18_MINOR__", "1"); | options.predefinitions.emplace_back("__F18_MINOR__", "1"); | ||||
options.predefinitions.emplace_back("__F18_PATCHLEVEL__", "1"); | options.predefinitions.emplace_back("__F18_PATCHLEVEL__", "1"); | ||||
options.predefinitions.emplace_back("__flang__", __FLANG__); | |||||
options.predefinitions.emplace_back("__flang_major__", __FLANG_MAJOR__); | |||||
options.predefinitions.emplace_back("__flang_minor__", __FLANG_MINOR__); | |||||
Not Done ReplyInline ActionsCmake has the capability to generate files, usually taking a "foo.in" and creating a "foo" with macro substitution. Is that technique possible for the version numbers? sscalpone: Cmake has the capability to generate files, usually taking a "foo.in" and creating a "foo" with… | |||||
Yes it is! Should I "update diff" to show it? coti: Yes it is! Should I "update diff" to show it? | |||||
options.predefinitions.emplace_back( | |||||
"__flang_patchlevel__", __FLANG_PATCHLEVEL__); | |||||
#if __x86_64__ | #if __x86_64__ | ||||
options.predefinitions.emplace_back("__x86_64__", "1"); | options.predefinitions.emplace_back("__x86_64__", "1"); | ||||
Not Done ReplyInline ActionsThe 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? klausler: The older flang compiler reportedly defines `__FLANG`. If so, it might be a bad idea to also… | |||||
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. coti: So I have a question here: what is the rule regarding compatibility between old and new flang? | |||||
Not Done ReplyInline ActionsDoes that software that you mentioned use #ifdef __FLANG or #if __FLANG, as opposed to checking the value of the macro? klausler: Does that software that you mentioned use `#ifdef __FLANG` or `#if __FLANG`, as opposed to… | |||||
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 coti: This is in SuperLU.
It looks for all of them but `__FLANG ` only needs to be defined:
```… | |||||
Sorry, not in SuperLU, but in CMake 3.17.0 coti: Sorry, not in SuperLU, but in CMake 3.17.0
https://gitlab.kitware. | |||||
#endif | #endif | ||||
Please change to arg == "--version" to align with the clang, gfortran, and pgf90 flag. AlexisPerry: Please change to `arg == "--version" ` to align with the clang, gfortran, and pgf90 flag. | |||||
Given the bug that you have found with flang_version, I suggest we don't define the external macro in this patch, given that it won't be usable and it's essentially exposing the bug that wasn't there before. richard.barton.arm: Given the bug that you have found with __flang_version__, I suggest we don't define the… | |||||
Context not available. | |||||
<< "Unrecognised options are passed through to the external compiler\n" | << "Unrecognised options are passed through to the external compiler\n" | ||||
<< "set by F18_FC (see defaults).\n"; | << "set by F18_FC (see defaults).\n"; | ||||
return exitStatus; | return exitStatus; | ||||
} else if (arg == "-V") { | } else if (arg == "-V" || arg == "--version") { | ||||
llvm::errs() << "\nf18 compiler (under development)\n"; | return printVersion(); | ||||
return exitStatus; | |||||
} else { | } else { | ||||
driver.F18_FCArgs.push_back(arg); | driver.F18_FCArgs.push_back(arg); | ||||
if (arg == "-v") { | if (arg == "-v") { | ||||
driver.verbose = true; | if (args.size() > 1) { | ||||
driver.verbose = true; | |||||
} else { | |||||
return printVersion(); | |||||
} | |||||
} else if (arg == "-I") { | } else if (arg == "-I") { | ||||
driver.F18_FCArgs.push_back(args.front()); | driver.F18_FCArgs.push_back(args.front()); | ||||
driver.searchDirectories.push_back(args.front()); | driver.searchDirectories.push_back(args.front()); | ||||
Context not available. |
Should we use "flang" instead of "f18" to better align with the project's name?