bug-coreutils
[Top][All Lists]
Advanced

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

avoid decl-before-stmt patch


From: Matthew Woehlke
Subject: avoid decl-before-stmt patch
Date: Mon, 23 Mar 2009 14:15:26 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.19) Gecko/20090105 Fedora/2.0.0.19-1.fc10 Thunderbird/2.0.0.19 Mnenhy/0.7.5.0

Here's the patch I used to get my AIX build going. As noted previously, I do not have copyright assignment and am unlikely to be able to obtain it. (I'd also argue that - given that a trained monkey could produce this patch - it shouldn't be needed for this, but IANAL :-).)

(Note: this would be unneeded for this platform - though still needed for sparc/Solaris as I can't find* a c99 compiler for that platform - if configure wasn't screwy. Specifically it decides to use -qlanglvl=ansi to gain c89 support, which subsequently prevents it from using the better -qlanglvl=stdc99. Maybe the c99 check should be done first?)

(* no I am not going to attempt to build gcc)

--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
"There's nothing in the universe so permanent as a temporary government agency." -- Phil Geusz
diff -ru src/copy.c src/copy.c
--- src/copy.c  2009-03-21 01:32:32.000000000 -0800
+++ src/copy.c  2009-03-23 09:48:23.000000000 -0800
@@ -2186,6 +2186,7 @@
       bool nonexistent_dst, const struct cp_options *options,
       bool *copy_into_self, bool *rename_succeeded)
 {
+  bool first_dir_created_per_command_line_arg = false;
   assert (valid_options (options));
 
   /* Record the file names: they're used in case of error, when copying
@@ -2198,7 +2199,6 @@
   top_level_src_name = src_name;
   top_level_dst_name = dst_name;
 
-  bool first_dir_created_per_command_line_arg = false;
   return copy_internal (src_name, dst_name, nonexistent_dst, 0, NULL,
                        options, true,
                        &first_dir_created_per_command_line_arg,
diff -ru src/du.c src/du.c
--- src/du.c    2009-03-21 01:32:32.000000000 -0800
+++ src/du.c    2009-03-23 10:25:29.000000000 -0800
@@ -916,6 +916,7 @@
         }
     }
 
+  {
   struct argv_iterator *ai;
   if (files_from)
     {
@@ -948,6 +949,7 @@
   hash_init ();
 
   bit_flags |= symlink_deref_bits;
+  {
   static char *temp_argv[] = { NULL, NULL };
 
   while (true)
@@ -1028,3 +1030,5 @@
 
   exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
 }
+}
+}
diff -ru src/ls.c src/ls.c
--- src/ls.c    2009-03-21 01:32:32.000000000 -0800
+++ src/ls.c    2009-03-23 10:56:53.000000000 -0800
@@ -3642,6 +3642,7 @@
     }
 
   DIRED_FPUTS (buf, stdout, p - buf);
+  {
   size_t w = print_name_with_quoting (f->name, FILE_OR_LINK_MODE (f), 
f->linkok,
                                      f->stat_ok, f->filetype, &dired_obstack,
                                      f->stat.st_nlink, p - buf);
@@ -3660,6 +3661,7 @@
     }
   else if (indicator_style != none)
     print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype);
+  }
 }
 
 /* Output to OUT a quoted representation of the file name NAME,
@@ -3834,6 +3836,7 @@
                         struct obstack *stack, nlink_t nlink,
                         size_t start_col)
 {
+  size_t width;
   bool used_color_this_time
     = (print_with_color
        && print_color_indicator (p, mode, linkok, stat_ok, type, nlink));
@@ -3841,7 +3844,7 @@
   if (stack)
     PUSH_CURRENT_DIRED_POS (stack);
 
-  size_t width = quote_name (stdout, p, filename_quoting_options, NULL);
+  width = quote_name (stdout, p, filename_quoting_options, NULL);
   dired_pos += width;
 
   if (stack)
@@ -3879,6 +3882,7 @@
 print_file_name_and_frills (const struct fileinfo *f, size_t start_col)
 {
   char buf[MAX (LONGEST_HUMAN_READABLE + 1, INT_BUFSIZE_BOUND (uintmax_t))];
+  size_t width;
 
   if (print_inode)
     printf ("%*s ", format == with_commas ? 0 : inode_number_width,
@@ -3892,7 +3896,7 @@
   if (print_scontext)
     printf ("%*s ", format == with_commas ? 0 : scontext_width, f->scontext);
 
-  size_t width = print_name_with_quoting (f->name, FILE_OR_LINK_MODE (f),
+  width = print_name_with_quoting (f->name, FILE_OR_LINK_MODE (f),
                                          f->linkok, f->stat_ok, f->filetype,
                                          NULL, f->stat.st_nlink, start_col);
 
diff -ru src/remove.c src/remove.c
--- src/remove.c        2009-03-21 01:32:32.000000000 -0800
+++ src/remove.c        2009-03-23 09:47:09.000000000 -0800
@@ -284,9 +284,10 @@
 {
   size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
   size_t *length = obstack_base (&ds->len_stack);
+  size_t top_len;
 
   assert (n_lengths > 0);
-  size_t top_len = length[n_lengths - 1];
+  top_len = length[n_lengths - 1];
   assert (top_len >= 2);
 
   /* Pop the specified length of file name.  */
@@ -444,10 +445,11 @@
 static void
 AD_stack_pop (Dirstack_state *ds)
 {
+  struct AD_ent *top;
   assert (0 < AD_stack_height (ds));
 
   /* operate on Active_dir.  pop and free top entry */
-  struct AD_ent *top = AD_stack_top (ds);
+  top = AD_stack_top (ds);
   if (top->unremovable)
     hash_free (top->unremovable);
   obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
@@ -873,14 +875,13 @@
 {
   int write_protected = 0;
   int dirent_type = *pdirent_type;
+  int wp_errno = 0;
 
   *is_empty = T_UNKNOWN;
 
   if (x->interactive == RMI_NEVER)
     return RM_OK;
 
-  int wp_errno = 0;
-
   if (!x->ignore_missing_files
       && ((x->interactive == RMI_ALWAYS) || x->stdin_tty)
       && dirent_type != DT_LNK)
@@ -928,6 +929,7 @@
            break;
          }
 
+      {
       char const *quoted_name = quote (full_filename (filename));
 
       if (write_protected < 0)
@@ -967,6 +969,7 @@
                    : _("%s: remove %s %s? ")),
                   program_name, file_type (sbuf), quoted_name);
        }
