Re: new module 'printf-posix'
Eric Blake wrote: > shouldn't all the rpl_*printf variant > declarations be given a printf attribute when available so that users of > the *printf-posix modules still get the benefits of gcc format string > checking? Good idea. I'm applying this: 2007-03-10 Bruno Haible <[EMAIL PROTECTED]> * lib/stdio_.h (__attribute__): New macro. (fprintf, vfprintf, printf, vprintf, snprintf, vsnprintf, sprintf, vsprintf): Specify __attribute__ __format__ for GCC. Suggested by Eric Blake. *** lib/stdio_.h10 Mar 2007 11:20:32 - 1.12 --- lib/stdio_.h10 Mar 2007 11:21:05 - *** *** 31,36 --- 31,49 #include #include + #ifndef __attribute__ + /* This feature is available in gcc versions 2.5 and later. */ + # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ + # define __attribute__(Spec) /* empty */ + # endif + /* The __-protected variants of `format' and `printf' attributes +are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ + # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) + # define __format__ format + # define __printf__ printf + # endif + #endif + /* The definition of GL_LINK_WARNING is copied here. */ *** *** 43,49 #if @GNULIB_FPRINTF_POSIX@ # if @REPLACE_FPRINTF@ # define fprintf rpl_fprintf ! extern int fprintf (FILE *fp, const char *format, ...); # endif #elif defined GNULIB_POSIXCHECK # undef fprintf --- 56,63 #if @GNULIB_FPRINTF_POSIX@ # if @REPLACE_FPRINTF@ # define fprintf rpl_fprintf ! extern int fprintf (FILE *fp, const char *format, ...) !__attribute__ ((__format__ (__printf__, 2, 3))); # endif #elif defined GNULIB_POSIXCHECK # undef fprintf *** *** 57,63 #if @GNULIB_VFPRINTF_POSIX@ # if @REPLACE_VFPRINTF@ # define vfprintf rpl_vfprintf ! extern int vfprintf (FILE *fp, const char *format, va_list args); # endif #elif defined GNULIB_POSIXCHECK # undef vfprintf --- 71,78 #if @GNULIB_VFPRINTF_POSIX@ # if @REPLACE_VFPRINTF@ # define vfprintf rpl_vfprintf ! extern int vfprintf (FILE *fp, const char *format, va_list args) !__attribute__ ((__format__ (__printf__, 2, 0))); # endif #elif defined GNULIB_POSIXCHECK # undef vfprintf *** *** 72,78 # if @REPLACE_PRINTF@ /* Don't break __attribute__((format(printf,M,N))). */ # define printf __printf__ ! extern int printf (const char *format, ...); # endif #elif defined GNULIB_POSIXCHECK # undef printf --- 87,94 # if @REPLACE_PRINTF@ /* Don't break __attribute__((format(printf,M,N))). */ # define printf __printf__ ! extern int printf (const char *format, ...) !__attribute__ ((__format__ (__printf__, 1, 2))); # endif #elif defined GNULIB_POSIXCHECK # undef printf *** *** 93,99 #if @GNULIB_VPRINTF_POSIX@ # if @REPLACE_VPRINTF@ # define vprintf rpl_vprintf ! extern int vprintf (const char *format, va_list args); # endif #elif defined GNULIB_POSIXCHECK # undef vprintf --- 109,116 #if @GNULIB_VPRINTF_POSIX@ # if @REPLACE_VPRINTF@ # define vprintf rpl_vprintf ! extern int vprintf (const char *format, va_list args) !__attribute__ ((__format__ (__printf__, 1, 0))); # endif #elif defined GNULIB_POSIXCHECK # undef vprintf *** *** 109,115 # define snprintf rpl_snprintf # endif # if @REPLACE_SNPRINTF@ || [EMAIL PROTECTED]@ ! extern int snprintf (char *str, size_t size, const char *format, ...); # endif #elif defined GNULIB_POSIXCHECK # undef snprintf --- 126,133 # define snprintf rpl_snprintf # endif # if @REPLACE_SNPRINTF@ || [EMAIL PROTECTED]@ ! extern int snprintf (char *str, size_t size, const char *format, ...) !__attribute__ ((__format__ (__printf__, 3, 4))); # endif #elif defined GNULIB_POSIXCHECK # undef snprintf *** *** 124,130 # define vsnprintf rpl_vsnprintf # endif # if @REPLACE_VSNPRINTF@ || [EMAIL PROTECTED]@ ! extern int vsnprintf (char *str, size_t size, const char *format, va_list args); # endif #elif defined GNULIB_POSIXCHECK # undef vsnprintf --- 142,149 # define vsnprintf rpl_vsnprintf # endif # if @REPLACE_VSNPRINTF@ || [EMAIL PROTECTED]@ ! extern int vsnprintf (char *str, size_t size, const char *format, va_list args) !__attribute__ ((__format__ (__printf__, 3, 0))); # endif #elif defined GNULIB_POSIXCHECK # undef vsnprintf *** *** 137,143 #if @GNULIB_SPRINTF_POSIX@ # if @REPLACE_SPRINTF@ # define sprintf rpl_sprintf ! extern int sprintf (char *str, const char *format, ...); # endif #elif defined GNULIB_POSIXCHECK # undef sprintf --- 156,163 #if @GNULIB_SPRINTF_POSIX@ # if @REPLACE_SPRINTF@ # define sprintf rpl_sprintf ! extern int sprintf (char *str, const char *format, ...) !__attribute__ ((__format__ (__printf__, 2
Re: GNU M4 1.4.8b released (beta release)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Matthew Woehlke on 3/8/2007 9:28 AM: > > (We already know this doesn't work: if configure doesn't define > HAVE_LONG_LONG_INT, then the resulting stdint.h breaks system headers.) > > > Without also telling gnulib not to use 'long long', we know other things > (like gnulib's printf - of whichever flavor, I don't recall exactly > which one offhand) break. > > I did this: > > --- stdint_.h 2007-03-08 08:14:55.0 -0800 > +++ ../../m4-1.4.8b-orig/lib/stdint_.h 2007-03-01 08:48:39.0 -0800 > @@ -120,17 +120,12 @@ > #define int32_t int > #define uint32_t unsigned int > > +#undef int64_t > #if LONG_MAX >> 31 >> 31 == 1 > -# undef int64_t > -# define GNULIB_int64_t ... Your patch was backwards, but since it solved your build, it is worth committing. Here's what I'm checking in so that a platforms int64_t is not overridden if gnulib does not use 64-bit types. It still does not solve the issue of whether gnulib should insist that long long and unsigned long long must both exist with the same width, or claim that neither is usable; but as yours is the only odd platform encountered so far, and since CFLAGS=-O appears to solve it for you, I'm not sure how others feel about trying to improve gnulib in this area. It may end up that I release m4 1.4.9 and you have to compile with optimizations on for it to work on NSK. 2007-03-10 Eric Blake <[EMAIL PROTECTED]> and Matthew Woehlke(tiny change) * lib/stdint_.h (int64_t, uint64_t): Don't undefine if 64-bit types are not being provided by gnulib. (GL_INT64_T, GL_UINT64_T): New witnesses of whether gnulib 64-bit types are supported. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF8sZg84KuGfSFAYARAm2yAKCflPXoKp7ZE4A1vc68urse/UQPmwCeNiNb 3w46uInLuQXTO5EiFBdgpIU= =rcZH -END PGP SIGNATURE-
gnulib-tool: speeding up --create-testdir
The patch from 2007-01-14 to avoid "./configure; make" during --create-testdir did most often not work. This should fix it. 2007-03-10 Bruno Haible <[EMAIL PROTECTED]> * gnulib-tool (func_create_testdir): Treat MOSTLYCLEANFILES like CLEANFILES. Put spaces in each line of $cleaned_files, not only the first and the last. *** gnulib-tool 6 Mar 2007 03:38:30 - 1.222 --- gnulib-tool 10 Mar 2007 15:20:28 - 1.223 *** *** 2739,2748 fi # Need to run configure and make once, to create built files that are to be # distributed (such as getdate.c). ! # Extract the value of "CLEANFILES += ...". cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \ ! | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p'` ! cleaned_files=" "`for file in $cleaned_files; do echo "$file"; done`" " # Extract the value of "BUILT_SOURCES += ...". Remove variable references # such $(FOO_H) because they don't refer to distributed files. sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g' --- 2739,2748 fi # Need to run configure and make once, to create built files that are to be # distributed (such as getdate.c). ! # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...". cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \ ! | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'` ! cleaned_files=`for file in $cleaned_files; do echo " $file "; done` # Extract the value of "BUILT_SOURCES += ...". Remove variable references # such $(FOO_H) because they don't refer to distributed files. sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
Re: new module 'fseterr'
Simon Josefsson wrote: > Consider making it possible to not use this workaround, but > rather fail with a compilation error. I wouldn't want code that > invoke abort in a library, for example. Makes sense. The Solaris 10 include files contain comments like this: * Even though the contents of the stdio FILE structure have always been * private to the stdio implementation, over the years some programs have * needed to get information about a stdio stream that was not accessible * through a supported interface. These programs have resorted to accessing * fields of the FILE structure directly, rendering them possibly non-portable * to new implementations of stdio, or more likely, preventing enhancements * to stdio because those programs will break. * * In the 64-bit world, the FILE structure is opaque. ... so this will require a bit if porting for Solaris/x86_64. I'm applying this: 2007-03-10 Bruno Haible <[EMAIL PROTECTED]> * lib/fseterr.c (fseterr): Port to Solaris/SPARC64. Deactivate the fallback; use #error instead. Suggested by Simon Josefsson. *** lib/fseterr.c 9 Mar 2007 02:41:51 - 1.2 --- lib/fseterr.c 10 Mar 2007 16:05:37 - *** *** 33,42 #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ fp->_flags |= __SERR; #elif defined _IOERR/* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ fp->_flag |= _IOERR; ! #else /* unknown */ /* Portable fallback, based on an idea by Rich Felker. ! Wow! 6 system calls for something that is just a bit operation! */ int saved_errno; int fd; int fd2; --- 33,49 #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ fp->_flags |= __SERR; #elif defined _IOERR/* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ + # if defined __sun && defined __sparc && defined _LP64 /* Solaris/SPARC 64-bit */ + ((unsigned int *) fp) [9] |= 0x20; + # else fp->_flag |= _IOERR; ! # endif ! #elif 0 /* unknown */ /* Portable fallback, based on an idea by Rich Felker. ! Wow! 6 system calls for something that is just a bit operation! ! Not activated on any system, because there is no way to repair FP when ! the sequence of system calls fails, and library code should not call ! abort(). */ int saved_errno; int fd; int fd2; *** *** 56,60 --- 63,69 close (fd2); } errno = saved_errno; + #else + #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib." #endif }
Re: GNU M4 1.4.8b released (beta release)
Eric Blake wrote: > 2007-03-10 Eric Blake <[EMAIL PROTECTED]> > and Matthew Woehlke(tiny change) > > * lib/stdint_.h (int64_t, uint64_t): Don't undefine if 64-bit > types are not being provided by gnulib. > (GL_INT64_T, GL_UINT64_T): New witnesses of whether gnulib 64-bit > types are supported. The attached patch was empty and contained a typo, that I fixed: --- lib/stdint_.h 10 Mar 2007 14:52:08 - 1.38 +++ lib/stdint_.h 10 Mar 2007 15:03:27 - 1.39 @@ -179,7 +179,7 @@ #ifdef GL_INT64_T # define int_least64_t int64_t #endif -#ifdef GL_UIN64_T +#ifdef GL_UINT64_T # define uint_least64_t uint64_t #endif
Re: GNU M4 1.4.8b released (beta release)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 3/10/2007 8:25 AM: > Eric Blake wrote: >> 2007-03-10 Eric Blake <[EMAIL PROTECTED]> >> and Matthew Woehlke(tiny change) >> >> * lib/stdint_.h (int64_t, uint64_t): Don't undefine if 64-bit >> types are not being provided by gnulib. >> (GL_INT64_T, GL_UINT64_T): New witnesses of whether gnulib 64-bit >> types are supported. > > The attached patch was empty and contained a typo, that I fixed: Apologies, and thanks for the quick fix. I'm not quite sure how I ended up with an empty attachment. For the record, I'm resending the patch I actually applied; including the typo that has since been fixed. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF8y4384KuGfSFAYARAktPAKCHW2mSooZJ5lpIUSkjXUodniiyUACeOnZO TZAczKF9bMICMhQqH+Sf1A8= =O8vz -END PGP SIGNATURE- Index: lib/stdint_.h === RCS file: /sources/gnulib/gnulib/lib/stdint_.h,v retrieving revision 1.37 retrieving revision 1.38 diff -u -p -r1.37 -r1.38 --- lib/stdint_.h 16 Jan 2007 16:31:23 - 1.37 +++ lib/stdint_.h 10 Mar 2007 14:52:08 - 1.38 @@ -120,22 +120,34 @@ #define int32_t int #define uint32_t unsigned int -#undef int64_t +/* Do not undefine int64_t if gnulib is not being used with 64-bit + types, since otherwise it breaks platforms like Tandem/NSK. */ #if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t # define int64_t long int +# define GL_INT64_T #elif defined _MSC_VER +# undef int64_t # define int64_t __int64 +# define GL_INT64_T #elif @HAVE_LONG_LONG_INT@ +# undef int64_t # define int64_t long long int +# define GL_INT64_T #endif -#undef uint64_t #if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t # define uint64_t unsigned long int +# define GL_UINT64_T #elif defined _MSC_VER +# undef uint64_t # define uint64_t unsigned __int64 +# define GL_UINT64_T #elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# undef uint64_t # define uint64_t unsigned long long int +# define GL_UINT64_T #endif /* Avoid collision with Solaris 2.5.1 etc. */ @@ -164,10 +176,10 @@ #define uint_least16_t uint16_t #define int_least32_t int32_t #define uint_least32_t uint32_t -#ifdef int64_t +#ifdef GL_INT64_T # define int_least64_t int64_t #endif -#ifdef uint64_t +#ifdef GL_UIN64_T # define uint_least64_t uint64_t #endif @@ -195,10 +207,10 @@ #define uint_fast16_t unsigned int_fast16_t #define int_fast32_t long int #define uint_fast32_t unsigned int_fast32_t -#ifdef int64_t +#ifdef GL_INT64_T # define int_fast64_t int64_t #endif -#ifdef uint64_t +#ifdef GL_UINT64_T # define uint_fast64_t uint64_t #endif @@ -217,7 +229,7 @@ #undef intmax_t #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 # define intmax_t long long int -#elif defined int64_t +#elif defined GL_INT64_T # define intmax_t int64_t #else # define intmax_t long int @@ -226,7 +238,7 @@ #undef uintmax_t #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 # define uintmax_t unsigned long long int -#elif defined uint64_t +#elif defined GL_UINT64_T # define uintmax_t uint64_t #else # define uintmax_t unsigned long int @@ -264,13 +276,13 @@ #undef INT64_MIN #undef INT64_MAX -#ifdef int64_t +#ifdef GL_INT64_T # define INT64_MIN (~ INT64_MAX) # define INT64_MAX INTMAX_C (9223372036854775807) #endif #undef UINT64_MAX -#ifdef uint64_t +#ifdef GL_UINT64_T # define UINT64_MAX UINTMAX_C (18446744073709551615) #endif @@ -303,13 +315,13 @@ #undef INT_LEAST64_MIN #undef INT_LEAST64_MAX -#ifdef int64_t +#ifdef GL_INT64_T # define INT_LEAST64_MIN INT64_MIN # define INT_LEAST64_MAX INT64_MAX #endif #undef UINT_LEAST64_MAX -#ifdef uint64_t +#ifdef GL_UINT64_T # define UINT_LEAST64_MAX UINT64_MAX #endif @@ -342,13 +354,13 @@ #undef INT_FAST64_MIN #undef INT_FAST64_MAX -#ifdef int64_t +#ifdef GL_INT64_T # define INT_FAST64_MIN INT64_MIN # define INT_FAST64_MAX INT64_MAX #endif #undef UINT_FAST64_MAX -#ifdef uint64_t +#ifdef GL_UINT64_T # define UINT_FAST64_MAX UINT64_MAX #endif @@ -469,7 +481,7 @@ #undef INTMAX_C #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 # define INTMAX_C(x) x##LL -#elif defined int64_t +#elif defined GL_INT64_T # define INTMAX_C(x) INT64_C(x) #else # define INTMAX_C(x) x##L @@ -478,7 +490,7 @@ #undef UINTMAX_C #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 # define UINTMAX_C(x) x##ULL -#elif defined uint64_t +#elif defined GL_UINT64_T # define UINTMAX_C(x) UINT64_C(x) #else # define UINTMAX_C(x) x##UL