Merge pull request #66 from sherief/Robustness

Hints for Clang's static analyzer - preventing false positives.
pull/69/head
Alexander Gessler 2013-08-04 17:42:36 -07:00
commit 5f0bd28b15
3 changed files with 9 additions and 3 deletions

View File

@ -50,8 +50,8 @@ namespace Util {
/* DOM/Parse error reporting - does not return */
void DOMError(const std::string& message, const Token& token);
void DOMError(const std::string& message, const Element* element = NULL);
AI_WONT_RETURN void DOMError(const std::string& message, const Token& token) AI_WONT_RETURN_SUFFIX;
AI_WONT_RETURN void DOMError(const std::string& message, const Element* element = NULL) AI_WONT_RETURN_SUFFIX;
// does return
void DOMWarning(const std::string& message, const Token& token);

View File

@ -82,7 +82,7 @@ protected:
/** Report a validation error. This will throw an exception,
* control won't return.
* @param msg Format string for sprintf().*/
AI_WONT_RETURN void ReportError(const char* msg,...);
AI_WONT_RETURN void ReportError(const char* msg,...) AI_WONT_RETURN_SUFFIX;
// -------------------------------------------------------------------

View File

@ -162,6 +162,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# define AI_FORCE_INLINE inline
#endif // (defined _MSC_VER)
#ifdef __clang__
# define AI_WONT_RETURN_SUFFIX __attribute__((analyzer_noreturn))
#else
# define AI_WONT_RETURN_SUFFIX
#endif // (defined __clang__)
#ifdef __cplusplus
/* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
* in doxydocs.