bug-gnulib
[Top][All Lists]
Advanced

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

Re: Fwd: sed porting trouble


From: Paul Eggert
Subject: Re: Fwd: sed porting trouble
Date: Sun, 03 Oct 2010 10:30:24 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8

On 10/02/2010 03:33 AM, Bruno Haible wrote:

> I vehemently disagree, for five reasons:

OK, let's look at those reasons.  But first, please bear in mind that
the sentiment seems to be in the other direction.  In my case this is
not just because the software engineering mechanism is simpler; it's
primarily because code with long lines is harder to read.

Most people who edit GNU code use 80-column windows, in which longer
lines are considerably harder to read.  One could argue that 80 is too
low (or too high) for optimum code readability; I'm not aware of any
peer-reviewed research on this point.  However, 80 is the longstanding
standard and it would be a great deal of trouble to change it now.

> 1) This handling of NonStop's misfeature would put us back to the 1960ies
>    where Fortran was invented with column-dependent syntax.

I entirely agree that the NonStop pragma is a horrible misfeature.
However, this shouldn't affect the analysis.  We can work around the
problem using several different strategies, and we should use the
strategy that best solves the problem, not the strategy that best
demonstrates our distaste for the misfeature.

> 2) Reliability. Your patch "fixes" 24 places. But how long will it take for
>    another commit to reintroduce a line longer than 80 columns?

Good point, thanks.  The revised patch, proposed below, addresses this
by adding a syntax check for the problem.  (A syntax check of some
sort should be added no matter what solution we adopt.)

> while many files have less than 80 columns, there is also a
> tendency to use more columns occasionally.

Yes, but these occasions are rare, because overly long lines are hard
to read.  It's not much trouble to fix these few instances.

> Even in the ChangeLog file,

We don't need to go through all the files, just the files that
run afoul of this problem.

> 3) A limit on the line length invariably creates a pressure to use short
>    identifiers - a bad habit which we have finally nearly eliminated from our
>    minds.

That pressure is created only when using indenting styles in which
identifier line length significantly contributes to the indenting.
When these styles are overused, they create lines that are too long
and therefore too hard to read.  The solution is to use different
indenting styles, where this does not occur.  For example, instead of
this indenting style:

  static foo bar (int a, int b)
  {
    return baz (a + b + 1);
  }

one should use a style like this when "foo" is a long identifier:

  static foo
  bar (int a, int b)
  {
     return baz (a + b + 1);
  }

There's nothing unusual about this: it's standard practice in GNU
software.  Similar reindenting can occur when any of the identifiers
in this example are long.

Second, there is independent pressure to limit the line length of
identifiers.  Nobody would seriously use an identifier like
getsockname_that_works_around_Microsoft_bug_5917212_on_Windows_Vista_SP_1
in ordinary code, regardless of source code line length.  The question
of whether an identifier is "too long" is a judgment call, of course,
but in my experience, once an identifier becomes so long that one
cannot reasonably indent code, then it's almost invariably too long
for other reasons as well.

>    The results of following an 80-columns limit does not produce readable code
>    either. These snippets are taken from glibc's header files.

That is not a problem that we need to address here, as that glibc code
doesn't go past 80 characters.  However, since you bring the point up,
we can easily use a different style for our own code, should the
problem come up.  For example:

  extern int posix_spawnattr_setschedparam
    (
      posix_spawnattr_t *restrict attr,
      struct sched_param const *restrict schedparam
    ) __THROW;

Other styles are of course possible and I won't insist on this one.

> Or this one, that your proposed patch would introduce:
> 
> _GL_CXXALIAS_SYS_CAST2 (strcasestr,
>                         char *, (const char *haystack, const char *needle),
>                         const char *, (const char *haystack,
>                                        const char *needle));

If you don't like that style, there are others that also fit:

 _GL_CXXALIAS_SYS_CAST2
   (strcasestr,
    char *, (const char *haystack, const char *needle),
    const char *, (const char *haystack, const char *needle));

I don't insist on this particular style either; whatever works to get
the lines under 80 columns and make them readable.

> 5) There are cases where you can't even reasonably insert a line break at all.
>    Namely when you have an URL longer than 80 characters.

