Convert/update diffutils to working recipe

This commit is contained in:
Chris Roberts
2013-10-20 00:27:04 -06:00
parent b014d83ce0
commit 5452e6113c
8 changed files with 128 additions and 205 deletions

View File

@@ -1,14 +0,0 @@
diff -up diffutils-2.9/lib/verify.h.orig diffutils-2.9/lib/verify.h
--- diffutils-2.9/lib/verify.h.orig 2010-04-18 13:06:04.590872576 -0600
+++ diffutils-2.9/lib/verify.h 2010-04-18 13:08:52.910163968 -0600
@@ -135,6 +135,10 @@ template <int w>
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */
+# if __GNUC__ == 2
+# define verify(R)
+# else
# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)]
+# endif
#endif

View File

@@ -1,51 +0,0 @@
diff -urN diffutils-3.0/gnulib-tests/test-dup2.c diffutils-3.0-haiku/gnulib-tests/test-dup2.c
--- diffutils-3.0/gnulib-tests/test-dup2.c 2010-04-15 13:42:07.036700160 +0000
+++ diffutils-3.0-haiku/gnulib-tests/test-dup2.c 2010-10-06 11:17:38.000000000 +0000
@@ -176,6 +176,7 @@
/* On systems that distinguish between text and binary mode, dup2
reuses the mode of the source. */
+#if O_BINARY
setmode (fd, O_BINARY);
ASSERT (is_mode (fd, O_BINARY));
ASSERT (dup2 (fd, fd + 1) == fd + 1);
@@ -190,6 +191,6 @@
ASSERT (close (fd + 1) == 0);
ASSERT (close (fd) == 0);
ASSERT (unlink (file) == 0);
-
+#endif
return 0;
}
diff -urN diffutils-3.0/gnulib-tests/test-fcntl.c diffutils-3.0-haiku/gnulib-tests/test-fcntl.c
--- diffutils-3.0/gnulib-tests/test-fcntl.c 2010-04-15 13:42:08.027787264 +0000
+++ diffutils-3.0-haiku/gnulib-tests/test-fcntl.c 2010-10-06 11:21:54.000000000 +0000
@@ -298,6 +298,7 @@
ASSERT (is_mode (fd + 2, O_BINARY));
ASSERT (close (fd) == 0);
+#if O_TEXT
setmode (fd + 2, O_TEXT);
ASSERT (fcntl (fd + 2, F_DUPFD, fd + 1) == fd + 1);
ASSERT (!is_open (fd));
@@ -318,7 +319,7 @@
ASSERT (is_mode (fd, O_TEXT));
ASSERT (is_mode (fd + 2, O_TEXT));
ASSERT (close (fd + 2) == 0);
-
+#endif
/* Test F_GETFD. */
errno = 0;
ASSERT (fcntl (-1, F_GETFD) == -1);
diff -urN diffutils-3.0/gnulib-tests/test-signal.c diffutils-3.0-haiku/gnulib-tests/test-signal.c
--- diffutils-3.0/gnulib-tests/test-signal.c 2010-04-15 13:42:09.030932992 +0000
+++ diffutils-3.0-haiku/gnulib-tests/test-signal.c 2010-10-06 11:28:31.000000000 +0000
@@ -58,7 +58,7 @@
#ifdef SIGALRM
case SIGALRM:
#endif
-#ifdef SIGBUS
+#if defined SIGBUS && !defined(__HAIKU__)
case SIGBUS:
#endif
#ifdef SIGCHLD

View File

