bug-coreutils
[Top][All Lists]
Advanced

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

Re: new snapshot available: coreutils-7.4.125-eca6


From: Jim Meyering
Subject: Re: new snapshot available: coreutils-7.4.125-eca6
Date: Tue, 18 Aug 2009 11:05:30 +0200

Voelker, Bernhard wrote:
> make failed for me:
> - non-root
>
> - Solaris 10:
>   $ uname -a
>   SunOS avanti 5.10 Generic_127111-08 sun4u sparc SUNW,SPARC-Enterprise
>
> - Compiler:
>   $ cc -V
>   cc: Forte Developer 7 C 5.4 2002/03/09
>
> - ./configure --prefix=/user/ecs2 --disable-nls
>
> - Make output snippet:
>
>   CC     sort.o
> "sort.c", line 1705: syntax error before or at: [
> "sort.c", line 1709: invalid type combination
> "sort.c", line 1709: warning: initialization type mismatch
> "sort.c", line 1709: non-constant initializer: op "NAME"
> "sort.c", line 1838: cannot recover from previous errors
> cc: acomp failed for sort.c
> *** Error code 2
> The following command caused the error:
> echo "  CC    " sort.o; \
> source='sort.c' object='sort.o' libtool=no \
> DEPDIR=.deps depmode=none /bin/bash ../build-aux/depcomp \
> cc  -I. -I../lib  -I../lib     -g -c sort.c
> make: Fatal error: Command failed for target `sort.o'
>
>
> Code place (src/sort.c):
>
> 1704   static const char orders [UCHAR_LIM] = {
> 1705     ['K']=1, ['M']=2, ['G']=3, ['T']=4, ['P']=5, ['E']=6, ['Z']=7,
> ['Y']=8,
> 1706     ['k']=1,
> 1707   };

Thanks for the report.
coreutils began the switch to C99 years ago, and that sort of
initialization is a new addition.  We did debate whether to use the
new-to-coreutils construct.  However, if that's the only bit of code
that causes build failure for this compiler, I may accommodate it with
the attached patch:

>From ea57d4648226fc3d713a10448fc4fc012ccacdf5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 18 Aug 2009 11:01:00 +0200
Subject: [PATCH] sort: use more portable initialization syntax

* src/sort.c (find_unit_order): Spell out 256-element static
initializer, rather than relying on C99 syntax.
Required for Forte Developer 7 C 5.4 2002/03/09 on Solaris 10.
Reported by Bernhard Voelker.
---
 src/sort.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/sort.c b/src/sort.c
index 62ddd49..832be5a 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -1701,10 +1701,29 @@ check_mixed_SI_IEC (char prefix, struct keyfield *key)
 static int
 find_unit_order (const char *number, struct keyfield *key)
 {
-  static const char orders [UCHAR_LIM] = {
-    ['K']=1, ['M']=2, ['G']=3, ['T']=4, ['P']=5, ['E']=6, ['Z']=7, ['Y']=8,
-    ['k']=1,
-  };
+  static const char orders [UCHAR_LIM] =
+    {
+#if SOME_DAY_WE_WILL_REQUIRE_C99
+      ['K']=1, ['M']=2, ['G']=3, ['T']=4, ['P']=5, ['E']=6, ['Z']=7, ['Y']=8,
+      ['k']=1,
+#else
+      /* Generate the following table with this command:
+         perl -e 'my %a=(k=>1, K=>1, M=>2, G=>3, T=>4, P=>5, E=>6, Z=>7, Y=>8);
+         foreach my $i (0..255) {my $c=chr($i); $a{$c} ||= 0;print "$a{$c}, 
"}'\
+         |fmt  */
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 3,
+      0, 0, 0, 1, 0, 2, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 0, 8, 7, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+#endif
+    };

   const unsigned char *p = number;

--
1.6.4.378.g88f2f




reply via email to

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