bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] maint: indent with spaces, not TABs, and add a rule to check thi


From: Jim Meyering
Subject: [PATCH] maint: indent with spaces, not TABs, and add a rule to check this
Date: Mon, 04 Jul 2011 13:16:17 +0200

With the change below, "make check" prints this:
(the cppi lines are legacy; only the m4/po.m4 warning is new)

    m4/po.m4
    *** indent with spaces, not TABs;
    make: *** [sc_prohibit_leading_TABs] Error 1
    make: *** Waiting for unfinished jobs....
    cppi: lib/stdio-read.c: line 107: not properly indented
    cppi: lib/stdio-read.c: line 120: not properly indented
    cppi: lib/stdio-read.c: line 127: not properly indented
    cppi: lib/stdio-read.c: line 134: not properly indented
    cppi: lib/stdio-read.c: line 142: not properly indented
    cppi: lib/stdio-write.c: line 154: not properly indented
    cppi: lib/stdio-write.c: line 168: not properly indented
    cppi: lib/stdio-write.c: line 175: not properly indented
    cppi: lib/stdio-write.c: line 182: not properly indented
    cppi: lib/stdio-write.c: line 190: not properly indented
    make: *** [sc_cpp_indent_check] Error 123

Bruno, I didn't change po.m4, since it's from gettext.
If you plan to fix it, I'll leave the failure for now.
Otherwise, let me know and I'll exempt that file, too.

Also, regarding the cpp indentation in stdio-read.c and stdio-write.c,
would you prefer to exempt those two files or to indent the offending
#undef directives?  This is the sort of change that would be required
to make those two files conform:

 int
 vfscanf (FILE *stream, const char *format, va_list args)
-#undef vfscanf
+# undef vfscanf
 {
   CALL_WITH_ERRNO_FIX (int, vfscanf (stream, format, args), ret == EOF)
 }



>From 6f24497a9eb838d89eb117c2b905454e217e3e48 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 4 Jul 2011 12:31:05 +0200
Subject: [PATCH] maint: indent with spaces, not TABs, and add a rule to check
 this

* tests/test-userspec.c: Indent with spaces, not TABs.
* tests/test-argp.c: Likewise.
* tests/test-c-stack2.sh: Likewise.
* tests/test-parse-duration.sh: Likewise
* m4/strtod.m4: Likewise.
* m4/alloca.m4: Likewise.
* m4/pselect.m4: Likewise.
* Makefile (sc_prohibit_leading_TABs): Prohibit leading TABs.
---
 ChangeLog                    |   12 ++++++++++++
 Makefile                     |   10 ++++++++++
 m4/alloca.m4                 |   26 +++++++++++++-------------
 m4/pselect.m4                |   18 +++++++++---------
 m4/strtod.m4                 |    2 +-
 tests/test-argp.c            |   10 +++++-----
 tests/test-c-stack2.sh       |   18 +++++++++---------
 tests/test-parse-duration.sh |   16 ++++++++--------
 tests/test-userspec.c        |   10 +++++-----
 9 files changed, 72 insertions(+), 50 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4939b80..88eca79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-07-04  Jim Meyering  <address@hidden>
+
+       maint: indent with spaces, not TABs, and add a rule to check this
+       * tests/test-userspec.c: Indent with spaces, not TABs.
+       * tests/test-argp.c: Likewise.
+       * tests/test-c-stack2.sh: Likewise.
+       * tests/test-parse-duration.sh: Likewise
+       * m4/strtod.m4: Likewise.
+       * m4/alloca.m4: Likewise.
+       * m4/pselect.m4: Likewise.
+       * Makefile (sc_prohibit_leading_TABs): Prohibit leading TABs.
+
 2011-07-03  Jim Meyering  <address@hidden>

        maint.mk: correct omissions in prohibit_argmatch_without_use check
diff --git a/Makefile b/Makefile
index 0da864c..c8f75bb 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,16 @@ sc_prefer_ac_check_funcs_once:
                   in modules/ 1>&2; exit 1; } || :                     \
        else :; fi

+sc_prohibit_leading_TABs:
+       if test -d .git; then                                           \
+         url=FIXME;                                                    \
+         git grep -l '^ *      ' lib m4 tests                          \
+            | grep -Ev '^lib/reg|Makefile|test-update-copyright'       \
+            | grep .                                                   \
+           && { printf '*** %s\n' 'indent with spaces, not TABs;'      \
+                1>&2; exit 1; } || :                                   \
+       else :; fi
+
 sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT:
        if test -d .git; then                                           \
          url=http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/22874; \
