Clang static analyzer
Tomas Carnecky
tom at dbservice.com
Mon Dec 7 23:22:39 PST 2009
On Dec 8, 2009, at 7:29 AM, Jamey Sharp wrote:
> On Mon, Dec 7, 2009 at 9:55 PM, Tomas Carnecky <tom at dbservice.com> wrote:
>> [1] http://78.46.209.101/stuff/clang-static-analyzer/fdo/
>
> Looking at the libX11 output: What kind of annotation do you need to
> express that _XIOError can't ever return? Either it'll call exit(2) or
> an application will longjmp from it all the way out of Xlib code
> paths. Will clang accept GCC's __attribute__((noreturn))? That should
> eliminate both "Dereference of null pointer" false positive reports in
> XlibInt.c, at least.
That's what I thought about, too :) And indeed adding that attribute 'fixes' the two reported issues in XlibInt.c. It would be best though to add such define to x11proto/Xfuncproto.h, so it's available in all modules.
Btw, what is the earliest gcc version that X claims to support? attribute((noreturn)) has been supported since gcc 2.5, so I'm tempted to simply add #if defined(__GCC__) and not check the gcc version. Would that be acceptable?
Also, even though there is _X_INLINE, the xserver source uses plain 'inline' in many places and nobody complained yet, so I guess everybody is using a compiler that understands the keyword (which would mean everybody uses gcc 3.0.3 or later).
tom
More information about the xorg-devel
mailing list