Merge pull request #66 from sherief/Robustness

Hints for Clang's static analyzer - preventing false positives.
This commit is contained in:
Alexander Gessler
2013-08-04 17:42:36 -07:00
3 changed files with 9 additions and 3 deletions
+2 -2
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);
+1 -1
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;
// -------------------------------------------------------------------
+6
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.