@@ -1,58 +0,0 @@
diff -urN diffutils-3.2/src/dir.c diffutils-3.2-c89/src/dir.c
--- diffutils-3.2/src/dir.c 2011-08-14 15:58:59.020709376 +0000
+++ diffutils-3.2-c89/src/dir.c 2012-09-14 16:59:18.000000000 +0000
@@ -202,6 +202,7 @@
struct dirdata dirdata[2];
int volatile val = EXIT_SUCCESS;
int i;
+ int v1;
if ((cmp->file[0].desc == -1 || dir_loop (cmp, 0))
&& (cmp->file[1].desc == -1 || dir_loop (cmp, 1)))
@@ -254,6 +255,7 @@
pretend the "next name" in that dir is very large. */
int nameorder = (!*names[0] ? 1 : !*names[1] ? -1
: compare_names (*names[0], *names[1]));
+ int v1;
/* Prefer a file_name_cmp match if available. This algorithm is
O(N**2), where N is the number of names in a directory
@@ -289,7 +291,7 @@
}
}
- int v1 = (*handle_file) (cmp,
+ v1 = (*handle_file) (cmp,
0 < nameorder ? 0 : *names[0]++,
nameorder < 0 ? 0 : *names[1]++);
if (val < v1)
@@ -342,7 +344,8 @@
match = file; /* longjmp may mess up MATCH. */
else
{
- for (char const **p = dirdata.names; *p; p++)
+ char const **p;
+ for (p = dirdata.names; *p; p++)
if (compare_names (*p, file) == 0)
{
if (file_name_cmp (*p, file) == 0)
diff -urN diffutils-3.2/src/io.c diffutils-3.2-c89/src/io.c
--- diffutils-3.2/src/io.c 2011-08-15 05:24:38.019136512 +0000
+++ diffutils-3.2-c89/src/io.c 2012-09-14 17:02:59.000000000 +0000
@@ -258,6 +258,7 @@
case IGNORE_TRAILING_SPACE:
{
size_t column = 0;
+ size_t repetitions = 1;
while ((c = *p++) != '\n')
{
if (ig_white_space & IGNORE_TRAILING_SPACE
@@ -274,8 +275,6 @@
while (isspace (c1));
}
- size_t repetitions = 1;
-
if (ig_white_space & IGNORE_TAB_EXPANSION)
switch (c)
{

View File

@@ -0,0 +1,62 @@
From c648aa48039deac1e3e1e031eaedd74c3428493f Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Sat, 19 Oct 2013 23:34:25 -0600
Subject: gcc2 fixes
diff --git a/src/dir.c b/src/dir.c
index 7f647b0..e9526ac 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -249,6 +249,7 @@ diff_dirs (struct comparison const *cmp,
/* Loop while files remain in one or both dirs. */
while (*names[0] || *names[1])
{
+ int v1;
/* Compare next name in dir 0 with next name in dir 1.
At the end of a dir,
pretend the "next name" in that dir is very large. */
@@ -289,7 +290,7 @@ diff_dirs (struct comparison const *cmp,
}
}
- int v1 = (*handle_file) (cmp,
+ v1 = (*handle_file) (cmp,
0 < nameorder ? 0 : *names[0]++,
nameorder < 0 ? 0 : *names[1]++);
if (val < v1)
@@ -347,7 +348,8 @@ find_dir_file_pathname (char const *dir, char const *file)
match = file; /* longjmp may mess up MATCH. */
else
{
- for (char const **p = dirdata.names; *p; p++)
+ char const **p;
+ for (p = dirdata.names; *p; p++)
if (compare_names (*p, file) == 0)
{
if (file_name_cmp (*p, file) == 0)
diff --git a/src/io.c b/src/io.c
index 463ee35..965cd3b 100644
--- a/src/io.c
+++ b/src/io.c
@@ -274,6 +274,8 @@ find_and_hash_each_line (struct file_data *current)
size_t column = 0;
while ((c = *p++) != '\n')
{
+ size_t repetitions = 1;
+
if (ig_white_space & IGNORE_TRAILING_SPACE
&& isspace (c))
{
@@ -288,8 +290,6 @@ find_and_hash_each_line (struct file_data *current)
while (isspace (c1));
}
- size_t repetitions = 1;
-
if (ig_white_space & IGNORE_TAB_EXPANSION)
switch (c)
{
--
1.8.3.4