On Tue, Sep 24, 2019 at 12:50 AM Bart Van Assche <bvanassche@xxxxxxx> wrote: > > On 6/20/19 8:03 AM, Jack Wang wrote: > > +#define P1 ) > > +#define P2 )) > > +#define P3 ))) > > +#define P4 )))) > > +#define P(N) P ## N > > + > > +#define CAT(a, ...) PRIMITIVE_CAT(a, __VA_ARGS__) > > +#define PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__ > > + > > +#define LIST(...) \ > > + __VA_ARGS__, \ > > + ({ unknown_type(); NULL; }) \ > > + CAT(P, COUNT_ARGS(__VA_ARGS__)) \ > > + > > +#define EMPTY() > > +#define DEFER(id) id EMPTY() > > + > > +#define _CASE(obj, type, member) \ > > + __builtin_choose_expr( \ > > + __builtin_types_compatible_p( \ > > + typeof(obj), type), \ > > + ((type)obj)->member > > +#define CASE(o, t, m) DEFER(_CASE)(o, t, m) > > + > > +/* > > + * Below we define retrieving of sessname from common IBTRS types. > > + * Client or server related types have to be defined by special > > + * TYPES_TO_SESSNAME macro. > > + */ > > + > > +void unknown_type(void); > > + > > +#ifndef TYPES_TO_SESSNAME > > +#define TYPES_TO_SESSNAME(...) ({ unknown_type(); NULL; }) > > +#endif > > + > > +#define ibtrs_prefix(obj) \ > > + _CASE(obj, struct ibtrs_con *, sess->sessname), \ > > + _CASE(obj, struct ibtrs_sess *, sessname), \ > > + TYPES_TO_SESSNAME(obj) \ > > + )) > > No preprocessor voodoo please. Please remove all of the above and modify > the logging statements such that these pass the proper name string as > first argument to logging macros. Hi Bart, do you think it would make sense we first submit a new patchset for IBTRS (with the changes you suggested plus closed security problem) and later submit a separate one for IBNBD only? Thank you, Danil