summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-05-25 12:31:15 +0200
committerJim Meyering <meyering@redhat.com>2011-05-26 22:10:46 +0200
commitd7e23652039b5e145ab0d809a7de75ebb3facc24 (patch)
tree1dd1b54432ce6e955a0a05940b75a6dacca88fb8
parent3f98fe3155b8f19431411370198102f30f00b45e (diff)
downloadcoreutils-d7e23652039b5e145ab0d809a7de75ebb3facc24.tar.xz
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.
-rw-r--r--cfg.mk13
-rw-r--r--gl/lib/randread.c4
-rw-r--r--src/extent-scan.c4
3 files changed, 17 insertions, 4 deletions
diff --git a/cfg.mk b/cfg.mk
index 1d0fba108..af5542a05 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_), \
coreutils@gnu.org, coreutils-announce@gnu.org
@@ -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 a2ce25540..b4979c726 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 596e7f791..48dd564e5 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;