bug-coreutils
[Top][All Lists]
Advanced

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

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


From: Eric Blake
Subject: Re: coreutils-7.1 requires trivial patch to build on IRIX/MIPSpro
Date: Thu, 26 Feb 2009 06:46:20 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.666

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.dist        2009-02-25 17:06:43.143228800 +0000
> +++ lib/argv-iter.h     2009-02-25 17:06:50.654736800 +0000
> @@ -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             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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