bug-coreutils
[Top][All Lists]
Advanced

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

[PATCH] maint: use consistent cpp indentation in all .c files


From: Jim Meyering
Subject: [PATCH] maint: use consistent cpp indentation in all .c files
Date: Sun, 13 Sep 2009 23:15:36 +0200

Back in the days of the CVS repository, I had a hook that
would run cppi and reject any commit that introduced a
CPP indentation/nesting mismatch, i.e.,

This would be rejected,

#if FOO
#define BAR 1
#endif

This would pass:

#if FOO
# define BAR 1
#endif

Obviously not a big deal above, but if you have the
misfortune to deal with code ifdef'd to 8 or 9 levels
(I did) then this tool becomes absolutely essential.

Anyway, since the switch to git, it's been a while
since I checked coreutils' src/*.c, and so today I
found a couple of violations.  Here are fixes:

[for good measure, here's a new snapshot of cppi:
  http://meyering.net/cppi/cppi-ss.tar.xz
  http://meyering.net/cppi/cppi-1.13.138-5b05a.tar.xz
 or the old one:
  ftp://ftp.gnu.org/gnu/coreutils/cppi-1.12.tar.bz2 ]

>From 255a6a201eaaef016ca909332f82bd86ef7d42ca Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 13 Sep 2009 22:05:37 +0200
Subject: [PATCH] maint: use consistent cpp indentation in all .c files

* src/stty.c: Make cpp indentation reflect nesting.
* src/factor.c: Likewise.
---
 src/factor.c |    2 +-
 src/stty.c   |   16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/factor.c b/src/factor.c
index 59fe1f4..fc78356 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 #if HAVE_GMP
-#include <gmp.h>
+# include <gmp.h>
 #endif

 #include <assert.h>
diff --git a/src/stty.c b/src/stty.c
index b980e84..7b25b0b 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -279,18 +279,18 @@ static struct mode_info const mode_info[] =
   {"cr0", output, SANE_SET, CR0, CRDLY},
 #endif
 #ifdef TABDLY
-#ifdef TAB3
+# ifdef TAB3
   {"tab3", output, SANE_UNSET, TAB3, TABDLY},
-#endif
-#ifdef TAB2
+# endif
+# ifdef TAB2
   {"tab2", output, SANE_UNSET, TAB2, TABDLY},
-#endif
-#ifdef TAB1
+# endif
+# ifdef TAB1
   {"tab1", output, SANE_UNSET, TAB1, TABDLY},
-#endif
-#ifdef TAB0
+# endif
+# ifdef TAB0
   {"tab0", output, SANE_SET, TAB0, TABDLY},
-#endif
+# endif
 #else
 # ifdef OXTABS
   {"tab3", output, SANE_UNSET, OXTABS, 0},
--
1.6.5.rc1.160.gad50c




reply via email to

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