Browse Source

Move FLAG_ macro from defs.h to macros.h

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.
Eugene Syromyatnikov 2 months ago
parent
commit
2ee949aeb2
2 changed files with 9 additions and 7 deletions
  1. 3
    7
      defs.h
  2. 6
    0
      macros.h

+ 3
- 7
defs.h View File

@@ -775,19 +775,15 @@ enum xlat_style_private_flag_bits {
775 775
 	PXF_DEFAULT_STR_BIT,
776 776
 };
777 777
 
778
-# define FLAG_(name_) name_ = 1 << name_##_BIT
779
-
780 778
 enum xlat_style_private_flags {
781 779
 	/* print_array */
782
-	FLAG_(PAF_PRINT_INDICES),
783
-	FLAG_(PAF_ARRAY_TRUNCATED),
780
+	FLAG(PAF_PRINT_INDICES),
781
+	FLAG(PAF_ARRAY_TRUNCATED),
784 782
 
785 783
 	/* print_xlat */
786
-	FLAG_(PXF_DEFAULT_STR),
784
+	FLAG(PXF_DEFAULT_STR),
787 785
 };
788 786
 
789
-# undef FLAG_
790
-
791 787
 /** Print a value in accordance with xlat formatting settings. */
792 788
 extern void print_xlat_ex(uint64_t val, const char *str, enum xlat_style style);
793 789
 # define print_xlat(val_) \

+ 6
- 0
macros.h View File

@@ -73,4 +73,10 @@ is_filled(const char *ptr, char fill, size_t size)
73 73
 # define IS_ARRAY_ZERO(arr_)	\
74 74
 	is_filled((const char *) (arr_), 0, sizeof(arr_) + MUST_BE_ARRAY(arr_))
75 75
 
76
+# ifndef BIT
77
+#  define BIT(x_) (1U << (x_))
78
+# endif
79
+
80
+# define FLAG(name_) name_ = BIT(name_##_BIT)
81
+
76 82
 #endif /* !STRACE_MACROS_H */

Loading…
Cancel
Save