[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] maint: enforce cpp indentation policy
From: |
Jim Meyering |
Subject: |
[PATCH] maint: enforce cpp indentation policy |
Date: |
Thu, 26 May 2011 18:07:33 +0200 |
FYI,
>From e96981dfadbf151340bd1c9d7c9de3aff163b875 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 25 May 2011 12:31:15 +0200
Subject: [PATCH] maint: enforce cpp indentation policy
* cfg.mk (sc_preprocessor_indentation): New test, from libvirt.
Exempt 3 files from new cppi test.
* gl/lib/randread.c: Adjust cpp indentation to comply.
* src/extent-scan.c (extent_need_sync): Likewise.
---
cfg.mk | 13 +++++++++++++
gl/lib/randread.c | 4 ++--
src/extent-scan.c | 4 ++--
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 1d0fba1..af5542a 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -326,6 +326,16 @@ sc_prohibit_strncmp:
{ echo '$(ME): use STREQ_LEN or STRPREFIX instead of str''ncmp' \
1>&2; exit 1; } || :
+# Enforce recommended preprocessor indentation style.
+sc_preprocessor_indentation:
+ @if cppi --version >/dev/null 2>&1; then \
+ $(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c \
+ || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
+ exit 1; }; \
+ else \
+ echo '$(ME): skipping test $@: cppi not installed' 1>&2; \
+ fi
+
# Override the default Cc: used in generating an announcement.
announcement_Cc_ = $(translation_project_), \
address@hidden, address@hidden
@@ -365,6 +375,9 @@ exclude_file_name_regexp--sc_prohibit_fail_0 = \
exclude_file_name_regexp--sc_prohibit_atoi_atof = ^lib/euidaccess-stat\.c$$
exclude_file_name_regexp--sc_prohibit_tab_based_indentation = \
^tests/pr/|(^gl/lib/reg.*\.c\.diff|Makefile(\.am)?|\.mk|^man/help2man)$$
+exclude_file_name_regexp--sc_preprocessor_indentation = \
+ ^(gl/lib/rand-isaac\.[ch]|gl/tests/test-rand-isaac\.c)$$
+
exclude_file_name_regexp--sc_prohibit_stat_st_blocks = \
^(src/system\.h|tests/du/2g)$$
diff --git a/gl/lib/randread.c b/gl/lib/randread.c
index a2ce255..b4979c7 100644
--- a/gl/lib/randread.c
+++ b/gl/lib/randread.c
@@ -64,7 +64,7 @@
#endif
#ifndef NAME_OF_NONCE_DEVICE
-#define NAME_OF_NONCE_DEVICE "/dev/urandom"
+# define NAME_OF_NONCE_DEVICE "/dev/urandom"
#endif
/* The maximum buffer size used for reads of random data. Using the
@@ -162,7 +162,7 @@ get_nonce (void *buffer, size_t bufsize, size_t bytes_bound)
/* If there's no nonce device, use a poor approximation
by getting the time of day, etc. */
-# define ISAAC_SEED(type, initialize_v) \
+#define ISAAC_SEED(type, initialize_v) \
if (seeded < bufsize) \
{ \
type v; \
diff --git a/src/extent-scan.c b/src/extent-scan.c
index 596e7f7..48dd564 100644
--- a/src/extent-scan.c
+++ b/src/extent-scan.c
@@ -50,7 +50,7 @@ extent_need_sync (void)
struct utsname name;
need_sync = 0; /* No workaround by default. */
-#ifdef __linux__
+# ifdef __linux__
if (uname (&name) != -1 && STRNCMP_LIT (name.release, "2.6.") == 0)
{
unsigned long val;
@@ -60,7 +60,7 @@ extent_need_sync (void)
need_sync = 1;
}
}
-#endif
+# endif
}
return need_sync;
--
1.7.5.2.660.g9f46c
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] maint: enforce cpp indentation policy,
Jim Meyering <=