On Fri, Jun 23, 2017 at 06:05:34PM +0300, Victor Krapivensky wrote:
[...]
> +#define MBRESTART(res, sig)                                                  
>         \
> +     if ((res) >= 0 && ptrace_restart(PTRACE_SYSCALL, current_tcp, sig) < 0) 
> {       \
> +             /* Note: ptrace_restart emitted error message */                
>         \
> +             exit_code = 1;                                                  
>         \
> +             return NULL;                                                    
>         \
> +     }

Consider enclosing macros starting with "if" statement in a do/while loop.

> +
> +     if (!first) {
> +             unsigned int sig = 0;
> +             int res;
> +             if (entering(current_tcp)) {
> +                     res = syscall_entering_trace(current_tcp, &sig);
> +                     syscall_entering_finish(current_tcp, res);
> +             } else {
> +                     res = syscall_exiting_trace(current_tcp, tv, 1);
> +                     syscall_exiting_finish(current_tcp);
> +             }
> +             MBRESTART(res, sig);

This MBRESTART expands into if (...) {...};

[...]
> +#define EXPOSE(type, ptr, name)                                              
>                 \
> +     lua_getfield(L, -2, "cast"); /* L: chunk ffi table cast */              
>         \
> +     lua_pushstring(L, type); /* L: chunk ffi table cast str */              
>         \
> +     lua_pushlightuserdata(L, (void *) ptr); /* L: chunk ffi table cast str 
> ptr */   \
> +     assert_lua(lua_pcall(L, 2, 1, 0)); /* L: chunk ffi table value */       
>         \
> +     lua_setfield(L, -2, name); /* L: chunk ffi table */

Consider enclosing macros with multiple statements in a do/while loop.

> +
> +     EXPOSE("const struct_sysent **", sysent_vec, "sysent_vec")
> +     EXPOSE("const char ***", errnoent_vec, "errnoent_vec")
> +     EXPOSE("const char ***", signalent_vec, "signalent_vec")
> +     EXPOSE("const struct_ioctlent **", ioctlent_vec, "ioctlent_vec");

The last EXPOSE expands into ...;;


-- 
ldv

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to