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

Dmitry V. Levin ldv at altlinux.org
Tue Jun 20 01:23:11 UTC 2017


On Mon, Jun 19, 2017 at 02:55:43AM +0300, Victor Krapivensky wrote:
> 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.

I don't mind some preprocessor magic as well as a prefix, but FFI_ prefix
looks quite specific, while different parts of strace could benefit from
uniformly named STRINGIFY/STRINGIFY2 and CONCAT/CONCAT2 macros.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170620/cb5ab869/attachment.bin>


More information about the Strace-devel mailing list