mirror of https://gerrit.osmocom.org/libosmocore
fix OSMO_VALUE_STRING macro: don't use OSMO_STRINGIFY()
To be able to use OSMO_VALUE_STRING() on a #defined constant, don't use OSMO_STRINGIFY(): the second indirection resolves the #define to its value, so for example OSMO_VALUE_STRING(GSM48_PDISC_MM) would resolve to { 0x05, "0x05" } When using '#x' directly, this becomes the desired { 0x05, "GSM48_PDISC_MM" } With enum values as we've used until now, this problem does not appear, because enum values are not resolved by the preprocessor. Keep OSMO_STRINGIFY() because it is used directly in openbsc (composing FSM state names). Change-Id: I91ecfcef61be8cf73d59ea821cc4fd9d2ad5c9c7
This commit is contained in:
parent
7c1ec8c8e7
commit
8a5d60b996
|
@ -18,7 +18,7 @@
|
|||
/*! \brief Stringify the contents of a macro, e.g. a port number */
|
||||
#define OSMO_STRINGIFY(x) #x
|
||||
/*! \brief Make a value_string entry from an enum value name */
|
||||
#define OSMO_VALUE_STRING(x) { x, OSMO_STRINGIFY(x) }
|
||||
#define OSMO_VALUE_STRING(x) { x, #x }
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
|
Loading…
Reference in New Issue