0

I'm trying to use clang-tidy on my code base and I'm getting a lot of false positives from the following pattern

int *a;
if(config(some_value))
    a = value;
...
if(config(some_value))
    *a = other_value; // <-- deference of garbage value 

the config function has it's value setup from a file on startup and isn't altered after. So All calls to config(some_value) return the same value.

Is there some way to mark the declaration of config() to clang that this is the case?

Mitchk
  • 13
  • 2
  • `int flag = config(some_value); if (flag)`? If this works, it would be a lot clearer to the reader. – ikegami Nov 04 '19 at 04:49
  • I've used that method in a lot of the newer code, but there are 1000's of this pattern around the code, so I can't fix all of them. So I was kinda hoping I could tag the function somehow and remove the false positives. – Mitchk Nov 06 '19 at 23:34

0 Answers0