I'm not a big fan of those particular URLs, as they make the code hard
to read and they're not important enough to be directly in the code
(they could be in a ChangeLog entry, or in some other auxiliary
document).  However, if they are to be in the code, they can easily be
shortened, which I do in my patch proposed below.


On 10/03/2010 02:52 AM, Bruno Haible wrote:
 
> OK, then - as pointed out by Karl Berry - the idiom can be simplified from
> 
>   #ifdef __TANDEM
>   @PRAGMA_COLUMNS@
>   #endif
> 
> to
> 
>   @PRAGMA_COLUMNS@

No, it can be simplified even further, to nothing at all.  The sed
script can break apart lines that contain more than 80 characters,
inserting backslash-newlines between the fragments.  I don't favor
doing this, though: it is one more thing to maintain, it makes the
output files less readable, and the gnulib machinery is already too
complicated.  It's simpler to just reindent the affected files.


Here's a proposed patch that takes the above comments into account.

-----

Avoid lines longer than 80 chars in replacements for system includes.

* build-aux/warn-on-use.h (_GL_WARN_UNPORTABLE): New macro.
* lib/spawn.in.h: Use it.
* lib/alignof.h (alignof_slot): Use shorter parameter names.
* lib/dirent.in.h, lib/inttypes.in.h, lib/math.in.h, lib/spawn.in.h:
* lib/stdint.in.h, lib/stdio-impl.h, lib/stdio.in.h, lib/stdlib.in.h:
* lib/string.in.h, lib/sys_select.in.h, lib/sys_socket.in.h:
* lib/sys_stat.in.h, lib/unistd.in.h, lib/wchar.in.h:
Reindent to avoid lines longer than 80 characters.
* lib/math.in.h (_GL_UINT_WORDS): New macro, for readability.
(gl_signbitf, gl_signbitd, gl_signbitl): Use it.
* lib/stdint.in.h (_verify_intmax_size): Use more-readable
(X ? 1 : -1) rather than ((2 * X) - 1).
* lib/stdio-impl.h, lib/sys_socket.in.h: Use shorter URLs.
* top/maint.mk (check_long_lines): New macro.
(sc_long_lines, long_lines_in_system_files):
(long_inlines_in_included_files): New rules.
diff --git a/build-aux/warn-on-use.h b/build-aux/warn-on-use.h
index d418ad6..fccd5e1 100644
--- a/build-aux/warn-on-use.h
+++ b/build-aux/warn-on-use.h
@@ -77,6 +77,11 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use
 # endif
 #endif

+#define _GL_WARN_UNPORTABLE(name)                                       \
+  _GL_WARN_ON_USE (name,                                                \
+                   (#name " is unportable - "                           \
+                    "use gnulib module " #name " for portability"))
+
 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
    is like _GL_WARN_ON_USE (function, "string"), except that the function is
    declared with the given prototype, consisting of return type, parameters,
diff --git a/lib/alignof.h b/lib/alignof.h
index 953badc..9739e65 100644
--- a/lib/alignof.h
+++ b/lib/alignof.h
@@ -25,10 +25,10 @@
    Note: The result cannot be used as a value for an 'enum' constant,
    due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc.  */
 #if defined __cplusplus
-  template <class type> struct alignof_helper { char __slot1; type __slot2; };
-# define alignof_slot(type) offsetof (alignof_helper<type>, __slot2)
+  template <class type> struct alignof_helper { char __x; type __y; };
+# define alignof_slot(type) offsetof (alignof_helper<type>, __y)
 #else
-# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, 
__slot2)
+# define alignof_slot(type) offsetof (struct { char __x; type __y; }, __y)
 #endif

 /* Determine the good alignment of a object of the given type at compile time.
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index afcad9c..f3769b6 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -133,10 +133,11 @@ _GL_FUNCDECL_SYS (scandir, int,
 # endif
 /* Need to cast, because on glibc systems, the fourth parameter is
                         int (*cmp) (const void *, const void *).  */
-_GL_CXXALIAS_SYS_CAST (scandir, int,
-                       (const char *dir, struct dirent ***namelist,
-                        int (*filter) (const struct dirent *),
-                        int (*cmp) (const struct dirent **, const struct 
dirent **)));
+_GL_CXXALIAS_SYS_CAST
+(scandir, int,
+ (const char *dir, struct dirent ***namelist,
+  int (*filter) (const struct dirent *),
+  int (*cmp) (const struct dirent **, const struct dirent **)));
 _GL_CXXALIASWARN (scandir);
 #elif defined GNULIB_POSIXCHECK
 # undef scandir
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index aef157d..2e03a27 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -46,7 +46,8 @@
 #include <limits.h>

 #if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
-# error "This file assumes that 'int' has exactly 32 bits. Please report your 
platform and compiler to <address@hidden>."
+# error "This file assumes that 'int' has exactly 32 bits." \
+        "Please report your platform and compiler to <address@hidden>."
 #endif

 /* The definition of _GL_ARG_NONNULL is copied here.  */
diff --git a/lib/math.in.h b/lib/math.in.h
index fbc2918..8ac1f4a 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -609,7 +609,7 @@ _GL_EXTERN_C int isnanf (float x);
    This function is a gnulib extension, unlike isnan() which applied only
    to 'double' numbers earlier but now is a type-generic macro.  */
 # if @HAVE_ISNAND@
-/* The original <math.h> included above provides a declaration of isnan macro. 
 */
+/* The <math.h> included above provides a declaration of the isnan macro.  */
 #  if __GNUC__ >= 4
     /* GCC 4.0 and newer provides three built-ins for isnan.  */
 #   undef isnand
@@ -629,7 +629,8 @@ _GL_EXTERN_C int isnand (double x);
 #if @GNULIB_ISNANL@
 /* Test for NaN for 'long double' numbers.  */
 # if @HAVE_ISNANL@
-/* The original <math.h> included above provides a declaration of isnan macro 
or (older) isnanl function.  */
+/* The <math.h> included above provides a declaration of the isnan macro
+   or (older) isnanl function.  */
 #  if __GNUC__ >= 4
     /* GCC 4.0 and newer provides three built-ins for isnan.  */
 #   undef isnanl
@@ -701,34 +702,39 @@ _GL_EXTERN_C int gl_signbitf (float arg);
 _GL_EXTERN_C int gl_signbitd (double arg);
 _GL_EXTERN_C int gl_signbitl (long double arg);
 #  if __GNUC__ >= 2 && !__STRICT_ANSI__
-#   if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined 
gl_signbitf
+#   if (defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT     \
+        && !defined gl_signbitf)
 #    define gl_signbitf_OPTIMIZED_MACRO
+#    define _GL_UINT_WORDS(type) \
+       ((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
 #    define gl_signbitf(arg) \
        ({ union { float _value;                                         \
-                  unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 
1) / sizeof (unsigned int)]; \
+                  unsigned int _word[_GL_UINT_WORDS (float)];           \
                 } _m;                                                   \
           _m._value = (arg);                                            \
           (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1;          \
         })
 #   endif
-#   if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined 
gl_signbitd
+#   if (defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT     \
+        && !defined gl_signbitd)
 #    define gl_signbitd_OPTIMIZED_MACRO
 #    define gl_signbitd(arg) \
-       ({ union { double _value;                                               
 \
-                  unsigned int _word[(sizeof (double) + sizeof (unsigned int) 
- 1) / sizeof (unsigned int)]; \
+       ({ union { double _value;                                        \
+                  unsigned int _word[_GL_UINT_WORDS (double)];          \
                 } _m;                                                   \
           _m._value = (arg);                                            \
           (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1;          \
         })
 #   endif
-#   if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined 
gl_signbitl
+#   if defined (LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT   \
+                && !defined gl_signbitl)
 #    define gl_signbitl_OPTIMIZED_MACRO
 #    define gl_signbitl(arg) \
        ({ union { long double _value;                                   \
-                  unsigned int _word[(sizeof (long double) + sizeof (unsigned 
int) - 1) / sizeof (unsigned int)]; \
+                  unsigned int _word[_GL_UINT_WORDS (long double)];     \
                 } _m;                                                   \
           _m._value = (arg);                                            \
-          (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1;               
 \
+          (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1;        \
         })
 #   endif
 #  endif
diff --git a/lib/spawn.in.h b/lib/spawn.in.h
index cc8d9a9..4155fd6 100644
--- a/lib/spawn.in.h
+++ b/lib/spawn.in.h
@@ -200,8 +200,7 @@ _GL_CXXALIASWARN (posix_spawn);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn
 # if HAVE_RAW_DECL_POSIX_SPAWN
-_GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
-                 "use gnulib module posix_spawn for portability");
+_GL_WARN_UNPORTABLE (posix_spawn);
 # endif
 #endif

@@ -244,8 +243,7 @@ _GL_CXXALIASWARN (posix_spawnp);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnp
 # if HAVE_RAW_DECL_POSIX_SPAWNP
-_GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
-                 "use gnulib module posix_spawnp for portability");
+_GL_WARN_UNPORTABLE (posix_spawnp);
 # endif
 #endif

@@ -270,8 +268,7 @@ _GL_CXXALIASWARN (posix_spawnattr_init);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_init
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
-_GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
-                 "use gnulib module posix_spawnattr_init for portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_init);
 # endif
 #endif

@@ -295,8 +292,7 @@ _GL_CXXALIASWARN (posix_spawnattr_destroy);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_destroy
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
-_GL_WARN_ON_USE (posix_spawnattr_destroy, "posix_spawnattr_destroy is 
unportable - "
-                 "use gnulib module posix_spawnattr_destroy for portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_destroy);
 # endif
 #endif

@@ -329,8 +325,7 @@ _GL_CXXALIASWARN (posix_spawnattr_getsigdefault);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getsigdefault
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
-_GL_WARN_ON_USE (posix_spawnattr_getsigdefault, "posix_spawnattr_getsigdefault 
is unportable - "
-                 "use gnulib module posix_spawnattr_getsigdefault for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_getsigdefault);
 # endif
 #endif

@@ -362,8 +357,7 @@ _GL_CXXALIASWARN (posix_spawnattr_setsigdefault);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setsigdefault
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
-_GL_WARN_ON_USE (posix_spawnattr_setsigdefault, "posix_spawnattr_setsigdefault 
is unportable - "
-                 "use gnulib module posix_spawnattr_setsigdefault for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_setsigdefault);
 # endif
 #endif

@@ -395,8 +389,7 @@ _GL_CXXALIASWARN (posix_spawnattr_getsigmask);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getsigmask
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
-_GL_WARN_ON_USE (posix_spawnattr_getsigmask, "posix_spawnattr_getsigmask is 
unportable - "
-                 "use gnulib module posix_spawnattr_getsigmask for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_getsigmask);
 # endif
 #endif

@@ -428,8 +421,7 @@ _GL_CXXALIASWARN (posix_spawnattr_setsigmask);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setsigmask
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
-_GL_WARN_ON_USE (posix_spawnattr_setsigmask, "posix_spawnattr_setsigmask is 
unportable - "
-                 "use gnulib module posix_spawnattr_setsigmask for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_setsigmask);
 # endif
 #endif

@@ -461,8 +453,7 @@ _GL_CXXALIASWARN (posix_spawnattr_getflags);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getflags
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
-_GL_WARN_ON_USE (posix_spawnattr_getflags, "posix_spawnattr_getflags is 
unportable - "
-                 "use gnulib module posix_spawnattr_getflags for portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_getflags);
 # endif
 #endif

@@ -490,8 +481,7 @@ _GL_CXXALIASWARN (posix_spawnattr_setflags);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setflags
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
-_GL_WARN_ON_USE (posix_spawnattr_setflags, "posix_spawnattr_setflags is 
unportable - "
-                 "use gnulib module posix_spawnattr_setflags for portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_setflags);
 # endif
 #endif

@@ -523,8 +513,7 @@ _GL_CXXALIASWARN (posix_spawnattr_getpgroup);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getpgroup
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
-_GL_WARN_ON_USE (posix_spawnattr_getpgroup, "posix_spawnattr_getpgroup is 
unportable - "
-                 "use gnulib module posix_spawnattr_getpgroup for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_getpgroup);
 # endif
 #endif

@@ -552,8 +541,7 @@ _GL_CXXALIASWARN (posix_spawnattr_setpgroup);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setpgroup
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
-_GL_WARN_ON_USE (posix_spawnattr_setpgroup, "posix_spawnattr_setpgroup is 
unportable - "
-                 "use gnulib module posix_spawnattr_setpgroup for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_setpgroup);
 # endif
 #endif

@@ -585,8 +573,7 @@ _GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getschedpolicy
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
-_GL_WARN_ON_USE (posix_spawnattr_getschedpolicy, 
"posix_spawnattr_getschedpolicy is unportable - "
-                 "use gnulib module posix_spawnattr_getschedpolicy for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_getschedpolicy);
 # endif
 #endif

@@ -614,8 +601,7 @@ _GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setschedpolicy
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
-_GL_WARN_ON_USE (posix_spawnattr_setschedpolicy, 
"posix_spawnattr_setschedpolicy is unportable - "
-                 "use gnulib module posix_spawnattr_setschedpolicy for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_setschedpolicy);
 # endif
 #endif

@@ -647,8 +633,7 @@ _GL_CXXALIASWARN (posix_spawnattr_getschedparam);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_getschedparam
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
-_GL_WARN_ON_USE (posix_spawnattr_getschedparam, "posix_spawnattr_getschedparam 
is unportable - "
-                 "use gnulib module posix_spawnattr_getschedparam for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_getschedparam);
 # endif
 #endif

@@ -680,8 +665,7 @@ _GL_CXXALIASWARN (posix_spawnattr_setschedparam);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawnattr_setschedparam
 # if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
-_GL_WARN_ON_USE (posix_spawnattr_setschedparam, "posix_spawnattr_setschedparam 
is unportable - "
-                 "use gnulib module posix_spawnattr_setschedparam for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawnattr_setschedparam);
 # endif
 #endif

@@ -710,8 +694,7 @@ _GL_CXXALIASWARN (posix_spawn_file_actions_init);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_init
 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
-_GL_WARN_ON_USE (posix_spawn_file_actions_init, "posix_spawn_file_actions_init 
is unportable - "
-                 "use gnulib module posix_spawn_file_actions_init for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawn_file_actions_init);
 # endif
 #endif

@@ -739,8 +722,7 @@ _GL_CXXALIASWARN (posix_spawn_file_actions_destroy);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_destroy
 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
-_GL_WARN_ON_USE (posix_spawn_file_actions_destroy, 
"posix_spawn_file_actions_destroy is unportable - "
-                 "use gnulib module posix_spawn_file_actions_destroy for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawn_file_actions_destroy);
 # endif
 #endif

@@ -777,8 +759,7 @@ _GL_CXXALIASWARN (posix_spawn_file_actions_addopen);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_addopen
 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
-_GL_WARN_ON_USE (posix_spawn_file_actions_addopen, 
"posix_spawn_file_actions_addopen is unportable - "
-                 "use gnulib module posix_spawn_file_actions_addopen for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawn_file_actions_addopen);
 # endif
 #endif

@@ -787,7 +768,8 @@ _GL_WARN_ON_USE (posix_spawn_file_actions_addopen, 
"posix_spawn_file_actions_add
    `close' for the given file descriptor during the `spawn' call.  */
 # if @REPLACE_POSIX_SPAWN@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define posix_spawn_file_actions_addclose 
rpl_posix_spawn_file_actions_addclose
+#   define posix_spawn_file_actions_addclose \
+       rpl_posix_spawn_file_actions_addclose
 #  endif
 _GL_FUNCDECL_RPL (posix_spawn_file_actions_addclose, int,
                   (posix_spawn_file_actions_t *__file_actions, int __fd)
@@ -807,8 +789,7 @@ _GL_CXXALIASWARN (posix_spawn_file_actions_addclose);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_addclose
 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
-_GL_WARN_ON_USE (posix_spawn_file_actions_addclose, 
"posix_spawn_file_actions_addclose is unportable - "
-                 "use gnulib module posix_spawn_file_actions_addclose for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawn_file_actions_addclose);
 # endif
 #endif

@@ -841,8 +822,7 @@ _GL_CXXALIASWARN (posix_spawn_file_actions_adddup2);
 #elif defined GNULIB_POSIXCHECK
 # undef posix_spawn_file_actions_adddup2
 # if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
-_GL_WARN_ON_USE (posix_spawn_file_actions_adddup2, 
"posix_spawn_file_actions_adddup2 is unportable - "
-                 "use gnulib module posix_spawn_file_actions_adddup2 for 
portability");
+_GL_WARN_UNPORTABLE (posix_spawn_file_actions_adddup2);
 # endif
 #endif

diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index a861c07..99864af 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -278,7 +278,8 @@ typedef unsigned long int gl_uintmax_t;
 /* Verify that intmax_t and uintmax_t have the same size.  Too much code
    breaks if this is not the case.  If this check fails, the reason is likely
    to be found in the autoconf macros.  */
-typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) 
- 1];
+typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
+                                ? 1 : -1];

 /* 7.18.2. Limits of specified-width integer types */

@@ -475,9 +476,10 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == 
sizeof (uintmax_t)) -

 /* wchar_t limits */
 /* Get WCHAR_MIN, WCHAR_MAX.
-   This include is not on the top, above, because on OSF/1 4.0 we have a 
sequence of nested
-   includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter 
includes
-   <stdint.h> and assumes its types are already defined.  */
+   This include is not on the top, above, because on OSF/1 4.0 we have
+   a sequence of nested includes <wchar.h> -> <stdio.h> -> <getopt.h>
+   -> <stdlib.h>, and the latter includes <stdint.h> and assumes its
+   types are already defined.  */
 #if ! (defined WCHAR_MIN && defined WCHAR_MAX)
 # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
 # include <wchar.h>
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 0e67f66..f6014c2 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -26,10 +26,11 @@
 # include <sys/param.h>
 #endif

-#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, 
DragonFly, MacOS X, Cygwin */
+    /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+#if defined __sferror || defined __DragonFly__

 # if defined __DragonFly__          /* DragonFly */
-  /* See 
<http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>.
  */
+  /* See <http://tinyurl.com/2clcyb6>.  */
 #  define fp_ ((struct { struct __FILE_public pub; \
                          struct { unsigned char *_base; int _size; } _bf; \
                          void *cookie; \
@@ -46,7 +47,7 @@
                          fpos_t _offset; \
                          /* More fields, not relevant here.  */ \
                        } *) fp)
-  /* See 
<http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>.
  */
+  /* See <http://tinyurl.com/24lancp>.  */
 #  define _p pub._p
 #  define _flags pub._flags
 #  define _r pub._r
@@ -55,16 +56,17 @@
 #  define fp_ fp
 # endif

-# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined 
__OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */
-  /* See 
<http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
-     and 
<http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
 */
+# if ((defined __NetBSD__ && __NetBSD_Version__ >= 105270000)   \
+      || defined __OpenBSD__) /* NetBSD >= 1.5ZA, OpenBSD */
+  /* See <http://tinyurl.com/2e7c2n5> and
+     <http://tinyurl.com/29pc6vc>. */
   struct __sfileext
     {
       struct  __sbuf _ub; /* ungetc buffer */
       /* More fields, not relevant here.  */
     };
 #  define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
-# else                                         /* FreeBSD, NetBSD <= 1.5Z, 
DragonFly, MacOS X, Cygwin */
+# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, MacOS X, Cygwin */
 #  define fp_ub fp_->_ub
 # endif

diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 135b084..c06a518 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -164,8 +164,9 @@ _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not 
POSIX compatible - "
 #endif

 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
-# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
-     || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@)
+# if ((@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@)             \
+      || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@       \
+          && @GNULIB_STDIO_H_SIGPIPE@))
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   define fprintf rpl_fprintf
 #  endif
@@ -265,7 +266,8 @@ _GL_CXXALIASWARN (freopen);
 #elif defined GNULIB_POSIXCHECK
 # undef freopen
 /* Assume freopen is always declared.  */
-_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible 
- "
+_GL_WARN_ON_USE (freopen,
+                 "freopen on Win32 platforms is not POSIX compatible - "
                  "use gnulib module freopen for portability");
 #endif

@@ -642,8 +644,9 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - 
"
 #endif

 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
-# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
-     || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@)
+# if ((@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@)               \
+      || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ &&     \
+          @GNULIB_STDIO_H_SIGPIPE@))
 #  if defined __GNUC__
 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 /* Don't break __attribute__((format(printf,M,N))).  */
@@ -950,8 +953,9 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
 #endif

 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
-# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
-     || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@)
+# if ((@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@)           \
+      || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@      \
+          && @GNULIB_STDIO_H_SIGPIPE@))
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   define vfprintf rpl_vfprintf
 #  endif
@@ -980,8 +984,9 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX 
compliant - "
 #endif

 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
-# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
-     || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@)
+# if ((@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@)       \
+      || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ \
+          && @GNULIB_STDIO_H_SIGPIPE@))
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   define vprintf rpl_vprintf
 #  endif
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index de13bf7..0588672 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -72,7 +72,9 @@ struct random_data
 };
 #endif

-#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! 
defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined 
__CYGWIN__)
+#if ((@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) \
+     && ! defined __GLIBC__                                                \
+     && ! ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
 /* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
 /* But avoid namespace pollution on glibc systems and native Windows.  */
@@ -177,7 +179,8 @@ _GL_CXXALIASWARN (canonicalize_file_name);
 #elif defined GNULIB_POSIXCHECK
 # undef canonicalize_file_name
 # if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
-_GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable 
- "
+_GL_WARN_ON_USE (canonicalize_file_name,
+                 "canonicalize_file_name is unportable - "
                  "use gnulib module canonicalize-lgpl for portability");
 # endif
 #endif
diff --git a/lib/string.in.h b/lib/string.in.h
index 5409f31..e0d7cde 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -536,9 +536,10 @@ _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, 
const char *needle));
   /* On some systems, this function is defined as an overloaded function:
        extern "C++" { const char * strstr (const char *, const char *); }
        extern "C++" { char * strstr (char *, const char *); }  */
