Commit 01206091 authored by Arthur O'Dwyer's avatar Arthur O'Dwyer
Browse files

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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment