bug-bison
[Top][All Lists]
Advanced

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

Re: Bison 3.5.93 released [beta]


From: Akim Demaille
Subject: Re: Bison 3.5.93 released [beta]
Date: Mon, 4 May 2020 06:41:52 +0200


> Le 3 mai 2020 à 21:48, Dagobert Michelsen <address@hidden> a écrit :
> 
> Hi Akim,

Hi Dagobert,

> Am 03.05.2020 um 20:04 schrieb Akim Demaille <address@hidden>:
>> Here are the compressed sources:
>> https://alpha.gnu.org/gnu/bison/bison-3.5.93.tar.gz   (5.1MB)
>> https://alpha.gnu.org/gnu/bison/bison-3.5.93.tar.xz   (3.1MB)
> 
> I have one more function missing on Solaris 10 Sparc:
> 
>  CCLD     examples/c/bistromathic/bistromathic
> Undefined                       first referenced
> symbol                             in file
> strnlen                             
> examples/c/bistromathic/bistromathic-parse.o
> ld: fatal: symbol referencing errors. No output written to 
> examples/c/bistromathic/bistromathic

Doh...

> Would you mind adding?

Sure.  And don't tell me you don't have memchr :)

I'm installing this.  Cheers!

commit 2e1a64c17a1297b790e3deb34cc630fe4c9a1e3c
Author: Akim Demaille <address@hidden>
Date:   Mon May 4 06:37:59 2020 +0200

    examples: beware of strnlen portability issues
    
    One function missing on Solaris 10 Sparc:
    
         CCLD     examples/c/bistromathic/bistromathic
        Undefined                       first referenced
        symbol                             in file
        strnlen                             
examples/c/bistromathic/bistromathic-parse.o
        ld: fatal: symbol referencing errors. No output written to 
examples/c/bistromathic/bistromathic
    
    Reported by Dagobert Michelsen.
    https://lists.gnu.org/r/bug-bison/2020-05/msg00048.html
    
    * examples/c/bistromathic/parse.y (xstrndup): Don't use strnlen.
    xstrndup is assembled from gnulib's xstrndup, strndup and strnlen...

diff --git a/examples/c/bistromathic/parse.y b/examples/c/bistromathic/parse.y
index 8db9d457..38fedb46 100644
--- a/examples/c/bistromathic/parse.y
+++ b/examples/c/bistromathic/parse.y
@@ -400,7 +400,9 @@ void yyerror (YYLTYPE *loc, char const *format, ...)
 static char *
 xstrndup (const char *string, size_t n)
 {
-  size_t len = strnlen (string, n);
+  // len = strnlen (string, n), portably.
+  const char *end = memchr (string, '\0', n);
+  size_t len = end ? (size_t) (end - string) : n;
   char *new = malloc (len + 1);
   assert (new);
   new[len] = '\0';




reply via email to

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