[llvm-branch-commits] [flang] a1bbd1e - [flang][driver] Unify f18_version.h.in and Version.inc.in
Andrzej Warzynski via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jan 14 05:55:06 PST 2021
Author: Andrzej Warzynski
Date: 2021-01-14T13:50:46Z
New Revision: a1bbd1ef1dbd2a39777ef0b2d623f15f0523cdbf
URL: https://github.com/llvm/llvm-project/commit/a1bbd1ef1dbd2a39777ef0b2d623f15f0523cdbf
DIFF: https://github.com/llvm/llvm-project/commit/a1bbd1ef1dbd2a39777ef0b2d623f15f0523cdbf.diff
LOG: [flang][driver] Unify f18_version.h.in and Version.inc.in
Flang has two CMake configurable header files that define compiler
version numbers:
* f18_version.h.in - only used in f18.cpp (uses version numbers from
LLVM's macro definitions)
* Version.inc.in - not currently used (uses version numbers hard-coded
in Flang's top CMake script)
Currently only f18_version.h.in provides version numbers consistent with
other subprojects in llvm-project. However, its location and name are
inconsistent with e.g. Clang. This patch merges the two headers
together:
* hard-coded version numbers in Flang's top CMake script are deleted
* Version.inc.in is updated to provide string versions of version
numbers (required by f18.cpp)
* f18_version.h.in is deleted as it's no longer needed
Differential Revision: https://reviews.llvm.org/D94422
Added:
Modified:
flang/CMakeLists.txt
flang/include/flang/Version.inc.in
flang/tools/f18/CMakeLists.txt
flang/tools/f18/f18.cpp
Removed:
flang/tools/f18/f18_version.h.in
################################################################################
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index a73655baffe8..07d34354bd81 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -268,10 +268,6 @@ endif()
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
-# Override LLVM versioning for now...
-set(FLANG_VERSION_MAJOR "0")
-set(FLANG_VERSION_MINOR "1")
-set(FLANG_VERSION_PATCHLEVEL "0")
if (NOT DEFINED FLANG_VERSION_MAJOR)
diff --git a/flang/include/flang/Version.inc.in b/flang/include/flang/Version.inc.in
index a0eeab2686a9..562b5832e771 100644
--- a/flang/include/flang/Version.inc.in
+++ b/flang/include/flang/Version.inc.in
@@ -1,5 +1,8 @@
#define FLANG_VERSION @FLANG_VERSION@
#define FLANG_VERSION_STRING "@FLANG_VERSION@"
#define FLANG_VERSION_MAJOR @FLANG_VERSION_MAJOR@
+#define FLANG_VERSION_MAJOR_STRING "@FLANG_VERSION_MAJOR@"
#define FLANG_VERSION_MINOR @FLANG_VERSION_MINOR@
+#define FLANG_VERSION_MINOR_STRING "@FLANG_VERSION_MINOR@"
#define FLANG_VERSION_PATCHLEVEL @FLANG_VERSION_PATCHLEVEL@
+#define FLANG_VERSION_PATCHLEVEL_STRING "@FLANG_VERSION_PATCHLEVEL@"
diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index 8f30bfa47b79..2e5350aecdc6 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -72,5 +72,3 @@ if (NOT WIN32)
FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE)
install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/flang DESTINATION bin)
endif()
-
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/f18_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/f18_version.h @ONLY)
diff --git a/flang/tools/f18/f18.cpp b/flang/tools/f18/f18.cpp
index 8b7cc099bac1..bdf48d071142 100644
--- a/flang/tools/f18/f18.cpp
+++ b/flang/tools/f18/f18.cpp
@@ -8,7 +8,6 @@
// Temporary Fortran front end driver main program for development scaffolding.
-#include "f18_version.h"
#include "flang/Common/Fortran-features.h"
#include "flang/Common/default-kinds.h"
#include "flang/Evaluate/expression.h"
@@ -25,6 +24,7 @@
#include "flang/Semantics/runtime-type-info.h"
#include "flang/Semantics/semantics.h"
#include "flang/Semantics/unparse-with-symbols.h"
+#include "flang/Version.inc"
#include "llvm/Support/Errno.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Program.h"
@@ -389,8 +389,8 @@ void Link(std::vector<std::string> &liblist, std::vector<std::string> &objects,
int printVersion() {
llvm::errs() << "\nf18 compiler (under development), version "
- << __FLANG_MAJOR__ << "." << __FLANG_MINOR__ << "."
- << __FLANG_PATCHLEVEL__ << "\n";
+ << FLANG_VERSION_MAJOR << "." << FLANG_VERSION_MINOR << "."
+ << FLANG_VERSION_PATCHLEVEL << "\n";
return exitStatus;
}
@@ -415,11 +415,13 @@ int main(int argc, char *const argv[]) {
options.predefinitions.emplace_back("__F18_MAJOR__", "1");
options.predefinitions.emplace_back("__F18_MINOR__", "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__);
+ options.predefinitions.emplace_back("__flang__", FLANG_VERSION_STRING);
options.predefinitions.emplace_back(
- "__flang_patchlevel__", __FLANG_PATCHLEVEL__);
+ "__flang_major__", FLANG_VERSION_MAJOR_STRING);
+ options.predefinitions.emplace_back(
+ "__flang_minor__", FLANG_VERSION_MINOR_STRING);
+ options.predefinitions.emplace_back(
+ "__flang_patchlevel__", FLANG_VERSION_PATCHLEVEL_STRING);
#if __x86_64__
options.predefinitions.emplace_back("__x86_64__", "1");
#endif
diff --git a/flang/tools/f18/f18_version.h.in b/flang/tools/f18/f18_version.h.in
deleted file mode 100644
index 0c8d5227cd00..000000000000
--- a/flang/tools/f18/f18_version.h.in
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _F18_H_
-#define _F18_H_
-
-#define __FLANG__ "1"
-#define __FLANG_MAJOR__ "@LLVM_VERSION_MAJOR@"
-#define __FLANG_MINOR__ "@LLVM_VERSION_MINOR@"
-#define __FLANG_PATCHLEVEL__ "@LLVM_VERSION_PATCH@"
-
-#endif // _F18_H_
More information about the llvm-branch-commits
mailing list