Subject: Compilation problems with coreutils-8.9

From: Rob McMahon <[email-masked]>
Date: Fri, 26 Aug 2011 15:58:25 +0100

I suspect you're going to say "upgrade to a more modern compiler" for 
most of these patches, but I had cause to install a later coreutils on 
an old box where this is not a viable option, running

cc: Sun WorkShop 6 update 2 C 5.3 Patch 111679-12 2003/05/18

There are many uses of later C compilers to accept declarations 
intermingled with statements, which are not supported by this compiler.  
The attached diffs fix all these problems.  Many of them are just 
swapping a couple of lines, which is probably worth it in the interests 
of compatibility.

Rob

-- 
E-Mail:	[email-masked]		PHONE:  +44 24 7652 3037
Rob McMahon, IT Services, Warwick University, Coventry, CV4 7AL, England

diff -ru1 dist/coreutils-8.9/lib/heap.c coreutils-8.9/lib/heap.c
--- dist/coreutils-8.9/lib/heap.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/lib/heap.c	2011-08-25 10:19:13.940953000 +0100
@@ -95,2 +95,4 @@
 {
+  void *top;
+
   if (heap->count == 0)
@@ -98,3 +100,3 @@
 
-  void *top = heap->array[1];
+  top = heap->array[1];
   heap->array[1] = heap->array[heap->count--];
diff -ru1 dist/coreutils-8.9/src/chroot.c coreutils-8.9/src/chroot.c
--- dist/coreutils-8.9/src/chroot.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/chroot.c	2011-08-25 10:24:47.462712000 +0100
@@ -153,2 +153,3 @@
   char const *groups = NULL;
+  bool fail;
 
@@ -213,3 +214,3 @@
 
-  bool fail = false;
+  fail = false;
 
diff -ru1 dist/coreutils-8.9/src/copy.c coreutils-8.9/src/copy.c
--- dist/coreutils-8.9/src/copy.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/copy.c	2011-08-25 10:26:23.581904000 +0100
@@ -2278,2 +2278,3 @@
 {
+  bool first_dir_created_per_command_line_arg;
   assert (valid_options (options));
@@ -2290,3 +2291,3 @@
 
-  bool first_dir_created_per_command_line_arg = false;
+  first_dir_created_per_command_line_arg = false;
   return copy_internal (src_name, dst_name, nonexistent_dst, 0, NULL,
diff -ru1 dist/coreutils-8.9/src/csplit.c coreutils-8.9/src/csplit.c
--- dist/coreutils-8.9/src/csplit.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/csplit.c	2011-08-25 11:21:12.885525000 +0100
@@ -1202,4 +1202,5 @@
   int flags = 0;
+  size_t count;
 
-  for (size_t count = 0; ; count++)
+  for (count = 0; ; count++)
     {
@@ -1277,6 +1278,9 @@
   bool percent = false;
+  char *f;
+  int maxlen;
 
-  for (char *f = format; *f; f++)
+  for (f = format; *f; f++)
     if (*f == '%' && *++f != '%')
       {
+        int flags;
         if (percent)
@@ -1285,3 +1289,2 @@
         percent = true;
-        int flags;
         f += get_format_flags (f, &flags);
@@ -1299,3 +1302,3 @@
 
-  int maxlen = snprintf (NULL, 0, format, UINT_MAX);
+  maxlen = snprintf (NULL, 0, format, UINT_MAX);
   if (! (0 <= maxlen && maxlen <= SIZE_MAX))
@@ -1374,2 +1377,3 @@
 
+  {
   size_t prefix_len = strlen (prefix);
@@ -1382,2 +1386,3 @@
   filename_space = xmalloc (prefix_len + max_digit_string_len + 1);
+  }
 
diff -ru1 dist/coreutils-8.9/src/dd.c coreutils-8.9/src/dd.c
--- dist/coreutils-8.9/src/dd.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/dd.c	2011-08-25 10:59:44.159093000 +0100
@@ -842,2 +842,4 @@
       int old_flags = fcntl (STDOUT_FILENO, F_GETFL);
+      off_t off;
+
       if (fcntl (STDOUT_FILENO, F_SETFL, old_flags & ~O_DIRECT) != 0)
@@ -851,3 +853,3 @@
          posix_fadvise failure. */
-      off_t off = lseek (STDOUT_FILENO, 0, SEEK_CUR);
+      off = lseek (STDOUT_FILENO, 0, SEEK_CUR);
       if (0 <= off)
diff -ru1 dist/coreutils-8.9/src/du.c coreutils-8.9/src/du.c
--- dist/coreutils-8.9/src/du.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/du.c	2011-08-25 11:44:24.472799000 +0100
@@ -432,4 +432,5 @@
             {
+              FTSENT const *e;
               fts_set (fts, ent, FTS_AGAIN);
-              FTSENT const *e = fts_read (fts);
+              e = fts_read (fts);
               assert (e == ent);
@@ -455,4 +456,5 @@
             {
+              FTSENT const *e;
               fts_set (fts, ent, FTS_SKIP);
-              FTSENT const *e = fts_read (fts);
+              e = fts_read (fts);
               assert (e == ent);
@@ -623,2 +625,5 @@
 
+  static char *temp_argv[] = { NULL, NULL };
+  struct argv_iterator *ai;
+
   cwd_only[0] = bad_cast (".");
@@ -866,3 +871,2 @@
 
-  struct argv_iterator *ai;
   if (files_from)
@@ -914,3 +918,2 @@
   bit_flags |= symlink_deref_bits;
-  static char *temp_argv[] = { NULL, NULL };
 
diff -ru1 dist/coreutils-8.9/src/expr.c coreutils-8.9/src/expr.c
--- dist/coreutils-8.9/src/expr.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/expr.c	2011-08-25 11:23:09.719524000 +0100
@@ -118,4 +118,4 @@
 {
-  (void) str; (void) base;
   char buf[INT_BUFSIZE_BOUND (intmax_t)];
+  (void) str; (void) base;
   return xstrdup (imaxtostr (z[0], buf));
@@ -140,4 +140,4 @@
 {
-  (void) base;
   char buf[INT_BUFSIZE_BOUND (intmax_t)];
+  (void) base;
   return fputs (imaxtostr (z[0], buf), stream) != EOF;
diff -ru1 dist/coreutils-8.9/src/getlimits.c coreutils-8.9/src/getlimits.c
--- dist/coreutils-8.9/src/getlimits.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/getlimits.c	2011-08-25 11:32:51.328096000 +0100
@@ -90,2 +90,4 @@
   char *p = absnum + strlen (absnum);
+  char *result;
+
   absnum[-1] = '0';
@@ -94,3 +96,3 @@
   ++*p;
-  char *result = MIN (absnum, p);
+  result = MIN (absnum, p);
   if (negative)
diff -ru1 dist/coreutils-8.9/src/join.c coreutils-8.9/src/join.c
--- dist/coreutils-8.9/src/join.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/join.c	2011-08-25 11:04:36.004207000 +0100
@@ -713,2 +713,3 @@
 
+  {
   /* If the user did not specify --check-order, then we read the
@@ -754,2 +755,3 @@
   free (line);
+  }
 
diff -ru1 dist/coreutils-8.9/src/ls.c coreutils-8.9/src/ls.c
--- dist/coreutils-8.9/src/ls.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/ls.c	2011-08-25 11:47:04.872791000 +0100
@@ -1034,9 +1034,10 @@
 #ifdef HAVE_NL_LANGINFO
-  required_mon_width = MAX_MON_WIDTH;
   size_t curr_max_width;
+  required_mon_width = MAX_MON_WIDTH;
   do
     {
+      int i;
       curr_max_width = required_mon_width;
       required_mon_width = 0;
-      for (int i = 0; i < 12; i++)
+      for (i = 0; i < 12; i++)
         {
@@ -3464,2 +3465,4 @@
   const char *pb;
+  size_t ret;
+
   if (required_mon_width && (pb = strstr (fmt, "%b")))
@@ -3476,3 +3479,3 @@
     }
-  size_t ret = nstrftime (buf, size, nfmt, tm, __utc, __ns);
+  ret = nstrftime (buf, size, nfmt, tm, __utc, __ns);
   return ret;
@@ -3623,3 +3626,3 @@
      ];
-  size_t s;
+  size_t s, w;
   char *p;
@@ -3813,3 +3816,3 @@
   DIRED_FPUTS (buf, stdout, p - buf);
-  size_t w = print_name_with_quoting (f, false, &dired_obstack, p - buf);
+  w = print_name_with_quoting (f, false, &dired_obstack, p - buf);
 
@@ -4001,2 +4004,3 @@
 {
+  size_t width;
   const char* name = symlink_target ? f->linkname : f->name;
@@ -4011,3 +4015,3 @@
 
-  size_t width = quote_name (stdout, name, filename_quoting_options, NULL);
+  width = quote_name (stdout, name, filename_quoting_options, NULL);
   dired_pos += width;
@@ -4049,2 +4053,3 @@
   char buf[MAX (LONGEST_HUMAN_READABLE + 1, INT_BUFSIZE_BOUND (uintmax_t))];
+  size_t width;
 
@@ -4065,3 +4070,3 @@
 
-  size_t width = print_name_with_quoting (f, false, NULL, start_col);
+  width = print_name_with_quoting (f, false, NULL, start_col);
 
diff -ru1 dist/coreutils-8.9/src/nproc.c coreutils-8.9/src/nproc.c
--- dist/coreutils-8.9/src/nproc.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/nproc.c	2011-08-25 11:06:38.550677000 +0100
@@ -78,2 +78,4 @@
   unsigned long nproc, ignore = 0;
+  enum nproc_query mode;
+
   initialize_main (&argc, &argv);
@@ -86,3 +88,3 @@
 
-  enum nproc_query mode = NPROC_CURRENT_OVERRIDABLE;
+  mode = NPROC_CURRENT_OVERRIDABLE;
 
diff -ru1 dist/coreutils-8.9/src/od.c coreutils-8.9/src/od.c
--- dist/coreutils-8.9/src/od.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/od.c	2011-08-25 11:24:52.628883000 +0100
@@ -594,2 +594,4 @@
   int field_width;
+  struct lconv const *locale;
+  size_t decimal_point_len;
 
@@ -773,4 +775,4 @@
 
-      struct lconv const *locale = localeconv ();
-      size_t decimal_point_len =
+      locale = localeconv ();
+      decimal_point_len =
         (locale->decimal_point[0] ? strlen (locale->decimal_point) : 1);
diff -ru1 dist/coreutils-8.9/src/remove.c coreutils-8.9/src/remove.c
--- dist/coreutils-8.9/src/remove.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/remove.c	2011-08-25 12:00:00.112933000 +0100
@@ -173,2 +173,4 @@
        native or /proc/self/fd allows us to skip a chdir.  */
+    size_t file_name_len;
+
     if (!openat_needs_fchdir ())
@@ -182,3 +184,3 @@
     /* This implements #5: */
-    size_t file_name_len = strlen (full_name);
+    file_name_len = strlen (full_name);
 
@@ -221,11 +223,12 @@
   char const *filename = ent->fts_accpath;
-  if (is_empty_p)
-    *is_empty_p = T_UNKNOWN;
-
   struct stat st;
   struct stat *sbuf = &st;
-  cache_stat_init (sbuf);
-
   int dirent_type = is_dir ? DT_DIR : DT_UNKNOWN;
   int write_protected = 0;
+  int wp_errno = 0;
+
+  if (is_empty_p)
+    *is_empty_p = T_UNKNOWN;
+
+  cache_stat_init (sbuf);
 
@@ -240,3 +243,2 @@
 
-  int wp_errno = 0;
   if (!x->ignore_missing_files
@@ -252,2 +254,5 @@
     {
+      char const *quoted_name;
+      bool is_empty;
+
       if (0 <= write_protected && dirent_type == DT_UNKNOWN)
@@ -288,3 +293,3 @@
 
-      char const *quoted_name = quote (full_name);
+      quoted_name = quote (full_name);
 
@@ -296,3 +301,2 @@
 
-      bool is_empty;
       if (is_empty_p)
@@ -545,2 +549,4 @@
       {
+	bool is_dir;
+	enum RM_status s;
         /* With --one-file-system, do not attempt to remove a mount point.
@@ -559,4 +565,4 @@
 
-        bool is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR;
-        enum RM_status s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL);
+        is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR;
+        s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL);
         if (s != RM_OK)
@@ -601,2 +607,4 @@
                        | FTS_PHYSICAL);
+      FTS *fts;
+      enum RM_status s;
 
@@ -605,3 +613,3 @@
 
-      FTS *fts = xfts_open (file, bit_flags, NULL);
+      fts = xfts_open (file, bit_flags, NULL);
 
@@ -622,3 +630,3 @@
 
-          enum RM_status s = rm_fts (fts, ent, x);
+          s = rm_fts (fts, ent, x);
 
diff -ru1 dist/coreutils-8.9/src/rm.c coreutils-8.9/src/rm.c
--- dist/coreutils-8.9/src/rm.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/rm.c	2011-08-25 11:09:19.854004000 +0100
@@ -328,4 +328,6 @@
 
+  {
   size_t n_files = argc - optind;
   char **file =  argv + optind;
+  enum RM_status status;
 
@@ -342,5 +344,6 @@
 
-  enum RM_status status = rm (file, &x);
+  status = rm (file, &x);
   assert (VALID_STATUS (status));
   exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
+  }
 }
diff -ru1 dist/coreutils-8.9/src/seq.c coreutils-8.9/src/seq.c
--- dist/coreutils-8.9/src/seq.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/seq.c	2011-08-25 11:25:38.840888000 +0100
@@ -149,2 +149,3 @@
     {
+      char const *e;
       char const *decimal_point = strchr (arg, '.');
@@ -162,3 +163,3 @@
         }
-      char const *e = strchr (arg, 'e');
+      e = strchr (arg, 'e');
       if (! e)
@@ -316,2 +317,4 @@
           size_t last_width = last.width + (prec - last.precision);
+	  size_t width;
+
           if (last.precision && prec == 0)
@@ -320,3 +323,3 @@
             last_width++;  /* include space for '.' */
-          size_t width = MAX (first_width, last_width);
+          width = MAX (first_width, last_width);
           if (width <= INT_MAX)
diff -ru1 dist/coreutils-8.9/src/shred.c coreutils-8.9/src/shred.c
--- dist/coreutils-8.9/src/shred.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/shred.c	2011-08-25 11:29:19.408081000 +0100
@@ -470,3 +470,3 @@
                      SECTOR_SIZE, except at the end.  */
-                  verify (sizeof r % SECTOR_SIZE == 0);
+                  verify_true (sizeof r % SECTOR_SIZE == 0);
                   if (errnum == EIO && 0 <= size && (soff | SECTOR_MASK) < lim)
diff -ru1 dist/coreutils-8.9/src/sort.c coreutils-8.9/src/sort.c
--- dist/coreutils-8.9/src/sort.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/sort.c	2011-08-25 12:11:46.492528000 +0100
@@ -730,5 +730,6 @@
   struct tempnode test;
+  struct tempnode *node;
 
   test.pid = pid;
-  struct tempnode *node = hash_delete (proctab, &test);
+  node = hash_delete (proctab, &test);
   if (! node)
@@ -1116,2 +1117,3 @@
   FILE *fp = NULL;
+  pid_t child;
 
@@ -1124,3 +1126,3 @@
 
-  pid_t child = pipe_fork (pipefds, MAX_FORK_TRIES_DECOMPRESS);
+  child = pipe_fork (pipefds, MAX_FORK_TRIES_DECOMPRESS);
 
@@ -1880,2 +1882,4 @@
 {
+  int diff;
+
   while (blanks[to_uchar (*a)])
@@ -1885,3 +1889,3 @@
 
-  int diff = find_unit_order (a) - find_unit_order (b);
+  diff = find_unit_order (a) - find_unit_order (b);
   return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep));
@@ -1999,4 +2003,6 @@
 {
+  size_t translated_size;
+
   errno = 0;
-  size_t translated_size = strxfrm (dest, src, destsize);
+  translated_size = strxfrm (dest, src, destsize);
 
@@ -2027,3 +2033,3 @@
   int xfrm_diff = 0;
-
+  int diff;
   char stackbuf[4000];
@@ -2059,2 +2065,5 @@
           size_t guess_bufsize = 3 * (lena + lenb) + 2;
+	  size_t sizea, sizeb;
+	  bool a_fits;
+
           if (bufsize < guess_bufsize)
@@ -2071,6 +2080,6 @@
 
-          size_t sizea =
+          sizea =
             (texta < lima ? xstrxfrm (buf, texta, bufsize) + 1 : 0);
-          bool a_fits = sizea <= bufsize;
-          size_t sizeb =
+          a_fits = sizea <= bufsize;
+          sizeb =
             (textb < limb
@@ -2127,3 +2136,3 @@
   md5_process_bytes (textb, lenb, &s[1]); md5_finish_ctx (&s[1], dig[1]);
-  int diff = memcmp (dig[0], dig[1], sizeof dig[0]);
+  diff = memcmp (dig[0], dig[1], sizeof dig[0]);
 
@@ -2198,2 +2207,3 @@
   char *lim = text + line->length - 1;
+  size_t offset, width;
 
@@ -2208,2 +2218,3 @@
         {
+          char *tighter_lim;
           char saved = *lim;
@@ -2214,3 +2225,3 @@
 
-          char *tighter_lim = beg;
+          tighter_lim = beg;
 
@@ -2248,4 +2259,4 @@
 
-  size_t offset = debug_width (text, beg);
-  size_t width = debug_width (beg, lim);
+  offset = debug_width (text, beg);
+  width = debug_width (beg, lim);
   mark_key (offset, width);
@@ -2323,2 +2334,6 @@
     {
+      bool implicit_skip;
+      bool maybe_space_aligned;
+      bool line_offset;
+
       if (key->obsolete_used)
@@ -2357,6 +2372,6 @@
       /* Warn about significant leading blanks.  */
-      bool implicit_skip = key_numeric (key) || key->month;
-      bool maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key)
+      implicit_skip = key_numeric (key) || key->month;
+      maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key)
                                  && !(key->schar || key->echar);
-      bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y  */
+      line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y  */
       if (!gkey_only && tab == TAB_DEFAULT && !line_offset
@@ -2404,6 +2419,7 @@
       bool ugkey_reverse = ugkey.reverse;
-      if (!(stable || unique))
-        ugkey.reverse = false;
       /* The following is too big, but guaranteed to be "big enough".  */
       char opts[sizeof short_options];
+
+      if (!(stable || unique))
+        ugkey.reverse = false;
       key_to_opts (&ugkey, opts);
@@ -2440,2 +2456,3 @@
       bool const *ignore = key->ignore;
+      size_t lena, lenb;
 
@@ -2446,4 +2463,4 @@
       /* Find the lengths. */
-      size_t lena = lima - texta;
-      size_t lenb = limb - textb;
+      lena = lima - texta;
+      lenb = limb - textb;
 
@@ -3116,2 +3133,4 @@
       struct line *hi = lines - nlo;
+      struct line *dest;
+      struct line const *sorted_lo;
 
@@ -3123,4 +3142,2 @@
 
-      struct line *dest;
-      struct line const *sorted_lo;
       if (to_temp)
@@ -3477,3 +3494,3 @@
   /* Number of lines in LINES and DEST.  */
-  size_t const total_lines;
+  size_t total_lines;
 
@@ -3722,2 +3739,4 @@
       size_t nopened = open_input_files (files, nfiles, &fps);
+      FILE *tfp;
+      struct tempnode *temp;
 
@@ -3742,4 +3761,2 @@
          we closed and tried to create).  */
-      FILE *tfp;
-      struct tempnode *temp;
       do
@@ -3838,6 +3855,8 @@
               struct merge_node_queue queue;
+	      struct merge_node *merge_tree;
+	      struct merge_node *root;
+
               queue_init (&queue, nthreads);
-              struct merge_node *merge_tree =
-                merge_tree_init (nthreads, buf.nlines, line);
-              struct merge_node *root = merge_tree + 1;
+              merge_tree = merge_tree_init (nthreads, buf.nlines, line);
+              root = merge_tree + 1;
 
@@ -4608,2 +4627,4 @@
     {
+      size_t nthreads_max;
+
       if (!nthreads)
@@ -4615,3 +4636,3 @@
       /* Avoid integer overflow later.  */
-      size_t nthreads_max = SIZE_MAX / (2 * sizeof (struct merge_node));
+      nthreads_max = SIZE_MAX / (2 * sizeof (struct merge_node));
       nthreads = MIN (nthreads, nthreads_max);
diff -ru1 dist/coreutils-8.9/src/split.c coreutils-8.9/src/split.c
--- dist/coreutils-8.9/src/split.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/split.c	2011-08-25 11:30:28.566248000 +0100
@@ -454,7 +454,5 @@
 {
-  assert (n && k <= n && n <= file_size);
-
-  const off_t chunk_size = file_size / n;
+  off_t chunk_size;
   uintmax_t chunk_no = 1;
-  off_t chunk_end = chunk_size - 1;
+  off_t chunk_end;
   off_t n_written = 0;
@@ -462,2 +460,7 @@
 
+  assert (n && k <= n && n <= file_size);
+
+  chunk_size = file_size / n;
+  chunk_end = chunk_size - 1;
+
   if (k > 1)
diff -ru1 dist/coreutils-8.9/src/stat.c coreutils-8.9/src/stat.c
--- dist/coreutils-8.9/src/stat.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/stat.c	2011-08-25 12:02:51.677107000 +0100
@@ -544,2 +544,6 @@
   int precision = 0;
+  int divisor;
+  int frac_sec;
+  int int_len;
+  int i;
   bool frac_left_adjust = false;
@@ -566,2 +570,3 @@
              later.  */
+	  long int lwidth;
           char *p = dot;
@@ -573,3 +578,3 @@
 
-          long int lwidth = strtol (p, NULL, 10);
+          lwidth = strtol (p, NULL, 10);
           width = (lwidth <= INT_MAX ? lwidth : INT_MAX);
@@ -577,5 +582,7 @@
             {
+	      int w_d;
+
               p += (*p == '0');
               sec_prefix_len = p - pformat;
-              int w_d = (decimal_point_len < width
+              w_d = (decimal_point_len < width
                          ? width - decimal_point_len
@@ -588,3 +595,4 @@
                       char *dst = pformat;
-                      for (char const *src = dst; src < p; src++)
+		      char const *src;
+                      for (src = dst; src < p; src++)
                         {
@@ -604,7 +612,7 @@
 
-  int divisor = 1;
-  for (int i = precision; i < 9; i++)
+  divisor = 1;
+  for (i = precision; i < 9; i++)
     divisor *= 10;
-  int frac_sec = arg.tv_nsec / divisor;
-  int int_len;
+  frac_sec = arg.tv_nsec / divisor;
+  int_len;
 
@@ -759,2 +767,3 @@
   char const * bind_mount = NULL;
+  struct mount_entry *me;
 
@@ -769,3 +778,2 @@
 
-  struct mount_entry *me;
   for (me = mount_list; me; me = me->me_next)
@@ -844,6 +852,7 @@
 {
+  struct timespec z = {0, 0};
   if (0 <= ts.tv_nsec)
     return ts;
-  struct timespec z = {0, 0};
-  return z;
+  else
+    return z;
 }
@@ -1055,2 +1064,3 @@
           {
+	    unsigned int fmt_code;
             size_t len = strspn (b + 1, printf_flags);
@@ -1061,3 +1071,3 @@
             len = fmt_char - (b + 1);
-            unsigned int fmt_code = *fmt_char;
+            fmt_code = *fmt_char;
             memcpy (dest, b, len + 1);
@@ -1149,2 +1159,3 @@
   STRUCT_STATVFS statfsbuf;
+  bool fail;
 
@@ -1164,3 +1175,3 @@
 
-  bool fail = print_it (format, filename, print_statfs, &statfsbuf);
+  fail = print_it (format, filename, print_statfs, &statfsbuf);
   return ! fail;
@@ -1174,2 +1185,3 @@
   struct stat statbuf;
+  bool fail;
 
@@ -1197,3 +1209,3 @@
 
-  bool fail = print_it (format, filename, print_stat, &statbuf);
+  fail = print_it (format, filename, print_stat, &statbuf);
   return ! fail;
@@ -1400,2 +1412,3 @@
   bool ok = true;
+  struct lconv const *locale;
 
@@ -1407,3 +1420,3 @@
 
-  struct lconv const *locale = localeconv ();
+  locale = localeconv ();
   decimal_point = (locale->decimal_point[0] ? locale->decimal_point : ".");
diff -ru1 dist/coreutils-8.9/src/system.h coreutils-8.9/src/system.h
--- dist/coreutils-8.9/src/system.h	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/system.h	2011-08-25 10:23:36.641538000 +0100
@@ -595,2 +595,4 @@
 {
+  const char *lc_messages;
+
   printf (_("\nReport %s bugs to %s\n"), last_component (program_name),
@@ -604,3 +606,3 @@
      Note we still output for 'C' so that it gets included in the man page.  */
-  const char *lc_messages = setlocale (LC_MESSAGES, NULL);
+  lc_messages = setlocale (LC_MESSAGES, NULL);
   if (lc_messages && strncmp (lc_messages, "en_", 3))
diff -ru1 dist/coreutils-8.9/src/wc.c coreutils-8.9/src/wc.c
--- dist/coreutils-8.9/src/wc.c	2011-01-01 21:19:23.000000000 +0000
+++ coreutils-8.9/src/wc.c	2011-08-25 11:42:53.969485000 +0100
@@ -592,4 +592,6 @@
   bool ok;
+  bool read_tokens;
   int optc;
   int nfiles;
+  int i;
   char **files;
@@ -598,2 +600,3 @@
   struct Tokens tok;
+  struct argv_iterator *ai;
 
@@ -654,4 +657,3 @@
 
-  bool read_tokens = false;
-  struct argv_iterator *ai;
+  read_tokens = false;
   if (files_from)
@@ -659,2 +661,3 @@
       FILE *stream;
+      struct stat st;
 
@@ -682,3 +685,2 @@
          size is reasonable.  Otherwise, we'll read a name at a time.  */
-      struct stat st;
       if (fstat (fileno (stream), &st) == 0
@@ -714,3 +716,2 @@
 
-  int i;
   ok = true;