Skip to content

Conversation

@masaori335
Copy link
Contributor

llvm-15 (clang-15) generates below "unused-but-set-variable" warnings.

Cache.cc:2892:11: warning: variable 'disk_full' set but not used [-Wunused-but-set-variable]
      int disk_full         = 0;
          ^      
Store.cc:306:7: warning: variable 'ln' set but not used [-Wunused-but-set-variable]
  int ln          = 0;
      ^
RemapConfig.cc:151:17: warning: variable 'idx' set but not used [-Wunused-but-set-variable]
  for (unsigned idx = 1; str; idx++) {
                ^
LogObject.cc:1131:12: warning: variable 'num_kept_objects' set but not used [-Wunused-but-set-variable]
  unsigned num_kept_objects = 0;      
           ^
traffic_cache_tool/CacheDefs.cc:545:9: warning: variable 'len' set but not used [-Wunused-but-set-variable]
    int len          = 0;
        ^
gold_tests/tls/ssl-post.c:108:7: warning: variable 'read_count' set but not used [-Wunused-but-set-variable]
  int read_count     = 0;
      ^
gold_tests/tls/ssl-post.c:109:7: warning: variable 'write_count' set but not used [-Wunused-but-set-variable]
  int write_count    = 1;
      ^

The release note of clang 15.0.0 says below.

Improvements to Clang’s diagnostics
...
  * -Wunused-but-set-variable now also warns if the variable is only used by unary operators.
...  

https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#improvements-to-clang-s-diagnostics

@masaori335 masaori335 added Build work related to build configuration or environment Cleanup labels Sep 26, 2022
@masaori335 masaori335 added this to the 10.0.0 milestone Sep 26, 2022
@masaori335 masaori335 self-assigned this Sep 26, 2022
Copy link
Contributor

@bneradt bneradt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for helping keep the latest compilers happy.

Hopefully CI will help keep these clean in a month or so once fedora:37 is released and we update our github Fedora build to that. Apparently it should have llvm 15 as default:
https://fedoraproject.org/wiki/Releases/37/ChangeSet#LLVM_15

@masaori335 masaori335 merged commit a4de562 into apache:master Sep 26, 2022
zwoop pushed a commit that referenced this pull request Oct 4, 2022
@zwoop
Copy link
Contributor

zwoop commented Oct 4, 2022

Cherry-picked to v9.2.x

@zwoop zwoop modified the milestones: 10.0.0, 9.2.0 Oct 4, 2022
masaori335 pushed a commit to masaori335/trafficserver that referenced this pull request Feb 21, 2023
* asf/9.2.x:
  Updated ChangeLog
  s3_auth: Fix parsing of virtual_host (apache#9103)
  s3_auth: accept longer config lines (apache#9090)
  Add a proxy.config.http.per_server.connection.max test (apache#9097)
  Move plugin_init for verify cmd (apache#9102)
  Fix unused-but-set-variable warnings by llvm-15 (apache#9106)
  Fix compile error with llvm-15 (apache#9105)
  Fix expected sha1sum for the Proxy Verifier binary (apache#9112)
  Updating AuTest to use Proxy Verifier v2.4.2 (apache#9110)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build work related to build configuration or environment Cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants