bug-patch
[Top][All Lists]
Advanced

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

[bug-patch] GNU patch 2.6.1 fails to build on IRIX


From: Stuart Shelton
Subject: [bug-patch] GNU patch 2.6.1 fails to build on IRIX
Date: Fri, 15 Jan 2010 16:17:56 +0000

On IRIX (and, indeed, any platform without strnlen() or strndup()),
patch 2.6.1 fails with:

cc-1196 cc: WARNING File = gl/lib/strndup.c, Line = 33
 The indicated function is declared implicitly.

   size_t len = strnlen (s, n);
                ^

cc-1196 cc: WARNING File = gl/lib/xstrndup.c, Line = 36
 The indicated function is declared implicitly.

   char *s = strndup (string, n);
             ^

cc-1140 cc: ERROR File = gl/lib/xstrndup.c, Line = 36
 A value of type "int" cannot be used to initialize an entity of type "char *".

   char *s = strndup (string, n);
             ^

1 error detected in the compilation of "gl/lib/xstrndup.c".
make: *** [gl/lib/xstrndup.o] Error 2

... because 'config.h' says that 'HAVE_DECL_STRNDUP' and
'HAVE_DECL_STRNLEN' should be set to '0' or '1' depending on whether
the function is available, but then the code in these two files checks
to see whether HAVE_DECL_STRNDUP and HAVE_DECL_STRNLEN are defined -
which will always be the case.

According to the gnulib guys, "The latest gnulib version of strndup.c
does not look
like this.  Therefore, the bug is in patch, and merely that the last patch
release has an out-of-date copy of gnulib."

patch 2.6.1 also runs into the infamous MIPSpro error:

cc-1999 cc: ERROR File = src/bestmatch.h, Line = 135
 "jumping out of a block containing VLAs" is not currently implemented

1 error detected in the compilation of "src/merge.c".

... but the code (in a header file?) which does this appears to be
entirely superfluous: a for block containing only a 'continue'
instruction.  Removing this allows patch to compile and also pass all
of its test-suite.

Patch as follows:

--- ./gl/lib/strndup.c.dist     2010-01-14 16:20:55.486054760 +0000
+++ ./gl/lib/strndup.c  2010-01-14 16:22:49.439646360 +0000
@@ -23,7 +23,7 @@

 #include <stdlib.h>

-#ifndef HAVE_DECL_STRNLEN
+#if HAVE_DECL_STRNLEN != 1
 extern size_t strnlen (const char *, size_t);
 #endif

--- ./gl/lib/xstrndup.c.dist    2010-01-14 16:21:12.090312800 +0000
+++ ./gl/lib/xstrndup.c 2010-01-14 16:22:38.839461080 +0000
@@ -23,7 +23,7 @@
 #include <string.h>
 #include "xalloc.h"

-#ifndef HAVE_DECL_STRNDUP
+#if HAVE_DECL_STRNDUP != 1
 extern char *strndup (const char *, size_t);
 #endif

--- ./src/bestmatch.h.dist      2010-01-14 16:01:40.311100400 +0000
+++ ./src/bestmatch.h   2010-01-14 16:17:17.331202440 +0000
@@ -131,8 +131,9 @@ bestmatch(OFFSET xoff, OFFSET xlim, OFFS
                 x = fd[d - 1] + 1;
               for (y = x - d;
                    x < xlim && y < ylim && EQUAL_IDX (x, y);
-                    x++, y++)
-                 continue;
+                    x++, y++) {
+                 /* continue; */
+               }
               fd[d] = x;
               if (x == xlim && y >= min
                   && x + y - c >= fmid_plus_2_min)




reply via email to

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