-_GL_CXXALIAS_SYS_CAST2 (strstr,
-                        char *, (const char *haystack, const char *needle),
-                        const char *, (const char *haystack, const char 
*needle));
+_GL_CXXALIAS_SYS_CAST2
+(strstr,
+ char *, (const char *haystack, const char *needle),
+ const char *, (const char *haystack, const char *needle));
 # endif
 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
@@ -585,9 +586,10 @@ _GL_FUNCDECL_SYS (strcasestr, char *,
   /* On some systems, this function is defined as an overloaded function:
        extern "C++" { const char * strcasestr (const char *, const char *); }
        extern "C++" { char * strcasestr (char *, const char *); }  */
-_GL_CXXALIAS_SYS_CAST2 (strcasestr,
-                        char *, (const char *haystack, const char *needle),
-                        const char *, (const char *haystack, const char 
*needle));
+_GL_CXXALIAS_SYS_CAST2
+(strcasestr,
+ char *, (const char *haystack, const char *needle),
+ const char *, (const char *haystack, const char *needle));
 # endif
 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index ae2a3d2..c2668ba 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -21,12 +21,16 @@

 /* On OSF/1, <sys/types.h> and <sys/time.h> include <sys/select.h>.
    Simply delegate to the system's header in this case.  */
-#if @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TYPES_H_ && 
!defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H) && defined _OSF_SOURCE
+#if (@HAVE_SYS_SELECT_H@ && defined __osf__ && defined _SYS_TYPES_H_    \
+     && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H             \
+     && defined _OSF_SOURCE)

 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@

