diff mbox series

[PUSHED] Remove unused but set variables.

Message ID 219882f8-6a54-df48-4897-3f4cd24fcba4@suse.cz
State New
Headers show
Series [PUSHED] Remove unused but set variables. | expand

Commit Message

Martin Liška Oct. 18, 2021, 8:15 a.m. UTC
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Pushed to master as obvious.

Reported by clang13 -Wunused-but-set-variable:

gcc/ChangeLog:

	* dbgcnt.c (dbg_cnt_process_opt): Remove unused but set variable.
	* gcov.c (get_cycles_count): Likewise.
	* lto-compress.c (lto_compression_zlib): Likewise.
	(lto_uncompression_zlib): Likewise.
	* targhooks.c (default_pch_valid_p): Likewise.

libcpp/ChangeLog:

	* charset.c (convert_oct): Remove unused but set variable.
---
  gcc/dbgcnt.c       | 2 --
  gcc/gcov.c         | 4 +---
  gcc/lto-compress.c | 4 ----
  gcc/targhooks.c    | 4 +---
  libcpp/charset.c   | 2 --
  5 files changed, 2 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c
index 6a7eb34cd3e..458341a53a0 100644
--- a/gcc/dbgcnt.c
+++ b/gcc/dbgcnt.c
@@ -208,7 +208,6 @@  void
  dbg_cnt_process_opt (const char *arg)
  {
    char *str = xstrdup (arg);
-  unsigned int start = 0;
  
    auto_vec<char *> tokens;
    for (char *next = strtok (str, ","); next != NULL; next = strtok (NULL, ","))
@@ -227,7 +226,6 @@  dbg_cnt_process_opt (const char *arg)
  	  if (!dbg_cnt_process_single_pair (name, ranges[j]))
  	    break;
  	}
-      start += strlen (tokens[i]) + 1;
      }
  }
  
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 829e955a63b..3672ae7a6f8 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -843,7 +843,6 @@  get_cycles_count (line_info &linfo)
       Therefore, operating on a permuted order (i.e., non-sorted) only
       has the effect of permuting the output cycles.  */
  
-  bool loop_found = false;
    gcov_type count = 0;
    for (vector<block_info *>::iterator it = linfo.blocks.begin ();
         it != linfo.blocks.end (); it++)
@@ -851,8 +850,7 @@  get_cycles_count (line_info &linfo)
        arc_vector_t path;
        block_vector_t blocked;
        vector<block_vector_t > block_lists;
-      loop_found |= circuit (*it, path, *it, blocked, block_lists, linfo,
-			     count);
+      circuit (*it, path, *it, blocked, block_lists, linfo, count);
      }
  
    return count;
diff --git a/gcc/lto-compress.c b/gcc/lto-compress.c
index b5f4916b139..c40a13c8446 100644
--- a/gcc/lto-compress.c
+++ b/gcc/lto-compress.c
@@ -250,7 +250,6 @@  lto_compression_zlib (struct lto_compression_stream *stream)
    const size_t outbuf_length = Z_BUFFER_LENGTH;
    unsigned char *outbuf = (unsigned char *) xmalloc (outbuf_length);
    z_stream out_stream;
-  size_t compressed_bytes = 0;
    int status;
  
    gcc_assert (stream->is_compression);
@@ -282,7 +281,6 @@  lto_compression_zlib (struct lto_compression_stream *stream)
  
        stream->callback ((const char *) outbuf, out_bytes, stream->opaque);
        lto_stats.num_compressed_il_bytes += out_bytes;
-      compressed_bytes += out_bytes;
  
        cursor += in_bytes;
        remaining -= in_bytes;
@@ -342,7 +340,6 @@  lto_uncompression_zlib (struct lto_compression_stream *stream)
    size_t remaining = stream->bytes;
    const size_t outbuf_length = Z_BUFFER_LENGTH;
    unsigned char *outbuf = (unsigned char *) xmalloc (outbuf_length);
-  size_t uncompressed_bytes = 0;
  
    gcc_assert (!stream->is_compression);
    timevar_push (TV_IPA_LTO_DECOMPRESS);
@@ -378,7 +375,6 @@  lto_uncompression_zlib (struct lto_compression_stream *stream)
  
  	  stream->callback ((const char *) outbuf, out_bytes, stream->opaque);
  	  lto_stats.num_uncompressed_il_bytes += out_bytes;
-	  uncompressed_bytes += out_bytes;
  
  	  cursor += in_bytes;
  	  remaining -= in_bytes;
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index cbbcedf790f..812bbe3f16e 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -2200,7 +2200,7 @@  pch_option_mismatch (const char *option)
  /* Default version of pch_valid_p.  */
  
  const char *
-default_pch_valid_p (const void *data_p, size_t len)
+default_pch_valid_p (const void *data_p, size_t len ATTRIBUTE_UNUSED)
  {
    struct cl_option_state state;
    const char *data = (const char *)data_p;
@@ -2221,7 +2221,6 @@  default_pch_valid_p (const void *data_p, size_t len)
  
        memcpy (&tf, data, sizeof (target_flags));
        data += sizeof (target_flags);
-      len -= sizeof (target_flags);
        r = targetm.check_pch_target_flags (tf);
        if (r != NULL)
  	return r;
@@ -2233,7 +2232,6 @@  default_pch_valid_p (const void *data_p, size_t len)
  	if (memcmp (data, state.data, state.size) != 0)
  	  return pch_option_mismatch (cl_options[i].opt_text);
  	data += state.size;
-	len -= state.size;
        }
  
    return NULL;
diff --git a/libcpp/charset.c b/libcpp/charset.c
index b84a9740165..e4e45f6d39d 100644
--- a/libcpp/charset.c
+++ b/libcpp/charset.c
@@ -1464,7 +1464,6 @@  convert_oct (cpp_reader *pfile, const uchar *from, const uchar *limit,
    cppchar_t c, n = 0;
    size_t width = cvt.width;
    size_t mask = width_to_mask (width);
-  bool overflow = false;
  
    /* loc_reader and ranges must either be both NULL, or both be non-NULL.  */
    gcc_assert ((loc_reader != NULL) == (ranges != NULL));
@@ -1477,7 +1476,6 @@  convert_oct (cpp_reader *pfile, const uchar *from, const uchar *limit,
        from++;
        if (loc_reader)
  	char_range.m_finish = loc_reader->get_next ().m_finish;
-      overflow |= n ^ (n << 3 >> 3);
        n = (n << 3) + c - '0';
      }