adjust c99-to-c89 patch as well as the code to generate it
authorJim Meyering <meyering@redhat.com>
Tue, 3 Jun 2008 08:33:17 +0000 (10:33 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 3 Jun 2008 08:33:17 +0000 (10:33 +0200)
* maint.mk (patch-check) [REGEN_PATCH]: Eliminate date-related
differences in generated diffs.
* src/c99-to-c89.diff: Adjust offsets.

maint.mk
src/c99-to-c89.diff

index f4b0bae..ee0e289 100644 (file)
--- a/maint.mk
+++ b/maint.mk
@@ -456,15 +456,18 @@ update-NEWS-hash: NEWS
        perl -pi -e 's/^(old_NEWS_hash = ).*/$${1}'"$(NEWS_hash)/" \
          $(srcdir)/cfg.mk
 
+epoch_date = 1970-01-01 00:00:00.000000000 +0000
 # Ensure that the c99-to-c89 patch applies cleanly.
 patch-check:
        rm -rf src-c89 $@.1 $@.2
        cp -a src src-c89
        (cd src-c89; patch -p1 -V never --fuzz=0) < src/c99-to-c89.diff \
          > $@.1 2>&1
-       if test "$$REGEN_PATCH" = yes; then \
+       if test "$(REGEN_PATCH)" = yes; then \
          diff -upr src src-c89 | sed 's,src-c89/,src/,' \
-           | grep -v '^Only in' > new-diff || : ; fi
+           | grep -vE '^(Only in|File )' \
+           | perl -pe 's/^((?:\+\+\+|---) \S+\t).*/$${1}$(epoch_date)/' \
+           > new-diff || : ; fi
        grep -v '^patching file ' $@.1 > $@.2 || :
        msg=ok; test -s $@.2 && msg='fuzzy patch' || : ;        \
        rm -f src-c89/*.o || msg='rm failed';                   \
index 10a4999..ae37d1e 100644 (file)
@@ -1,6 +1,7 @@
---- src/remove.c       2007-07-23 12:56:20.000000000 +0200
-+++ src/remove.c       2007-07-23 13:03:12.000000000 +0200
-@@ -264,9 +264,10 @@ pop_dir (Dirstack_state *ds)
+diff -upr src/remove.c src/remove.c
+--- src/remove.c       1970-01-01 00:00:00.000000000 +0000
++++ src/remove.c       1970-01-01 00:00:00.000000000 +0000
+@@ -262,9 +262,10 @@ pop_dir (Dirstack_state *ds)
  {
    size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
    size_t *length = obstack_base (&ds->len_stack);
@@ -12,7 +13,7 @@
    assert (top_len >= 2);
 
    /* Pop the specified length of file name.  */
-@@ -424,10 +425,11 @@ AD_stack_top (Dirstack_state const *ds)
+@@ -422,10 +423,11 @@ AD_stack_top (Dirstack_state const *ds)
  static void
  AD_stack_pop (Dirstack_state *ds)
  {
@@ -25,7 +26,7 @@
    if (top->unremovable)
      hash_free (top->unremovable);
    obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
-@@ -836,14 +838,13 @@ prompt (int fd_cwd, Dirstack_state const
+@@ -834,14 +836,13 @@ prompt (int fd_cwd, Dirstack_state const
  {
    int write_protected = 0;
    int dirent_type = *pdirent_type;
@@ -41,7 +42,7 @@
    if (!x->ignore_missing_files
        && ((x->interactive == RMI_ALWAYS) || x->stdin_tty)
        && dirent_type != DT_LNK)
-@@ -891,6 +892,7 @@ prompt (int fd_cwd, Dirstack_state const
+@@ -889,6 +890,7 @@ prompt (int fd_cwd, Dirstack_state const
            break;
          }
 
@@ -49,7 +50,7 @@
        char const *quoted_name = quote (full_filename (filename));
 
        if (write_protected < 0)
-@@ -930,6 +932,7 @@ prompt (int fd_cwd, Dirstack_state const
+@@ -928,6 +930,7 @@ prompt (int fd_cwd, Dirstack_state const
                    : _("%s: remove %s %s? ")),
                   program_name, file_type (sbuf), quoted_name);
        }
@@ -57,7 +58,7 @@
 
        if (!yesno ())
        return RM_USER_DECLINED;
-@@ -1549,6 +1552,7 @@ rm_1 (Dirstack_state *ds, char const *fi
+@@ -1547,6 +1550,7 @@ rm_1 (Dirstack_state *ds, char const *fi
        return RM_ERROR;
      }
 
@@ -65,7 +66,7 @@
    struct stat st;
    cache_stat_init (&st);
    cycle_check_init (&ds->cycle_check_state);
-@@ -1571,6 +1575,7 @@ rm_1 (Dirstack_state *ds, char const *fi
+@@ -1569,6 +1573,7 @@ rm_1 (Dirstack_state *ds, char const *fi
    AD_push_initial (ds);
    AD_INIT_OTHER_MEMBERS ();
 
@@ -73,7 +74,7 @@
    enum RM_status status = remove_entry (AT_FDCWD, ds, filename,
                                        DT_UNKNOWN, &st, x);
    if (status == RM_NONEMPTY_DIR)
-@@ -1589,6 +1594,8 @@ rm_1 (Dirstack_state *ds, char const *fi
+@@ -1587,6 +1592,8 @@ rm_1 (Dirstack_state *ds, char const *fi
    ds_clear (ds);
    return status;
  }
@@ -83,9 +84,9 @@
  /* Remove all files and/or directories specified by N_FILES and FILE.
     Apply the options in X.  */
 diff -upr src/rm.c src/rm.c
---- src/rm.c   2007-07-23 12:56:20.000000000 +0200
-+++ src/rm.c   2007-07-23 13:03:12.000000000 +0200
-@@ -357,6 +357,7 @@ main (int argc, char **argv)
+--- src/rm.c   1970-01-01 00:00:00.000000000 +0000
++++ src/rm.c   1970-01-01 00:00:00.000000000 +0000
+@@ -354,6 +354,7 @@ main (int argc, char **argv)
               quote ("/"));
      }
 
@@ -93,7 +94,7 @@ diff -upr src/rm.c src/rm.c
    size_t n_files = argc - optind;
    char const *const *file = (char const *const *) argv + optind;
 
-@@ -370,7 +371,10 @@ main (int argc, char **argv)
+@@ -367,7 +368,10 @@ main (int argc, char **argv)
        if (!yesno ())
        exit (EXIT_SUCCESS);
      }
@@ -105,9 +106,9 @@ diff -upr src/rm.c src/rm.c
 +  }
  }
 diff -upr src/seq.c src/seq.c
---- src/seq.c  2008-04-14 11:17:15.000000000 +0200
-+++ src/seq.c  2008-04-14 11:26:57.000000000 +0200
-@@ -166,6 +166,7 @@ scan_arg (const char *arg)
+--- src/seq.c  1970-01-01 00:00:00.000000000 +0000
++++ src/seq.c  1970-01-01 00:00:00.000000000 +0000
+@@ -163,6 +163,7 @@ scan_arg (const char *arg)
                        : (decimal_point == arg                /* .#  -> 0.# */
                           || ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */
        }
@@ -115,7 +116,7 @@ diff -upr src/seq.c src/seq.c
        char const *e = strchr (arg, 'e');
        if (! e)
        e = strchr (arg, 'E');
-@@ -174,6 +175,7 @@ scan_arg (const char *arg)
+@@ -171,6 +172,7 @@ scan_arg (const char *arg)
          long exponent = strtol (e + 1, NULL, 10);
          ret.precision += exponent < 0 ? -exponent : 0;
        }
@@ -123,7 +124,7 @@ diff -upr src/seq.c src/seq.c
      }
 
    return ret;
-@@ -349,6 +351,7 @@ get_default_format (operand first, opera
+@@ -346,6 +348,7 @@ get_default_format (operand first, opera
          size_t last_width = last.width + (prec - last.precision);
          if (last.precision && prec == 0)
            last_width--;  /* don't include space for '.' */
@@ -131,7 +132,7 @@ diff -upr src/seq.c src/seq.c
          size_t width = MAX (first_width, last_width);
          if (width <= INT_MAX)
            {
-@@ -356,6 +359,7 @@ get_default_format (operand first, opera
+@@ -353,6 +356,7 @@ get_default_format (operand first, opera
              sprintf (format_buf, "%%0%d.%dLf", w, prec);
              return format_buf;
            }
@@ -139,7 +140,7 @@ diff -upr src/seq.c src/seq.c
        }
        else
        {
-@@ -444,6 +448,7 @@ main (int argc, char **argv)
+@@ -441,6 +445,7 @@ main (int argc, char **argv)
    if (format_str)
      {
        validate_format (format_str);
@@ -147,7 +148,7 @@ diff -upr src/seq.c src/seq.c
        char const *f = long_double_format (format_str, &layout);
        if (! f)
        {
-@@ -451,6 +456,7 @@ main (int argc, char **argv)
+@@ -448,6 +453,7 @@ main (int argc, char **argv)
          usage (EXIT_FAILURE);
        }
        format_str = f;
@@ -156,9 +157,9 @@ diff -upr src/seq.c src/seq.c
 
    last = scan_arg (argv[optind++]);
 diff -upr src/shred.c src/shred.c
---- src/shred.c        2007-07-23 12:56:20.000000000 +0200
-+++ src/shred.c        2007-07-23 13:03:12.000000000 +0200
-@@ -461,7 +461,7 @@ dopass (int fd, char const *qname, off_t
+--- src/shred.c        1970-01-01 00:00:00.000000000 +0000
++++ src/shred.c        1970-01-01 00:00:00.000000000 +0000
+@@ -458,7 +458,7 @@ dopass (int fd, char const *qname, off_t
                     out.  Thus, it shouldn't give up on bad blocks.  This
                     code works because lim is always a multiple of
                     SECTOR_SIZE, except at the end.  */