Browse Source

Fix preprocessor indentation

Indent the C preprocessor directives to reflect their nesting
using the following script:

$ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do
	cppi < "$f" > "$f".cppi; mv "$f".cppi "$f"
done
Dmitry V. Levin 9 months ago
parent
commit
e84debd3c0
5 changed files with 36 additions and 36 deletions
  1. 5
    5
      linux/s390/rt_sigframe.h
  2. 10
    10
      list.h
  3. 6
    6
      macros.h
  4. 1
    1
      print_fields.h
  5. 14
    14
      tests/move_pages.c

+ 5
- 5
linux/s390/rt_sigframe.h View File

@@ -10,11 +10,11 @@
10 10
 
11 11
 # include <signal.h>
12 12
 
13
-#ifdef __s390x__
14
-# define SIGNAL_FRAMESIZE 160
15
-#else /* __s390__ */
16
-# define SIGNAL_FRAMESIZE 96
17
-#endif
13
+# ifdef __s390x__
14
+#  define SIGNAL_FRAMESIZE 160
15
+# else /* __s390__ */
16
+#  define SIGNAL_FRAMESIZE 96
17
+# endif
18 18
 
19 19
 typedef struct {
20 20
 	uint8_t		callee_used_stack[SIGNAL_FRAMESIZE];

+ 10
- 10
list.h View File

@@ -8,7 +8,7 @@
8 8
  */
9 9
 
10 10
 #ifndef STRACE_LIST_H
11
-#define STRACE_LIST_H
11
+# define STRACE_LIST_H
12 12
 
13 13
 /*
14 14
  * struct list_item and related macros and functions provide an interface
@@ -87,7 +87,7 @@
87 87
  *     https://lwn.net/Articles/336255/
88 88
  */
89 89
 
90
-#include "macros.h"
90
+# include "macros.h"
91 91
 
92 92
 struct list_item {
93 93
 	struct list_item *prev;
@@ -99,7 +99,7 @@ struct list_item {
99 99
  *
100 100
  * @param l_ List head variable name.
101 101
  */
102
-#define EMPTY_LIST(l_) struct list_item l_ = { &l_, &l_ }
102
+# define EMPTY_LIST(l_) struct list_item l_ = { &l_, &l_ }
103 103
 
104 104
 /** Initialise an empty list. */
105 105
 static inline void
@@ -130,7 +130,7 @@ list_is_empty(const struct list_item *l)
130 130
  * @param type  Type of the list's item.
131 131
  * @param field Name of the field that holds the respective struct list_item.
132 132
  */
133
-#define list_elem(var, type, field) containerof((var), type, field)
133
+# define list_elem(var, type, field) containerof((var), type, field)
134 134
 
135 135
 /**
136 136
  * Get the first element in a list.
@@ -139,7 +139,7 @@ list_is_empty(const struct list_item *l)
139 139
  * @param type  Type of the list's item.
140 140
  * @param field Name of the field that holds the respective struct list_item.
141 141
  */
142
-#define list_head(head, type, field) \
142
+# define list_head(head, type, field) \
143 143
 	(list_is_empty(head) ? NULL : list_elem((head)->next, type, field))
144 144
 /**
145 145
  * Get the last element in a list.
@@ -148,7 +148,7 @@ list_is_empty(const struct list_item *l)
148 148
  * @param type  Type of the list's item.
149 149
  * @param field Name of the field that holds the respective struct list_item.
150 150
  */
151
-#define list_tail(head, type, field) \
151
+# define list_tail(head, type, field) \
152 152
 	(list_is_empty(head) ? NULL : list_elem((head)->prev, type, field))
153 153
 
154 154
 /**
@@ -157,7 +157,7 @@ list_is_empty(const struct list_item *l)
157 157
  * @param var   Pointer to a list item.
158 158
  * @param field Name of the field that holds the respective struct list_item.
159 159
  */
160
-#define list_next(var, field) \
160
+# define list_next(var, field) \
161 161
 	list_elem((var)->field.next, typeof(*(var)), field)
162 162
 /**
163 163
  * Get the previous element in a list.
@@ -165,7 +165,7 @@ list_is_empty(const struct list_item *l)
165 165
  * @param var   Pointer to a list item.
166 166
  * @param field Name of the field that holds the respective struct list_item.
167 167
  */
168
-#define list_prev(var, field) \
168
+# define list_prev(var, field) \
169 169
 	list_elem((var)->field.prev, typeof(*(var)), field)
170 170
 
171 171
 /**
@@ -279,7 +279,7 @@ list_replace(struct list_item *old, struct list_item *new)
279 279
  * @param field_ Name of the field containing the respective struct list_item
280 280
  *               inside list items.
281 281
  */
282
-#define list_foreach(var_, head_, field_) \
282
+# define list_foreach(var_, head_, field_) \
283 283
 	for (var_ = list_elem((head_)->next, typeof(*var_), field_); \
284 284
 	    &(var_->field_) != (head_); var_ = list_next(var_, field_))
285 285
 
@@ -292,7 +292,7 @@ list_replace(struct list_item *old, struct list_item *new)
292 292
  *               inside list items.
293 293
  * @param _tmp   Temporary variable for storing pointer to the next item.
294 294
  */
295
-#define list_foreach_safe(var_, head_, field_, _tmp) \
295
+# define list_foreach_safe(var_, head_, field_, _tmp) \
296 296
 	for (var_ = list_elem((head_)->next, typeof(*var_), field_), \
297 297
 	    _tmp = list_elem((var_)->field_.next, typeof(*var_), field_); \
298 298
 	    &var_->field_ != head_; var_ = _tmp, _tmp = list_next(_tmp, field_))

+ 6
- 6
macros.h View File

@@ -41,12 +41,12 @@
41 41
 	(offsetof(type_, member_) + sizeof(((type_ *)0)->member_))
42 42
 # endif
43 43
 
44
-#ifndef cast_ptr
45
-# define cast_ptr(type_, var_)	\
44
+# ifndef cast_ptr
45
+#  define cast_ptr(type_, var_)	\
46 46
 	((type_) (uintptr_t) (const volatile void *) (var_))
47
-#endif
47
+# endif
48 48
 
49
-#ifndef containerof
49
+# ifndef containerof
50 50
 /**
51 51
  * Return a pointer to a structure that contains the provided variable.
52 52
  *
@@ -55,10 +55,10 @@
55 55
  * @param member_ Name of the member field.
56 56
  * @return  Pointer to the container structure.
57 57
  */
58
-# define containerof(ptr_, struct_, member_)	\
58
+#  define containerof(ptr_, struct_, member_)	\
59 59
 	cast_ptr(struct_ *,			\
60 60
 		 (const volatile char *) (ptr_) - offsetof(struct_, member_))
61
-#endif
61
+# endif
62 62
 
63 63
 static inline bool
64 64
 is_filled(const char *ptr, char fill, size_t size)

+ 1
- 1
print_fields.h View File

@@ -177,7 +177,7 @@
177 177
 		print_x25_addr(&(where_).field_);			\
178 178
 	} while (0)
179 179
 
180
-#define PRINT_FIELD_NET_PORT(prefix_, where_, field_)			\
180
+# define PRINT_FIELD_NET_PORT(prefix_, where_, field_)			\
181 181
 	do {								\
182 182
 		STRACE_PRINTF("%s%s=", (prefix_), #field_);		\
183 183
 									\

+ 14
- 14
tests/move_pages.c View File

@@ -106,16 +106,16 @@ print_status_array(const int *const status, const unsigned long count)
106 106
 		if (status[i] >= 0) {
107 107
 			printf("%d", status[i]);
108 108
 		} else {
109
-#if !XLAT_RAW
109
+# if !XLAT_RAW
110 110
 			errno = -status[i];
111
-#endif
112
-#if XLAT_RAW
111
+# endif
112
+# if XLAT_RAW
113 113
 			printf("%d", status[i]);
114
-#elif XLAT_VERBOSE
114
+# elif XLAT_VERBOSE
115 115
 			printf("%d /* -%s */", status[i], errno2name());
116
-#else
116
+# else
117 117
 			printf("-%s", errno2name());
118
-#endif
118
+# endif
119 119
 		}
120 120
 	}
121 121
 	printf("]");
@@ -141,13 +141,13 @@ print_stat_pages(const unsigned long pid, const unsigned long count,
141 141
 	} else {
142 142
 		print_status_array(status, count);
143 143
 	}
144
-#if XLAT_RAW
144
+# if XLAT_RAW
145 145
 	printf(", 0x2) = %s\n", errstr);
146
-#elif XLAT_VERBOSE
146
+# elif XLAT_VERBOSE
147 147
 	printf(", 0x2 /* MPOL_MF_MOVE */) = %s\n", errstr);
148
-#else /* XLAT_ABBREV */
148
+# else /* XLAT_ABBREV */
149 149
 	printf(", MPOL_MF_MOVE) = %s\n", errstr);
150
-#endif
150
+# endif
151 151
 }
152 152
 
153 153
 static void
@@ -173,13 +173,13 @@ print_move_pages(const unsigned long pid,
173 173
 		printf("%p", status);
174 174
 	else
175 175
 		printf("[]");
176
-#if XLAT_RAW
176
+# if XLAT_RAW
177 177
 	printf(", 0x4) = %s\n", errstr);
178
-#elif XLAT_VERBOSE
178
+# elif XLAT_VERBOSE
179 179
 	printf(", 0x4 /* MPOL_MF_MOVE_ALL */) = %s\n", errstr);
180
-#else /* XLAT_ABBREV */
180
+# else /* XLAT_ABBREV */
181 181
 	printf(", MPOL_MF_MOVE_ALL) = %s\n", errstr);
182
-#endif
182
+# endif
183 183
 }
184 184
 
185 185
 int

Loading…
Cancel
Save