[cfe-dev] [RFC] Starting support for SAL
aaron at aaronballman.com
Sun Oct 30 13:40:06 CDT 2011
I am starting to add support for Microsoft's source annotations so
that they can be used in the static analyzer. Before I go too far
into the implementation, I am wondering whether I'm approaching the
SAL has two separate implementations, depending on the compiler.
Older versions of MSVC use __declspec to implement the annotations,
and newer versions of MSVC use Microsoft's basically undocumented
attribute syntax. Initially, I am only implementing support for the
__declspec syntax, but would eventually like to support the attribute
syntax as well. The __declspec syntax relies on ordering of the
annotations. For instance, __declspec( "SAL_pre" ) __declspec(
"SAL_notnull" ) is not the same as __declspec( "SAL_notnull" )
__declspec( "SAL_pre" ).
I've created separate attributes for each of the SAL notations, and I
parse them in ParseMicrosoftDeclSpec. Some of the notations are
simple declspecs, and others have parameters to parse. Currently, I
am only parsing the simple ones, but I intend to parse the
parameterized ones and store the parameter information on the
attribute objects. All of the SAL declspecs are string literals.
I've attached an early stage patch, and am looking for feedback on
whether I am going about this properly, or if there is a better way.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 16713 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/cfe-dev/attachments/20111030/13942626/attachment.obj
More information about the cfe-dev