[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: preprocessor directive indentation
From: |
Bruno Haible |
Subject: |
Re: preprocessor directive indentation |
Date: |
Mon, 21 Feb 2011 01:15:58 +0100 |
User-agent: |
KMail/1.9.9 |
> misindented block at lib/argp-namefrob.h:98
> misindented block at lib/getopt_int.h:108
> misindented block at lib/progreloc.c:144
> misindented block at lib/progreloc.c:256
> misindented block at lib/regexec.c:3971
> misindented block at lib/vasnprintf.c:879
> misindented block at lib/vasnprintf.c:4568
> misindented block at tests/test-argmatch.c:29
> misindented block at tests/test-exclude.c:63
Here's a proposed patch for most of these issues.
2011-02-20 Bruno Haible <address@hidden>
Fix misindentation of preprocessor directives.
* lib/argp-namefrob.h: Reindent preprocessor directives.
* lib/getopt_int.h (struct _getopt_data): Likewise.
* lib/progreloc.c (maybe_executable, find_executable): Likewise.
* lib/vasnprintf.c (decode_long_double): Likewise.
* tests/test-argmatch.c: Insert blank lines, for clarity.
* tests/test-exclude.c: Likewise.
--- lib/argp-namefrob.h.orig Mon Feb 21 01:10:38 2011
+++ lib/argp-namefrob.h Mon Feb 21 01:07:16 2011
@@ -100,45 +100,45 @@
#endif
#if defined(HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
# define feof_unlocked(x) feof (x)
-# endif
+#endif
#if defined(HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
# define ferror_unlocked(x) ferror (x)
-# endif
+#endif
#if defined(HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
# define fflush_unlocked(x) fflush (x)
-# endif
+#endif
#if defined(HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
# define fgets_unlocked(x,y,z) fgets (x,y,z)
-# endif
+#endif
#if defined(HAVE_DECL_FPUTC_UNLOCKED) && !HAVE_DECL_FPUTC_UNLOCKED
# define fputc_unlocked(x,y) fputc (x,y)
-# endif
+#endif
#if defined(HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
# define fputs_unlocked(x,y) fputs (x,y)
-# endif
+#endif
#if defined(HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
# define fread_unlocked(w,x,y,z) fread (w,x,y,z)
-# endif
+#endif
#if defined(HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
-# endif
+#endif
#if defined(HAVE_DECL_GETC_UNLOCKED) && !HAVE_DECL_GETC_UNLOCKED
# define getc_unlocked(x) getc (x)
-# endif
+#endif
#if defined(HAVE_DECL_GETCHAR_UNLOCKED) && !HAVE_DECL_GETCHAR_UNLOCKED
# define getchar_unlocked() getchar ()
-# endif
+#endif
#if defined(HAVE_DECL_PUTC_UNLOCKED) && !HAVE_DECL_PUTC_UNLOCKED
# define putc_unlocked(x,y) putc (x,y)
-# endif
+#endif
#if defined(HAVE_DECL_PUTCHAR_UNLOCKED) && !HAVE_DECL_PUTCHAR_UNLOCKED
# define putchar_unlocked(x) putchar (x)
-# endif
+#endif
#endif /* !_LIBC */
#ifndef __set_errno
-#define __set_errno(e) (errno = (e))
+# define __set_errno(e) (errno = (e))
#endif
#if defined GNULIB_ARGP_DISABLE_DIRNAME
--- lib/getopt_int.h.orig Mon Feb 21 01:10:38 2011
+++ lib/getopt_int.h Mon Feb 21 01:08:25 2011
@@ -108,7 +108,7 @@
#if defined _LIBC && defined USE_NONOPTION_FLAGS
int __nonoption_flags_max_len;
int __nonoption_flags_len;
-# endif
+#endif
};
/* The initializer is necessary to set OPTIND and OPTERR to their
--- lib/progreloc.c.orig Mon Feb 21 01:10:38 2011
+++ lib/progreloc.c Mon Feb 21 01:03:28 2011
@@ -117,7 +117,7 @@
if (access (filename, X_OK) < 0)
return false;
-#ifdef __linux__
+# ifdef __linux__
if (executable_fd >= 0)
{
/* If we already have an executable_fd, check that filename points to
@@ -135,7 +135,7 @@
return false;
}
}
-#endif
+# endif
#endif
return true;
@@ -157,7 +157,7 @@
/* Shouldn't happen. */
return NULL;
{
-#if defined __CYGWIN__
+# if defined __CYGWIN__
/* cygwin-1.5.13 (2005-03-01) or newer would also allow a Linux-like
implementation: readlink of "/proc/self/exe". But using the
result of the Win32 system call is simpler and is consistent with the
@@ -176,12 +176,12 @@
return NULL;
/* Call canonicalize_file_name, because Cygwin supports symbolic links. */
return canonicalize_file_name (location_as_posix_path);
-#else
+# else
return xstrdup (location);
-#endif
+# endif
}
#else /* Unix && !Cygwin */
-#ifdef __linux__
+# ifdef __linux__
/* The executable is accessible as /proc/<pid>/exe. In newer Linux
versions, also as /proc/self/exe. Linux >= 2.1 provides a symlink
to the true pathname; older Linux versions give only device and ino,
@@ -205,8 +205,8 @@
executable_fd = open (buf, O_EXEC, 0);
}
}
-#endif
-#if HAVE_MACH_O_DYLD_H && HAVE__NSGETEXECUTABLEPATH
+# endif
+# if HAVE_MACH_O_DYLD_H && HAVE__NSGETEXECUTABLEPATH
/* On MacOS X 10.2 or newer, the function
int _NSGetExecutablePath (char *buf, uint32_t *bufsize);
can be used to retrieve the executable's full path. */
@@ -215,7 +215,7 @@
if (_NSGetExecutablePath (location, &length) == 0
&& location[0] == '/')
return canonicalize_file_name (location);
-#endif
+# endif
/* Guess the executable's full path. We assume the executable has been
called via execlp() or execvp() with properly set up argv[0]. The
login(1) convention to add a '-' prefix to argv[0] is not supported. */
@@ -256,10 +256,10 @@
/* We have a path item at p, of length p_len.
Now concatenate the path item and argv0. */
concat_name = (char *) xmalloc (p_len + strlen (argv0) + 2);
-#ifdef NO_XMALLOC
+# ifdef NO_XMALLOC
if (concat_name == NULL)
return NULL;
-#endif
+# endif
if (p_len == 0)
/* An empty PATH element designates the current directory.
*/
strcpy (concat_name, argv0);
--- lib/vasnprintf.c.orig Mon Feb 21 01:10:38 2011
+++ lib/vasnprintf.c Mon Feb 21 01:04:26 2011
@@ -935,11 +935,11 @@
abort ();
m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
}
-#if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
- precision. */
+# if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
+ precision. */
if (!(y == 0.0L))
abort ();
-#endif
+# endif
/* Normalise. */
while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
m.nlimbs--;
--- tests/test-argmatch.c.orig Mon Feb 21 01:10:38 2011
+++ tests/test-argmatch.c Mon Feb 21 01:06:22 2011
@@ -29,6 +29,7 @@
/* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
thus must link with a definition of that function. Provide it here. */
#ifdef ARGMATCH_DIE_DECL
+
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
# else
@@ -37,6 +38,7 @@
ARGMATCH_DIE_DECL _GL_ATTRIBUTE_NORETURN;
ARGMATCH_DIE_DECL { exit (1); }
+
#endif
enum backup_type
--- tests/test-exclude.c.orig Mon Feb 21 01:10:38 2011
+++ tests/test-exclude.c Mon Feb 21 01:06:05 2011
@@ -63,6 +63,7 @@
/* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and
thus must link with a definition of that function. Provide it here. */
#ifdef ARGMATCH_DIE_DECL
+
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
# else
@@ -71,6 +72,7 @@
ARGMATCH_DIE_DECL _GL_ATTRIBUTE_NORETURN;
ARGMATCH_DIE_DECL { exit (1); }
+
#endif
int
--
In memoriam Juliusz Bursche <http://en.wikipedia.org/wiki/Juliusz_Bursche>
- [PATCH] test-exclude.c: remove unmatched #endif, Jim Meyering, 2011/02/20
- Re: [PATCH] test-exclude.c: remove unmatched #endif, Bruno Haible, 2011/02/20
- Re: [PATCH] test-exclude.c: remove unmatched #endif, Jim Meyering, 2011/02/20
- Re: preprocessor directive indentation, cppi, Bruno Haible, 2011/02/20
- Re: preprocessor directive indentation, cppi, Bruce Korb, 2011/02/20
- Re: preprocessor directive indentation, cppi, Jim Meyering, 2011/02/21
- Re: preprocessor directive indentation,
Bruno Haible <=