Try to fix bug 10000.
This involves duplicating macros, but at least it 1) doesn't have empty arguments to macros, which are apparently considered "undefined" by C90 and C++98 and 2) doesn't involve "extern" applied to a definition rather than a declaration, which breaks building on some platforms (and which I think is also not legal C). Change-Id: I7eb98963a6d2e1bc9f869ebce3d7ba9228b6c9e4 Reviewed-on: https://code.wireshark.org/review/1188 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
f52626cc83
commit
c531099875
|
@ -73,13 +73,13 @@ typedef struct _value_string {
|
|||
|
||||
/* -- Public -- */
|
||||
#define VALUE_STRING_ENUM( array_name) _VS_ENUM_XXX( array_name, _VS_ENUM_ENTRY)
|
||||
#define VALUE_STRING_ARRAY( array_name) _VS_ARRAY_XXX(array_name, _VS_ARRAY_ENTRY, static)
|
||||
#define VALUE_STRING_ARRAY_GLOBAL_DEF( array_name) _VS_ARRAY_XXX(array_name, _VS_ARRAY_ENTRY, extern)
|
||||
#define VALUE_STRING_ARRAY( array_name) _VS_ARRAY_SC_XXX(array_name, _VS_ARRAY_ENTRY, static)
|
||||
#define VALUE_STRING_ARRAY_GLOBAL_DEF( array_name) _VS_ARRAY_XXX(array_name, _VS_ARRAY_ENTRY)
|
||||
#define VALUE_STRING_ARRAY_GLOBAL_DCL( array_name) _VS_ARRAY_SC_TYPE_NAME(array_name, extern)
|
||||
|
||||
#define VALUE_STRING_ENUM2( array_name) _VS_ENUM_XXX( array_name, _VS_ENUM_ENTRY2)
|
||||
#define VALUE_STRING_ARRAY2( array_name) _VS_ARRAY_XXX(array_name, _VS_ARRAY_ENTRY2, static)
|
||||
#define VALUE_STRING_ARRAY2_GLOBAL_DEF( array_name) _VS_ARRAY_XXX(array_name, _VS_ARRAY_ENTRY2, extern)
|
||||
#define VALUE_STRING_ARRAY2( array_name) _VS_ARRAY_SC_XXX(array_name, _VS_ARRAY_ENTRY2, static)
|
||||
#define VALUE_STRING_ARRAY2_GLOBAL_DEF( array_name) _VS_ARRAY_XXX(array_name, _VS_ARRAY_ENTRY2)
|
||||
#define VALUE_STRING_ARRAY2_GLOBAL_DCL( array_name) _VS_ARRAY_SC_TYPE_NAME(array_name, extern)
|
||||
|
||||
/* -- Private -- */
|
||||
|
@ -88,13 +88,20 @@ enum { \
|
|||
array_name##_VALUE_STRING_LIST(macro) \
|
||||
}
|
||||
|
||||
#define _VS_ARRAY_XXX(array_name, macro, sc) \
|
||||
#define _VS_ARRAY_SC_XXX(array_name, macro, sc) \
|
||||
_VS_ARRAY_SC_TYPE_NAME(array_name, sc) = { \
|
||||
array_name##_VALUE_STRING_LIST(macro) \
|
||||
{ 0, NULL } \
|
||||
}
|
||||
|
||||
#define _VS_ARRAY_XXX(array_name, macro) \
|
||||
_VS_ARRAY_TYPE_NAME(array_name) = { \
|
||||
array_name##_VALUE_STRING_LIST(macro) \
|
||||
{ 0, NULL } \
|
||||
}
|
||||
|
||||
#define _VS_ARRAY_SC_TYPE_NAME(array_name, sc) sc const value_string array_name[]
|
||||
#define _VS_ARRAY_TYPE_NAME(array_name) const value_string array_name[]
|
||||
|
||||
#define _VS_ENUM_ENTRY( name, value, string) name = value,
|
||||
#define _VS_ARRAY_ENTRY(name, value, string) { value, string },
|
||||
|
|
Loading…
Reference in New Issue