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
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