Hi Charlotte, On 9/19/21 2:07 AM, Charlotte Delenk wrote: > The _auto_-macro used in cert.c and tls.c uses a GCC extension that > allows for nested functions. This is not supported by other compilers, > including clang. > > Compiling ell with these compilers will result error messages such as: > > ../ell-0.44/ell/tls.c:1895:2: error: function definition is not allowed here > _auto_(l_certchain_free) struct l_certchain *certchain = NULL; > ^ > ../ell-0.44/ell/useful.h:71:2: note: expanded from macro '_auto_' > _AUTODESTRUCT(__COUNTER__, func) > ^ > ../ell-0.44/ell/useful.h:68:2: note: expanded from macro '_AUTODESTRUCT' > __AUTODESTRUCT(var, func) > ^ > ../ell-0.44/ell/useful.h:64:2: note: expanded from macro '__AUTODESTRUCT' > { func(*(void **) ptr); } \ > ^ > ../ell-0.44/ell/tls.c:1895:2: error: use of undeclared identifier 'cleanup_0' > ../ell-0.44/ell/useful.h:71:2: note: expanded from macro '_auto_' > _AUTODESTRUCT(__COUNTER__, func) > ^ > ../ell-0.44/ell/useful.h:68:2: note: expanded from macro '_AUTODESTRUCT' > __AUTODESTRUCT(var, func) > ^ > ../ell-0.44/ell/useful.h:65:23: note: expanded from macro '__AUTODESTRUCT' > __attribute((cleanup(cleanup_ ## var))) > ^ > > This patch will removes the _auto_ macro and implement its functionality > manually in the two locations it is used. The problem is that we like the _auto_ macro ;) And getting rid of it in iwd isn't as easy. > > It does not appear to be possible to replace this macro with a more > compatible alternative that does not involve C++. > So what about doing something like this (attached). This approach is a bit less flexible than our current version since we have to declare extra destructors, but maybe clang doesn't hate it? > Signed-off-by: Charlotte Delenk Just FYI, we do not use S-o-b tags here. > --- > ell/cert.c | 6 +++++- > ell/tls.c | 6 +++++- > ell/useful.h | 11 ----------- > 3 files changed, 10 insertions(+), 13 deletions(-) > Regards, -Denis