Remove unused but set variables.
authorMartin Liska <mliska@suse.cz>
Mon, 18 Oct 2021 07:27:10 +0000 (09:27 +0200)
committerMartin Liska <mliska@suse.cz>
Mon, 18 Oct 2021 08:16:46 +0000 (10:16 +0200)
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
gcc/gcov.c
gcc/lto-compress.c
gcc/targhooks.c
libcpp/charset.c

index 6a7eb34..458341a 100644 (file)
@@ -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;
     }
 }
 
index 829e955..3672ae7 100644 (file)
@@ -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;
index b5f4916..c40a13c 100644 (file)
@@ -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;
index cbbcedf..812bbe3 100644 (file)
@@ -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;
index b84a974..e4e45f6 100644 (file)
@@ -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';
     }