Add support for multiple M_LET on the same line

without warning about shadow variables.
This commit is contained in:
Patrick Pelissier committed 2018-08-04 08:34:35 +02:00
1 parent 92d7009804
commit e95d13adb1
2 files changed
+3 -5

No files matched your search

+1 -3
View File
@@ -234,9 +234,7 @@ test(array_seed_t seed, array_value_t value, dict_mph_t dict)
int main(int argc, const char *argv[])
{
M_LET(arr, array_string_t)
M_LET(dict, dict_mph_t)
M_LET(seed, array_seed_t)
M_LET(arr, array_string_t) M_LET(dict, dict_mph_t) M_LET(seed, array_seed_t)
M_LET(value, array_value_t) {
const char *filename = (argc > 1) ? argv[1] :"/usr/share/dict/words";
dict_read_from_file(dict, arr, filename);
+2 -2
View File
@@ -1959,8 +1959,8 @@ m_core_hash (const void *str, size_t length)
Last argument can be the oplist or the type itself if a global
oplist has been recorded for this type.
*/
#define M_LET(...) \
M_ID(M_LETI1 M_INVERT( __VA_ARGS__, M_C(local_cont_, __LINE__) ))
#define M_LET(a, ...) \
M_ID(M_LETI1 M_INVERT(a, __VA_ARGS__, M_C3(local_cont_, a, __LINE__) ))
#define M_LETI1(cont, oplist, ...) \
M_LETI2(cont, M_GLOBAL_OPLIST(oplist), __VA_ARGS__)