]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: revert -Wmaybe-uninitialized warnings avoidance
authorPádraig Brady <P@draigBrady.com>
Fri, 19 May 2023 06:57:36 +0000 (07:57 +0100)
committerPádraig Brady <P@draigBrady.com>
Fri, 19 May 2023 08:58:50 +0000 (09:58 +0100)
This reverts commit 800c86d5, as that was deemed too invasive.
We do keep the change to tee.c to allow using -O3 without warnings.
For other optimization options like -O0, -Og, -O1, -Os,
one can use WERROR_CFLAGS= to stop warnings inducing a build failure.

src/copy.c
src/cp.c
src/digest.c
src/head.c
src/ln.c
src/paste.c
src/pr.c
src/sort.c

index 6b2cf3b29a1596724af2c57563328e81694db874..0dd059d2e437f88d650bb7ce5b0239dab589d831 100644 (file)
@@ -1238,8 +1238,8 @@ copy_reg (char const *src_name, char const *dst_name,
           struct stat const *src_sb)
 {
   char *buf = NULL;
-  int dest_desc IF_LINT ( = -1);
-  int dest_errno IF_LINT ( = 0);
+  int dest_desc;
+  int dest_errno;
   int source_desc;
   mode_t src_mode = src_sb->st_mode;
   mode_t extra_permissions;
index c952eb397a1fc6c995a333919acc1ef030a1b8aa..619eb8260abd703426b562668fb76666660e9ed4 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -441,7 +441,7 @@ make_dir_parents_private (char const *const_dir, size_t src_offset,
 
       while ((slash = strchr (slash, '/')))
         {
-          struct dir_attr *new IF_LINT ( = NULL);
+          struct dir_attr *new;
           bool missing_dir;
 
           *slash = '\0';
index 6d9cc2a5b45f34770a7712a895956215836c1be4..ab32968db7326ca281addd852ca4cb931df0ab99 100644 (file)
@@ -1125,9 +1125,6 @@ hex_equal (unsigned char const *hex_digest, unsigned char const *bin_buffer)
   return cnt == digest_bin_bytes;
 }
 
-#if defined __GNUC__ && (__GNUC__ + (__GNUC_MINOR__ >= 7) > 4)
-# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-#endif
 static bool
 digest_check (char const *checkfile_name)
 {
index f576a2200c0da247fd1249276901c5ee6b3b458c..c9d3b0d05067a3b7d4a8903793c6edea9c98cc3f 100644 (file)
@@ -351,7 +351,7 @@ elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
          bytes.  Then, for each new buffer we read, also write an old one.  */
 
       bool eof = false;
-      size_t n_read IF_LINT ( = 0);
+      size_t n_read;
       bool buffered_enough;
       size_t i, i_next;
       char **b = NULL;
index bfdac0cd9cc403f5381d9dd6ec2200407f8fe132..1c3307cac915f90081819cf66f1b3b82d5651561 100644 (file)
--- a/src/ln.c
+++ b/src/ln.c
@@ -473,7 +473,7 @@ main (int argc, char **argv)
   char const *backup_suffix = NULL;
   char *version_control_string = NULL;
   char const *target_directory = NULL;
-  int destdir_fd IF_LINT ( = -1);
+  int destdir_fd;
   bool no_target_directory = false;
   int n_files;
   char **file;
index 468ef3ab037ec342c95f46e6bc9f24889b58e81f..5c194d8fe213284cf38aa7f59809a81863ec99e3 100644 (file)
@@ -233,7 +233,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
 
       for (size_t i = 0; i < nfiles && files_open; i++)
         {
-          int chr IF_LINT ( = -1);     /* Input character. */
+          int chr;                     /* Input character. */
           int err;                     /* Input errno value.  */
           bool sometodo = false;       /* Input chars to process.  */
 
index 6be5b1f33a86a0c5352017767de07639c7081af2..1c32e8c81d25bfd0ba3bd29e864ccd317860e90a 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
@@ -2428,7 +2428,7 @@ static bool
 read_line (COLUMN *p)
 {
   int c;
-  int chars IF_LINT ( =0);
+  int chars;
   int last_input_position;
   int j, k;
   COLUMN *q;
index 5aadc797b72f23bef78ee5838983ca61d9dcd58e..8ca7a88c48ec07eccd952b14739e427721466c5d 100644 (file)
@@ -1045,7 +1045,7 @@ pipe_fork (int pipefds[2], size_t tries)
   struct tempnode *saved_temphead;
   int saved_errno;
   double wait_retry = 0.25;
-  pid_t pid IF_LINT ( = -1);
+  pid_t pid;
   struct cs_status cs;
 
   if (pipe2 (pipefds, O_CLOEXEC) < 0)