+      }
 
       if (!yesno ())
        return RM_USER_DECLINED;
@@ -1772,6 +1775,7 @@
       return RM_ERROR;
     }
 
+  {
   struct stat st;
   cache_stat_init (&st);
   cycle_check_init (&ds->cycle_check_state);
@@ -1794,6 +1798,7 @@
   AD_push_initial (ds);
   AD_INIT_OTHER_MEMBERS ();
 
+  {
   enum RM_status status = remove_entry (AT_FDCWD, ds, filename,
                                        DT_UNKNOWN, &st, x);
   if (status == RM_NONEMPTY_DIR)
@@ -1812,6 +1817,8 @@
   ds_clear (ds);
   return status;
 }
+  }
+}
 
 /* Remove all files and/or directories specified by N_FILES and FILE.
    Apply the options in X.  */
diff -ru src/rm.c src/rm.c
--- src/rm.c    2009-03-21 01:32:32.000000000 -0800
+++ src/rm.c    2009-03-23 09:47:09.000000000 -0800
@@ -353,6 +353,7 @@
               quote ("/"));
     }
 
+  {
   size_t n_files = argc - optind;
   char const *const *file = (char const *const *) argv + optind;
 
@@ -366,7 +367,10 @@
       if (!yesno ())
        exit (EXIT_SUCCESS);
     }
