Re: coreutils-7.1 requires trivial patch to build on IRIX/MIPSpro

2009-02-26 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Jim Meyering on 2/26/2009 6:50 AM:
>>
>> Perhaps this approach would be better, Jim?
> 
> Yes, indeed!
> That looks much better.  Thanks to both of you.
> 
> ...
>> -  _ATTRIBUTE_NONNULL_ (1, 2);
>> +  _ATTRIBUTE_NONNULL_ (1) _ATTRIBUTE_NONNULL_ (2);

Committed with this log entry:

 argv-iter: avoid variadic macro

* gl/lib/argv-iter.h (_ATTRIBUTE_NONNULL_): Don't assume C99 variadic
macros are portable yet; needed for at least IRIX/MIPSpro.
* THANKS: Update.
Reported by Stuart Shelton.

- --
Don't work too hard, make some time for fun as well!

Eric Blake e...@byu.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmmoLIACgkQ84KuGfSFAYBCAACgvrmWTDKTBw/EBWbycrZgvX65
kpcAnjjMhIoaFOcZkIoQEiX52fWEBZqY
=j8Gi
-END PGP SIGNATURE-


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: coreutils-7.1 requires trivial patch to build on IRIX/MIPSpro

2009-02-26 Thread Jim Meyering
Eric Blake wrote:
> According to Stuart Shelton on 2/26/2009 5:37 AM:
>
> Hello Stuart,
>
>>
>> The MIPSpro compiler is strict with variadic macros, requiring a macro
>> defined as function(x,...) to be invoked with a minimum of two arguments
>> (one for 'x', and at least one for the '...')
>>
>> coreutils-7.1 therefore requires this patch:
>>
>> --- lib/argv-iter.h.dist2009-02-25 17:06:43.143228800 +
>> +++ lib/argv-iter.h 2009-02-25 17:06:50.654736800 +
>> @@ -24,7 +24,7 @@
>>  #if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
>>  # define _ATTRIBUTE_NONNULL_(m,...) __attribute__ ((__nonnull__ (m)))
>>  #else
>> -# define _ATTRIBUTE_NONNULL_(m,...)
>> +# define _ATTRIBUTE_NONNULL_(...)
>
> Thanks for the report.  Actually, I'm surprised to see that variadic
> macros are in use.  Yes, coreutils already uses C99 decl-after-statement,
> since most C89 compilers support that as an extension.  But are variadic
> macros really that portable?
>
> Perhaps this approach would be better, Jim?

Yes, indeed!
That looks much better.  Thanks to both of you.

...
> -  _ATTRIBUTE_NONNULL_ (1, 2);
> +  _ATTRIBUTE_NONNULL_ (1) _ATTRIBUTE_NONNULL_ (2);


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: coreutils-7.1 requires trivial patch to build on IRIX/MIPSpro

2009-02-26 Thread Eric Blake
According to Stuart Shelton on 2/26/2009 5:37 AM:

Hello Stuart,

> 
> The MIPSpro compiler is strict with variadic macros, requiring a macro
> defined as function(x,...) to be invoked with a minimum of two arguments
> (one for 'x', and at least one for the '...')
> 
> coreutils-7.1 therefore requires this patch:
> 
> --- lib/argv-iter.h.dist2009-02-25 17:06:43.143228800 +
> +++ lib/argv-iter.h 2009-02-25 17:06:50.654736800 +
> @@ -24,7 +24,7 @@
>  #if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
>  # define _ATTRIBUTE_NONNULL_(m,...) __attribute__ ((__nonnull__ (m)))
>  #else
> -# define _ATTRIBUTE_NONNULL_(m,...)
> +# define _ATTRIBUTE_NONNULL_(...)

Thanks for the report.  Actually, I'm surprised to see that variadic
macros are in use.  Yes, coreutils already uses C99 decl-after-statement,
since most C89 compilers support that as an extension.  But are variadic
macros really that portable?

Perhaps this approach would be better, Jim?

diff --git a/gl/lib/argv-iter.h b/gl/lib/argv-iter.h
index 06a397c..32b3eb3 100644
--- a/gl/lib/argv-iter.h
+++ b/gl/lib/argv-iter.h
@@ -1,5 +1,5 @@
 /* Iterate over arguments from argv or --files0-from=FILE
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,9 +22,9 @@ enum argv_iter_err;

 #undef _ATTRIBUTE_NONNULL_
 #if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || 3 < __GNUC__
-# define _ATTRIBUTE_NONNULL_(m,...) __attribute__ ((__nonnull__ (m)))
+# define _ATTRIBUTE_NONNULL_(m) __attribute__ ((__nonnull__ (m)))
 #else
-# define _ATTRIBUTE_NONNULL_(m,...)
+# define _ATTRIBUTE_NONNULL_(m)
 #endif

 enum argv_iter_err
@@ -40,7 +40,7 @@ struct argv_iterator *argv_iter_init_argv (char **argv)
 struct argv_iterator *argv_iter_init_stream (FILE *fp)
   _ATTRIBUTE_NONNULL_ (1);
 char *argv_iter (struct argv_iterator *, enum argv_iter_err *)
-  _ATTRIBUTE_NONNULL_ (1, 2);
+  _ATTRIBUTE_NONNULL_ (1) _ATTRIBUTE_NONNULL_ (2);
 size_t argv_iter_n_args (struct argv_iterator const *)
   _ATTRIBUTE_NONNULL_ (1);
 void argv_iter_free (struct argv_iterator *)

-- 
Don't work too hard, make some time for fun as well!

Eric Blake e...@byu.net



signature.asc
Description: OpenPGP digital signature
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils