This is an archive of the discontinued LLVM Phabricator instance.

[Clang] -Wunused-but-set-variable - ignore static variables
AbandonedPublic

Authored by xbolva00 on Mar 24 2022, 2:20 AM.

Details

Summary

Currently, Clang emits false positive for

void test(void) {
  static int counter = 0;
  counter += 1;
}

warning: variable 'counter' set but not used [-Wunused-but-set-variable]

We should check for correct local storage (a variable with function scope is a non-static local variable).

Diff Detail

Event Timeline

xbolva00 created this revision.Mar 24 2022, 2:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2022, 2:20 AM
xbolva00 abandoned this revision.Mar 24 2022, 2:29 AM

ignore me, this seems okay (interestigly, gcc does not warn)