-#elif @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TIME_H_ && 
!defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H) && defined _OSF_SOURCE
+#elif (@HAVE_SYS_SELECT_H@ && defined __osf__ && defined _SYS_TIME_H_   \
+       && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H            \
+       && defined _OSF_SOURCE)

 # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
 # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index c4daaac..44ca1f5 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -123,7 +123,7 @@ struct sockaddr_storage
    code may not run on older Windows releases then.  My Windows 2000
    box was not able to run the code, for example.  The situation is
    slightly confusing because:
-   
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
+   http://msdn.microsoft.com/en-us/library/ms738520
    suggests that getaddrinfo should be available on all Windows
    releases. */

@@ -327,7 +327,8 @@ _GL_CXXALIAS_SYS_CAST (getpeername, int,
 _GL_CXXALIASWARN (getpeername);
 #elif @HAVE_WINSOCK2_H@
 # undef getpeername
-# define getpeername 
getpeername_used_without_requesting_gnulib_module_getpeername
+# define getpeername \
+    getpeername_used_without_requesting_gnulib_module_getpeername
 #elif defined GNULIB_POSIXCHECK
 # undef getpeername
 # if HAVE_RAW_DECL_GETPEERNAME
@@ -356,7 +357,8 @@ _GL_CXXALIAS_SYS_CAST (getsockname, int,
 _GL_CXXALIASWARN (getsockname);
 #elif @HAVE_WINSOCK2_H@
 # undef getsockname
-# define getsockname 
getsockname_used_without_requesting_gnulib_module_getsockname
+# define getsockname \
+    getsockname_used_without_requesting_gnulib_module_getsockname
 #elif defined GNULIB_POSIXCHECK
 # undef getsockname
 # if HAVE_RAW_DECL_GETSOCKNAME
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 3496a19..9e4c57e 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -594,7 +594,8 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
 #  else /* !_LARGE_FILES */
 #   define stat(name, st) rpl_stat (name, st)
 #  endif /* !_LARGE_FILES */
-_GL_EXTERN_C int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL 
((1, 2));
+_GL_EXTERN_C int stat (const char *name, struct stat *buf)
+  _GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stat
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 4c9a4a8..19abd3b 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -639,7 +639,8 @@ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, 
size_t len));
 _GL_CXXALIASWARN (gethostname);
 #elif @UNISTD_H_HAVE_WINSOCK2_H@
 # undef gethostname
