]> granicus.if.org Git - strace/commitdiff
Move FLAG_ macro from defs.h to macros.h
authorEugene Syromyatnikov <evgsyr@gmail.com>
Thu, 22 Aug 2019 14:06:41 +0000 (16:06 +0200)
committerEugene Syromyatnikov <evgsyr@gmail.com>
Fri, 4 Oct 2019 13:16:33 +0000 (15:16 +0200)
Rename it to FLAG and implement via newly added BIT helper macro,
in preparation for general use

* defs.h: Use FLAG instead of FLAG_.
(FLAG_): Move it...
* macros.h (FLAG): Here, implement using BIT macro.
[!BIT] (BIT): New macro.

defs.h
macros.h

diff --git a/defs.h b/defs.h
index 06bf1248bb3ae9d2461a35c8ba1cf0a322bbcb92..5be982ac90a93f81604e164de53fff1cbb8b5189 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -775,19 +775,15 @@ enum xlat_style_private_flag_bits {
        PXF_DEFAULT_STR_BIT,
 };
 
-# define FLAG_(name_) name_ = 1 << name_##_BIT
-
 enum xlat_style_private_flags {
        /* print_array */
-       FLAG_(PAF_PRINT_INDICES),
-       FLAG_(PAF_ARRAY_TRUNCATED),
+       FLAG(PAF_PRINT_INDICES),
+       FLAG(PAF_ARRAY_TRUNCATED),
 
        /* print_xlat */
-       FLAG_(PXF_DEFAULT_STR),
+       FLAG(PXF_DEFAULT_STR),
 };
 
-# undef FLAG_
-
 /** Print a value in accordance with xlat formatting settings. */
 extern void print_xlat_ex(uint64_t val, const char *str, enum xlat_style style);
 # define print_xlat(val_) \
index f3ebdaf41bb6f1b60b8dec5e393fd6f2d2f0feea..1a25014046f11df80e8d281779b97394562c60b2 100644 (file)
--- a/macros.h
+++ b/macros.h
@@ -73,4 +73,10 @@ is_filled(const char *ptr, char fill, size_t size)
 # define IS_ARRAY_ZERO(arr_)   \
        is_filled((const char *) (arr_), 0, sizeof(arr_) + MUST_BE_ARRAY(arr_))
 
+# ifndef BIT
+#  define BIT(x_) (1U << (x_))
+# endif
+
+# define FLAG(name_) name_ = BIT(name_##_BIT)
+
 #endif /* !STRACE_MACROS_H */