Skip to content

Commit 1ae57fe

Browse files
committed
[cli] Show GCC/MinGW version
1 parent d5cdd83 commit 1ae57fe

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/shim.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,11 @@ rust::Str geographiclib_version() noexcept {
6161

6262
static std::string ver_string;
6363

64-
const char* msvc_version() noexcept {
64+
const char* msvc_version(unsigned long full_ver) noexcept {
6565
if (!ver_string.empty()) {
6666
return ver_string.c_str();
6767
}
6868

69-
unsigned long full_ver = _MSC_FULL_VER;
7069
auto major = full_ver / 10000000;
7170
auto minor = (full_ver / 100000) % 100;
7271
auto patch = full_ver % 100000;
@@ -79,9 +78,16 @@ const char* msvc_version() noexcept {
7978

8079
rust::Str compiler_version() noexcept {
8180
#if defined(_MSC_FULL_VER)
82-
return msvc_version();
81+
return msvc_version(_MSC_FULL_VER);
8382
#elif defined(__clang__)
8483
return "clang " STRINGIFY(__clang_major__) "." STRINGIFY(__clang_minor__) "." STRINGIFY(__clang_patchlevel__);
84+
#elif defined(__GNUC__)
85+
#ifdef __MINGW32__
86+
#define CCNAME "mingw"
87+
#else
88+
#define CCNAME "gcc"
89+
#endif
90+
return CCNAME " " STRINGIFY(__GNUC__) "." STRINGIFY(__GNUC_MINOR__) "." STRINGIFY(__GNUC_PATCHLEVEL__);
8591
#else
8692
return "unknown";
8793
#endif

0 commit comments

Comments
 (0)