]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: enforce cpp indentation policy
authorJim Meyering <meyering@redhat.com>
Wed, 25 May 2011 10:31:15 +0000 (12:31 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 26 May 2011 20:10:46 +0000 (22:10 +0200)
* 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
gl/lib/randread.c
src/extent-scan.c

diff --git a/cfg.mk b/cfg.mk
index 1d0fba108223a7a8e97b668500129186529e28b5..af5542a050d68f24c05784fbc76c3497392aa79f 100644 (file)
--- 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)$$
index a2ce25540b16a37365b0c5cd4c13fdd85e256d75..b4979c726c860132ae7ba27a997e896752011e74 100644 (file)
@@ -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;                                               \
index 596e7f7913c5cca44a69421d26ebde556e8f5b71..48dd564e504aa74523ec1b3b64b43fa0846f7fd2 100644 (file)
@@ -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;