public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4465] Remove unused but set variables.
@ 2021-10-18  8:17 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-10-18  8:17 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:724e27046bc3f1b24eb4e153f71da0ac1049127d

commit r12-4465-g724e27046bc3f1b24eb4e153f71da0ac1049127d
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Oct 18 09:27:10 2021 +0200

    Remove unused but set variables.
    
    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.

Diff:
---
 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 --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';
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-18  8:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18  8:17 [gcc r12-4465] Remove unused but set variables Martin Liska

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).