diff --git a/m4/alloca.m4 b/m4/alloca.m4
index 891fc8b..a8744a8 100644
--- a/m4/alloca.m4
+++ b/m4/alloca.m4
@@ -1,4 +1,4 @@
-# alloca.m4 serial 12
+# alloca.m4 serial 13
 dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -76,17 +76,17 @@ wenotbecray
 if test $ac_cv_os_cray = yes; then
   for ac_func in _getb67 GETB67 getb67; do
     AC_CHECK_FUNC($ac_func,
-                 [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
-                                     [Define to one of `_getb67', `GETB67',
-                                      `getb67' for Cray-2 and Cray-YMP
-                                      systems. This function is required for
-                                      `alloca.c' support on those systems.])
+                  [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
+                                      [Define to one of `_getb67', `GETB67',
+                                       `getb67' for Cray-2 and Cray-YMP
+                                       systems. This function is required for
+                                       `alloca.c' support on those systems.])
     break])
   done
 fi

 AC_CACHE_CHECK([stack direction for C alloca],
-              [ac_cv_c_stack_direction],
+               [ac_cv_c_stack_direction],
 [AC_RUN_IFELSE([AC_LANG_SOURCE(
 [AC_INCLUDES_DEFAULT
 int
@@ -105,16 +105,16 @@ main (int argc, char **argv)
 {
   return find_stack_direction (0, argc + !argv + 20) < 0;
 }])],
-              [ac_cv_c_stack_direction=1],
-              [ac_cv_c_stack_direction=-1],
-              [ac_cv_c_stack_direction=0])])
+               [ac_cv_c_stack_direction=1],
+               [ac_cv_c_stack_direction=-1],
+               [ac_cv_c_stack_direction=0])])
 AH_VERBATIM([STACK_DIRECTION],
 [/* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
    automatically deduced at runtime.
-       STACK_DIRECTION > 0 => grows toward higher addresses
-       STACK_DIRECTION < 0 => grows toward lower addresses
-       STACK_DIRECTION = 0 => direction of growth unknown */
+        STACK_DIRECTION > 0 => grows toward higher addresses
+        STACK_DIRECTION < 0 => grows toward lower addresses
+        STACK_DIRECTION = 0 => direction of growth unknown */
 @%:@undef STACK_DIRECTION])dnl
 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
 ])# _AC_LIBOBJ_ALLOCA
diff --git a/m4/pselect.m4 b/m4/pselect.m4
index 5a76a7b..da043d1 100644
--- a/m4/pselect.m4
+++ b/m4/pselect.m4
@@ -14,15 +14,15 @@ AC_DEFUN([gl_FUNC_PSELECT],
     AC_CACHE_CHECK([whether signature of pselect conforms to POSIX],
       gl_cv_sig_pselect,
       [AC_LINK_IFELSE(
-        [AC_LANG_PROGRAM(
-             [[#include <sys/select.h>
-               ]],
-             [[int (*p) (int, fd_set *, fd_set *, fd_set *restrict,
-                         struct timespec const *restrict,
-                         sigset_t const *restrict) = pselect;
-               return !p;]])],
-        [gl_cv_sig_pselect=yes],
-        [gl_cv_sig_pselect=no])])
+         [AC_LANG_PROGRAM(
+              [[#include <sys/select.h>
+                ]],
+              [[int (*p) (int, fd_set *, fd_set *, fd_set *restrict,
+                          struct timespec const *restrict,
+                          sigset_t const *restrict) = pselect;
+                return !p;]])],
+         [gl_cv_sig_pselect=yes],
+         [gl_cv_sig_pselect=no])])
   fi

   if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then
