[PATCH RFC v1 1/1] Initial support for Lua scripting

Victor Krapivensky krapivenskiy.va at phystech.edu
Sun Jun 18 23:55:43 UTC 2017


On Mon, Jun 19, 2017 at 12:36:41AM +0300, Dmitry V. Levin wrote:
> Do we need so many different stringify macros?
> Could we harmonize them somehow?

Well, we can't just place them into defs.h because sysent.h, but not
defs.h, is included by some tests/ files.

We could move all the STRINGIFY/#ifdef FFI_CDEF/CONTENT stuff to a
separate header. We would need to prefix them, though. I see two
possibilities:

1. A header without include guards that #undef's all the previously
defined macros, and defines new ones. Must be included whenever the
CONTENT macro is used, and bad things will happen if one forgets to do
so (old version of the macro will be used).

2. Further preprocessor black magic:

    #ifndef STRACE_FFI_H
    #define STRACE_FFI_H

    #define FFI_STRINGIFY(...) #__VA_ARGS__
    #define FFI_CONCAT(a, b)  a ## b
    #define FFI_CONCAT2(a, b) FFI_CONCAT(a, b)
    #define FFI_CONTENT FFI_CONCAT2(FFI_CONTENT_, FFI_CDEF)
    #define FFI_CONTENT_(...)         FFI_STRINGIFY(__VA_ARGS__)
    #define FFI_CONTENT_FFI_CDEF(...) __VA_ARGS__

    #endif /* !STRACE_FFI_H */

Does not need to be re-included each time FFI_CDEF gets
defined/undefined for FFI_CONTENT macro to work correctly.




More information about the Strace-devel mailing list