Skip to content

Commit

Permalink
feat: バージョン情報をマクロからコンパイル時定数に変更 #157
Browse files Browse the repository at this point in the history
  • Loading branch information
yutotnh committed Aug 12, 2023
1 parent 2b74371 commit b8fb005
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/spirit/include/version.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#ifndef SPIRIT_VERSION_H
#define SPIRIT_VERSION_H

#define SPIRIT_VERSION_MAJOR 0
#define SPIRIT_VERSION_MINOR 1
#define SPIRIT_VERSION_PATCH 0
namespace spirit {

#define SPIRIT_VERSION_STRING "0.1.0"
namespace version {

constexpr uint32_t major = 0;
constexpr uint32_t minor = 1;
constexpr uint32_t patch = 0;

constexpr char string[] = "0.1.0";

} // namespace version

} // namespace spirit

#endif // SPIRIT_VERSION_H
2 changes: 1 addition & 1 deletion src/spirit/src/Error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void Error::print(Type type, uint32_t code, const char* filename, const char* fu
"\tFunction: %s\n"
"\tLine: %d\n"
"\tMessage: ",
status_to_string(_status), type_to_string(type), code, SPIRIT_VERSION_STRING, filename, funcname, line_number);
status_to_string(_status), type_to_string(type), code, version::string, filename, funcname, line_number);

#ifdef __MBED__
vprintf(message, arg);
Expand Down

0 comments on commit b8fb005

Please sign in to comment.