How to tell ccc-analyzer (C static analyzer in clang) that a function cannot return

StackOverflow https://stackoverflow.com/questions/11910311

  •  25-06-2021
  •  | 
  •  

Вопрос

I am currently using ccc-analyzer by means of static-build to analyze our code base. I am using a recent build I made from the Git mirror.

Now in PC-Lint I am able to tell Lint whenever a function doesn't return. This is usually done via /*lint -unreachable*/ or similar comments ("markup") that control the PC-Lint behavior.

With scan-build I am now running across a number of false positives that I would like to suppress, because I know that a particular function will never return (ultimately it calls the exit function of the C runtime). Is there any way to tell static-build/ccc-analyzer that my function cannot return?

Это было полезно?

Решение

Turns out there is a way to annotate the code using GCC-style attributes as documented here. So the question is answered.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top