+  {
   enum RM_status status = rm (n_files, file, &x);
   assert (VALID_STATUS (status));
   exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
+  }
+  }
 }
diff -ru src/seq.c src/seq.c
--- src/seq.c   2009-03-21 01:32:32.000000000 -0800
+++ src/seq.c   2009-03-23 11:02:48.000000000 -0800
@@ -161,6 +161,7 @@
                        : (decimal_point == arg                /* .#  -> 0.# */
                           || ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */
        }
+      {
       char const *e = strchr (arg, 'e');
       if (! e)
        e = strchr (arg, 'E');
@@ -169,6 +170,7 @@
          long exponent = strtol (e + 1, NULL, 10);
          ret.precision += exponent < 0 ? -exponent : 0;
        }
+      }
     }
 
   return ret;
@@ -315,11 +317,12 @@
          size_t first_width = first.width + (prec - first.precision);
          /* adjust last_width to use precision from first/step */
          size_t last_width = last.width + (prec - last.precision);
+          size_t width;
          if (last.precision && prec == 0)
            last_width--;  /* don't include space for '.' */
          if (last.precision == 0 && prec)
            last_width++;  /* include space for '.' */
-         size_t width = MAX (first_width, last_width);
+         width = MAX (first_width, last_width);
          if (width <= INT_MAX)
            {
              int w = width;
diff -ru src/shred.c src/shred.c
--- src/shred.c 2009-03-21 01:32:32.000000000 -0800
+++ src/shred.c 2009-03-23 09:47:09.000000000 -0800
@@ -468,7 +468,7 @@
                     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.  */
-                 verify (sizeof r % SECTOR_SIZE == 0);
+                 { verify (sizeof r % SECTOR_SIZE == 0); }
                  if (errnum == EIO && 0 <= size && (soff | SECTOR_MASK) < lim)
                    {
                      size_t soff1 = (soff | SECTOR_MASK) + 1;
diff -ru src/sort.c src/sort.c
--- src/sort.c  2009-03-21 01:32:32.000000000 -0800
+++ src/sort.c  2009-03-23 10:58:58.000000000 -0800
@@ -2718,6 +2718,7 @@
         file with our spare file descriptor.  Retry if that failed
         (e.g., some other process could open a file between the time
         we closed and tried to create).  */
+      {
       FILE *tfp;
       pid_t pid;
       char *temp;
@@ -2738,6 +2739,7 @@
       memmove (&files[1], &files[nopened], (nfiles - nopened) * sizeof *files);
       ntemps++;
       nfiles -= nopened - 1;
+      }
     }
 }
 
diff -ru src/wc.c src/wc.c
--- src/wc.c    2009-03-21 01:32:32.000000000 -0800
+++ src/wc.c    2009-03-23 11:00:34.000000000 -0800
@@ -641,6 +641,7 @@
         | print_linelength))
     print_lines = print_words = print_bytes = true;
 
+  {
   bool read_tokens = false;
   struct argv_iterator *ai;
   if (files_from)
@@ -669,6 +670,7 @@
 
       /* Read the file list into RAM if we can detect its size and that
         size is reasonable.  Otherwise, we'll read a name at a time.  */
+      {
       struct stat st;
       if (fstat (fileno (stream), &st) == 0
          && S_ISREG (st.st_mode)
@@ -689,6 +691,7 @@
          nfiles = 0;
          ai = argv_iter_init_stream (stream);
        }
+      }
     }
   else
     {
@@ -701,6 +704,7 @@
   fstatus = get_input_fstatus (nfiles, files);
   number_width = compute_number_width (nfiles, fstatus);
 
+  {
   int i;
   ok = true;
   for (i = 0; /* */; i++)
@@ -781,4 +785,6 @@
     error (EXIT_FAILURE, errno, "-");
 
   exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
+  }
+  }
 }

reply via email to

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