-# define gethostname 
gethostname_used_without_requesting_gnulib_module_gethostname
+# define gethostname \
+    gethostname_used_without_requesting_gnulib_module_gethostname
 #elif defined GNULIB_POSIXCHECK
 # undef gethostname
 # if HAVE_RAW_DECL_GETHOSTNAME
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 342a9d2..1966b79 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -30,7 +30,11 @@
 @PRAGMA_SYSTEM_HEADER@
 #endif

-#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && 
((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined 
_GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
+#if (defined __need_mbstate_t || defined __need_wint_t                  \
+     || (defined __hpux                                                 \
+         && ((defined _INTTYPES_INCLUDED && !defined strtoimax)         \
+             || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H))               \
+     || defined _GL_ALREADY_INCLUDING_WCHAR_H)
 /* Special invocation convention:
    - Inside glibc and uClibc header files.
    - On HP-UX 11.00 we have a sequence of nested includes
diff --git a/top/maint.mk b/top/maint.mk
index 55aeb7b..613a4b7 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -277,6 +277,27 @@ sc_cast_of_alloca_return_value:
        halt='don'\''t cast alloca return value'                        \
          $(_sc_search_regexp)

+# HP NonStop system include files use "#pragma COLUMNS 80", which
+# means that files that replace system include files, or files like
+# alignof.h that are included by these replacement include files,
+# should not have lines longer than 80 characters.  This is a horrible
+# misfeature of NonStop, but lines that are too long are hard to read
+# anyway so we might as well shorten them.
+check_long_lines = \
+       dot_x_40='........................................';            \
+       prohibit="$$dot_x_40$$dot_x_40."                                \
+       halt='found a line that has more than 80 characters; reindent'
+sc_long_lines: long_lines_in_system_files long_lines_in_included_files
+long_lines_in_system_files:
+       @$(check_long_lines)                                            \
+       in_files='\.in\.h$$'                                            \
+       containing='@PRAGMA_SYSTEM_HEADER@'                             \
+         $(_sc_search_regexp)
+long_lines_in_included_files:
+       @$(check_long_lines)                                            \
+       in_files='alignof.h$$'                                          \
+         $(_sc_search_regexp)
+
 sc_space_tab:
        @prohibit='[ ]  '                                               \
        halt='found SPACE-TAB sequence; remove the SPACE'               \




reply via email to

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