bug-gnulib
[Top][All Lists]
Advanced

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

RE: Fwd: sed porting trouble


From: Schmitz, Joachim
Subject: RE: Fwd: sed porting trouble
Date: Sat, 2 Oct 2010 06:50:15 +0000

Hi Paul

I too find that #pragma columns to be a terrible misfeature, but it stems from 
the fact that the standard 6530 terminal (or emulation) on this platform cannot 
not do more than 80 characters, not on the (older and proprietary) Guardian 
side of NSK, only on the OSS (POSIX) side (which uses VT100 in a terminal 
emulation).
And cutting off stuff you can't see anyway (and might be garbage), doesn't 
sound too bad an idea. So this is to be seen as a legacy feature that once had 
it's purpose in life.

I also agree that overly long lines are hard to read and understand, and that 
we should not add unportable stuff (like pragmas) if we can solve it in a 
portable fashion (shorter lines)

So like Jim said in a parallel email: your reasonable patch was provoked by 
that pragma, which shows it's usefulness ;-)

Bye, Jojo
-----Original Message-----
From: Paul Eggert [mailto:address@hidden
Sent: Saturday, October 02, 2010 2:54 AM
To: Paolo Bonzini
Cc: Schmitz, Joachim; 'bug-gnulib'; 'Bruno Haible'
Subject: Re: Fwd: sed porting trouble

On 10/01/2010 06:25 AM, Paolo Bonzini wrote:

> So, it looks like we must make sure that the system-header
> replacements have 80-columns lines.  Sigh.

I agree about the "Sigh", but it's better to do that than to play with
unportable #pragmas.  Besides, those header files with the long lines
are too hard to read anyway.  I can't easily parse this:

#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

and would far prefer seeing that line folded into 80 characters, so I
can figure out what it means.

So, how about something like the following patch?  It will fix the
immediate problem anyway.  (And my goodness, what a terrible misfeature
"#pragma COLUMN" is! would you all mind if I give it as an example of a
terrible design in my programming languages class?)


diff --git a/lib/alignof.h b/lib/alignof.h
index 953badc..458c0fd 100644
--- a/lib/alignof.h
+++ b/lib/alignof.h
@@ -28,7 +28,8 @@
   template <class type> struct alignof_helper { char __slot1; type __slot2; };
 # define alignof_slot(type) offsetof (alignof_helper<type>, __slot2)
 #else
-# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, 
__slot2)
+# define alignof_slot(type) \
+     offsetof (struct { char __slot1; type __slot2; }, __slot2)
 #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..9daa3bc 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -136,7 +136,8 @@ _GL_FUNCDECL_SYS (scandir, int,
 _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 **)));
+                        int (*cmp) (const struct dirent **,
+                                    const struct dirent **)));
 _GL_CXXALIASWARN (scandir);
 #elif defined GNULIB_POSIXCHECK
 # undef scandir
diff --git a/lib/math.in.h b/lib/math.in.h
index fbc2918..d495189 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,11 +702,14 @@ _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_signbitf(arg) \
        ({ union { float _value;                                         \
-                  unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 
1) / sizeof (unsigned int)]; \
+                  unsigned int _word[(sizeof (float)                    \
+                                      + sizeof (unsigned int) - 1)      \
+                                     / sizeof (unsigned int)];          \
                 } _m;                                                   \
           _m._value = (arg);                                            \
           (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1;          \
@@ -714,8 +718,10 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
 #   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[(sizeof (double)                   \
+                                      + sizeof (unsigned int) - 1)      \
+                                     / sizeof (unsigned int)];          \
                 } _m;                                                   \
           _m._value = (arg);                                            \
           (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1;          \
@@ -725,10 +731,12 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
 #    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[(sizeof (long double)              \
+                                      + sizeof (unsigned int) - 1)      \
+                                     / sizeof (unsigned int)];          \
                 } _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/stdint.in.h b/lib/stdint.in.h
index a861c07..f84dd10 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[2 * (sizeof (intmax_t) == sizeof (uintmax_t))
+                                - 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..7c9d204 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -26,10 +26,12 @@
 # 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://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/
+          priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>.  */
 #  define fp_ ((struct { struct __FILE_public pub; \
                          struct { unsigned char *_base; int _size; } _bf; \
                          void *cookie; \
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index f4309ed..38380a9 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.  */
diff --git a/lib/string.in.h b/lib/string.in.h
index 5409f31..88d0149 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -538,7 +538,8 @@ _GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, 
const char *needle));
        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));
+                        const char *, (const char *haystack,
+                                       const char *needle));
 # endif
 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
@@ -587,7 +588,8 @@ _GL_FUNCDECL_SYS (strcasestr, 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));
+                        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..8e58c38 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -123,7 +123,8 @@ 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/library/
+   default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp>
    suggests that getaddrinfo should be available on all Windows
    releases. */

@@ -327,7 +328,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 +358,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


reply via email to

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