diff --git a/m4/strtod.m4 b/m4/strtod.m4
index bd97667..e83e898 100644
--- a/m4/strtod.m4
+++ b/m4/strtod.m4
@@ -101,7 +101,7 @@ numeric_equal (double x, double y)
         [gl_cv_func_strtod_works=yes],
         [gl_cv_func_strtod_works=no],
         [dnl The last known bugs in glibc strtod(), as of this writing,
-        dnl were fixed in version 2.8
+         dnl were fixed in version 2.8
          AC_EGREP_CPP([Lucky user],
            [
 #include <features.h>
diff --git a/tests/test-argp.c b/tests/test-argp.c
index f0b864d..8fab727 100644
--- a/tests/test-argp.c
+++ b/tests/test-argp.c
@@ -226,7 +226,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
     {
     case ARGP_KEY_INIT:
       for (i = 0; state->root_argp->children[i].argp; i++)
-       state->child_inputs[i] = args;
+        state->child_inputs[i] = args;
       break;

     case 't':
@@ -346,7 +346,7 @@ test6 (struct argp *argp)

 void
 test_optional (struct argp *argp, int argc, char **argv,
-              struct test_args *args, const char *val, const char *a)
+               struct test_args *args, const char *val, const char *a)
 {
   int index;
   if (argp_parse (argp, argc, argv, 0, &index, args))
@@ -357,7 +357,7 @@ test_optional (struct argp *argp, int argc, char **argv,
   if (!val)
     {
       if (args->optional)
-       fail ("option processed incorrectly");
+        fail ("option processed incorrectly");
     }
   else if (strcmp (args->optional, val))
     fail ("option processed incorrectly");
@@ -365,9 +365,9 @@ test_optional (struct argp *argp, int argc, char **argv,
   if (a)
     {
       if (index == argc)
-       fail ("expected command line argument not found");
+        fail ("expected command line argument not found");
       else if (strcmp (argv[index], a))
-       fail ("expected command line argument does not match");
+        fail ("expected command line argument does not match");
     }
 }

diff --git a/tests/test-c-stack2.sh b/tests/test-c-stack2.sh
index a80373d..0cd49c9 100755
--- a/tests/test-c-stack2.sh
+++ b/tests/test-c-stack2.sh
@@ -11,16 +11,16 @@ tmpfiles="t-c-stack2.tmp"

 case $? in
   77) if grep 'stack overflow' t-c-stack2.tmp >/dev/null ; then
-       if test -z "$LIBSIGSEGV"; then
-         echo 'cannot tell stack overflow from crash; consider installing 
libsigsegv' >&2
-         exit 77
-       else
-         echo 'cannot tell stack overflow from crash, in spite of libsigsegv' 
>&2
-         exit 1
-       fi
+        if test -z "$LIBSIGSEGV"; then
+          echo 'cannot tell stack overflow from crash; consider installing 
libsigsegv' >&2
+          exit 77
+        else
+          echo 'cannot tell stack overflow from crash, in spite of libsigsegv' 
>&2
+          exit 1
+        fi
       else
-       cat t-c-stack2.tmp >&2
-       exit 77
+        cat t-c-stack2.tmp >&2
+        exit 77
       fi
       ;;
   0) (exit 1); exit 1 ;;
diff --git a/tests/test-parse-duration.sh b/tests/test-parse-duration.sh
index 6aeb225..5398c3b 100755
--- a/tests/test-parse-duration.sh
+++ b/tests/test-parse-duration.sh
@@ -50,14 +50,14 @@ trap 'rm -rf "${tmp}"' EXIT
 tmpf="${tmp}/tests.txt"

 cat > "${tmpf}" <<- _EOF_
-       1 Y 2 M 3 W 4 d 5 h 6 m 7 s
-       P 00010225 T 05:06:07
-       P 1Y2M3W4D T 5H6M7S
-       1 Y 2 M 25 D 5:6:7
-       1 Y 2 M 25 d 5h 6:7
-       1 Y 2 M 25 d 5h 6m 7
-       P 1-2-25 T 5:6:7
-       _EOF_
+  1 Y 2 M 3 W 4 d 5 h 6 m 7 s
+  P 00010225 T 05:06:07
+  P 1Y2M3W4D T 5H6M7S
+  1 Y 2 M 25 D 5:6:7
+  1 Y 2 M 25 d 5h 6:7
+  1 Y 2 M 25 d 5h 6m 7
+  P 1-2-25 T 5:6:7
+  _EOF_

 exec 3< "${tmpf}"
 while read line <&3
diff --git a/tests/test-userspec.c b/tests/test-userspec.c
index 65f60da..dcb1b3e 100644
--- a/tests/test-userspec.c
+++ b/tests/test-userspec.c
@@ -144,7 +144,7 @@ main (void)
       char *user_name;
       char *group_name;
       char const *diag = parse_user_spec (T[i].in, &uid, &gid,
-                                         &user_name, &group_name);
+                                          &user_name, &group_name);
       free (user_name);
       free (group_name);
       if (!same_diag (diag, T[i].result))
@@ -161,8 +161,8 @@ main (void)
       if (uid != T[i].uid || gid != T[i].gid)
         {
           printf ("%s mismatch (-: expected uid,gid; +:actual)\n"
-                 "-%3lu,%3lu\n+%3lu,%3lu\n",
-                 T[i].in,
+                  "-%3lu,%3lu\n+%3lu,%3lu\n",
+                  T[i].in,
                   (unsigned long int) T[i].uid,
                   (unsigned long int) T[i].gid,
                   (unsigned long int) uid,
@@ -175,8 +175,8 @@ main (void)

         {
           printf ("%s diagnostic mismatch (-: expected uid,gid; +:actual)\n"
-                 "-%s\n+%s\n",
-                 T[i].in, T[i].result, diag);
+                  "-%s\n+%s\n",
+                  T[i].in, T[i].result, diag);
           fail = 1;
         }
     }
--
1.7.6.370.gfeac5



reply via email to

[Prev in Thread] Current Thread [Next in Thread]