From 8c4904e3dcd4f547c5baf56251ced77a58a4b248 Mon Sep 17 00:00:00 2001 From: tqfx Date: Thu, 14 Mar 2024 00:09:43 +0800 Subject: [PATCH] remove src/version.cc --- include/a/version.h | 8 -------- javascript/src/a.cc | 18 +++++++++++++----- meson.build | 1 - src/version.cc | 6 ------ test/version.h | 6 +----- 5 files changed, 14 insertions(+), 25 deletions(-) delete mode 100644 src/version.cc diff --git a/include/a/version.h b/include/a/version.h index d091f88..b905c60 100644 --- a/include/a/version.h +++ b/include/a/version.h @@ -233,14 +233,6 @@ struct a_version { return a_version_cmp(this, &ver); } - /*! algorithm library version major */ - A_PUBLIC static unsigned int const MAJOR; - /*! algorithm library version minor */ - A_PUBLIC static unsigned int const MINOR; - /*! algorithm library version patch */ - A_PUBLIC static unsigned int const PATCH; - /*! algorithm library version tweak */ - A_PUBLIC static a_u32 const TWEAK; #endif /* __cplusplus */ }; diff --git a/javascript/src/a.cc b/javascript/src/a.cc index 209fbea..998ac18 100644 --- a/javascript/src/a.cc +++ b/javascript/src/a.cc @@ -814,7 +814,15 @@ struct version: public a_version alpha[2] = 0; alpha[3] = 0; } + static unsigned int const MAJOR; + static unsigned int const MINOR; + static unsigned int const PATCH; + static a_u32 const TWEAK; }; +unsigned int const version::MAJOR = A_VERSION_MAJOR; +unsigned int const version::MINOR = A_VERSION_MINOR; +unsigned int const version::PATCH = A_VERSION_PATCH; +a_u32 const version::TWEAK = A_VERSION_TWEAK; #include "a/math.h" #if __has_warning("-Wglobal-constructors") @@ -1070,11 +1078,11 @@ EMSCRIPTEN_BINDINGS(liba) // NOLINT .function("eq", &version::operator==) .function("ne", &version::operator!=) .function("toString", &version::toString) - .class_function("check", &a_version_check) - .class_property("MAJOR", &a_version::MAJOR) - .class_property("MINOR", &a_version::MINOR) - .class_property("PATCH", &a_version::PATCH) - .class_property("TWEAK", &a_version::TWEAK); + .class_property("MAJOR", &version::MAJOR) + .class_property("MINOR", &version::MINOR) + .class_property("PATCH", &version::PATCH) + .class_property("TWEAK", &version::TWEAK) + .class_function("check", &a_version_check); emscripten::constant("VERSION", std::string(A_VERSION)); #if defined(__has_feature) && __has_feature(address_sanitizer) emscripten::function("do_leak_check", &__lsan_do_recoverable_leak_check); diff --git a/meson.build b/meson.build index 9ccd92b..f775472 100644 --- a/meson.build +++ b/meson.build @@ -100,7 +100,6 @@ sources = [ 'src/utf.c', 'src/vec.c', 'src/version.c', - 'src/version.cc', ] python = import('python').find_installation() diff --git a/src/version.cc b/src/version.cc deleted file mode 100644 index 23f80cf..0000000 --- a/src/version.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include "a/version.h" - -unsigned int const a_version::MAJOR = A_VERSION_MAJOR; -unsigned int const a_version::MINOR = A_VERSION_MINOR; -unsigned int const a_version::PATCH = A_VERSION_PATCH; -a_u32 const a_version::TWEAK = A_VERSION_TWEAK; diff --git a/test/version.h b/test/version.h index be37096..d238798 100644 --- a/test/version.h +++ b/test/version.h @@ -87,11 +87,7 @@ int MAIN(int argc, char *argv[]) // NOLINT(misc-definitions-in-headers) debug("parse \"%s\" -> %s\n", argv[i], str); } printf("%s\n", A_FUNC); -#if defined(__cplusplus) - printf("version %u.%u.%u+%" PRIu32 "\n", a::version::MAJOR, a::version::MINOR, a::version::PATCH, a::version::TWEAK); -#else /* !__cplusplus */ - printf("version %u.%u.%u+%" PRIu32 "\n", a_version_major, a_version_minor, a_version_patch, a_version_tweak); -#endif /* __cplusplus */ + debug("version %u.%u.%u+%" PRIu32 "\n", a_version_major, a_version_minor, a_version_patch, a_version_tweak); TEST_BUG(a_version_check() == 0); return 0; } -- 2.11.4.GIT