diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-03-04 23:35:11 -0500 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2019-03-17 19:38:18 -0400 |
commit | b28e95ca1aa2860c0869041c29a3ba27054e5967 (patch) | |
tree | b507c6a45c52fff68a449f20213d39b6bc8e4a29 /src/command.h | |
parent | 7eda55e2b042566020ade34d7b2cdb9296f37f1d (diff) | |
download | kutter-b28e95ca1aa2860c0869041c29a3ba27054e5967.tar.gz kutter-b28e95ca1aa2860c0869041c29a3ba27054e5967.tar.xz kutter-b28e95ca1aa2860c0869041c29a3ba27054e5967.zip |
command: Always pass a string to the DECL_CONSTANT() macro
Make it clear that the name of the constant being defined is a string.
When the value being defined is also a string, use a new
DECL_CONSTANT_STR() macro.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/command.h')
-rw-r--r-- | src/command.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/command.h b/src/command.h index 92315f38..c924e59d 100644 --- a/src/command.h +++ b/src/command.h @@ -16,8 +16,8 @@ #define HF_IN_SHUTDOWN 0x01 // Handler can run even when in emergency stop // Declare a constant exported to the host -#define DECL_CONSTANT(NAME, VALUE) \ - _DECL_CONSTANT(NAME, VALUE) +#define DECL_CONSTANT(NAME, VALUE) _DECL_CONSTANT(NAME, __stringify(VALUE)) +#define DECL_CONSTANT_STR(NAME, VALUE) _DECL_CONSTANT(NAME, VALUE) // Send an output message (and declare a static message type for it) #define output(FMT, args...) \ @@ -88,8 +88,8 @@ uint8_t ctr_lookup_static_string(const char *str); #define _DECL_COMMAND(FUNC, FLAGS, MSG) \ DECL_CTR("_DECL_COMMAND " __stringify(FUNC) " " __stringify(FLAGS) " " MSG) -#define _DECL_CONSTANT(NAME, VALUE) \ - DECL_CTR("_DECL_CONSTANT " __stringify(NAME) " " __stringify(VALUE)) +#define _DECL_CONSTANT(NAME, VALUE) \ + DECL_CTR("_DECL_CONSTANT " NAME " " VALUE) #define _DECL_ENCODER(FMT) ({ \ DECL_CTR("_DECL_ENCODER " FMT); \ |