uthash, utlist: Make the NO_DECLTYPE codepaths match more closely.
utlist had made `NO_DECLTYPE` the default on `__ICCARM__` since 368010b0, but uthash had never done so. Do so. utlist gave double-definition errors if `-DNO_DECLTYPE` was passed on the command line (for a compiler that otherwise supported decltype and/or __typeof). Fix that. Passing `-DLDECLTYPE(x)=decltype(x)` on the command line ought to do the right thing. Make it at least not double-define `DECLTYPE`. But we still have the problem that we do things like `LDECLTYPE(*p)`, which in C++ yields an lvalue reference type, not an object type. I don't know how to fix that. uthash's test87.c and test90.c gave errors in C++ with `-DNO_DECLTYPE` because the code now known as `HASH_AKBI_INNER_LOOP` would attempt to call the provided `cmpfcn` with an argument of type `(void *)` instead of the expected `decltype(head)`. This works in C with an implicit conversion, but doesn't work at all in C++ because it would try to call a different overload of the comparison function. So, if we have `NO_DECLTYPE`, let's use `head` as a scratch variable.
parent
47145f51
Please register or sign in to comment