From 41b0b53b851d51a959c966777a2d502ba4ecbeec Mon Sep 17 00:00:00 2001 From: niffiwan Date: Sun, 31 Jul 2016 20:53:08 +1000 Subject: [PATCH] Fix coverity scan triggered from travis Update modeling file to deal with SDL2.0 changes --- .travis.yml | 8 +++--- coverity/modeling.cpp | 61 +++++++++++++------------------------------ 2 files changed, 22 insertions(+), 47 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45c880630b..b5629aa8c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,10 +21,8 @@ addons: coverity_scan: project: name: "scp-fs2open/fs2open.github.com" - description: "Coverity via Travis CI" notification_email: niffiwan.scp@gmail.com - build_command_prepend: "./autogen.sh --enable-debug" - build_command: "make -j2" + build_command: "ci/travis/script.sh" # must match TRAVIS_BRANCH check below branch_pattern: coverity_scan deploy: @@ -50,6 +48,8 @@ env: global: # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created # via the "travis encrypt" command using the project repo's public key + # also note that fork's don't get access to secure keys + # you have to test using a branch in the main repo - secure: "C3wF967ZeliwwP1vC12EMIBOaC568n26Z/cPnwzn317ve59DWH3YSfPZVgvt08GzmaXITGGsJvPB+qxfGoKvQzYE4O1B73q81RpUe5pB3IhF+ThQ91VfQZIRJR5xEGJaLINUlHTTZGX5jxlkVO9wAcauVj/s3b8sQ3dvUZauPvk=" matrix: include: @@ -90,4 +90,4 @@ before_script: script: - if [ "$BUILD_DEPLOYMENT" = true ] ; then ./ci/travis/release.sh ; else ./ci/travis/script.sh ; fi before_deploy: - - "./ci/travis/before_deploy.sh" \ No newline at end of file + - "./ci/travis/before_deploy.sh" diff --git a/coverity/modeling.cpp b/coverity/modeling.cpp index 216c79b78f..1cea725f00 100644 --- a/coverity/modeling.cpp +++ b/coverity/modeling.cpp @@ -2,48 +2,23 @@ * Coverity Scan modeling file. Help reduce false positives */ -// Assert & Assertion are "killpaths" in DEBUG, but not release -// This should get them treated as killpaths in release as well -// (just a copy of the DEBUG version of the macros) - -void WinAssert(char * text, char *filename, int line) +/* + * In theory these fatal errors can allow execution to continue, because we give an option to open the debugger when they occur + * However, Coverity should treat these as killpaths, since users should never pick the debug option + * These two should cover Error, Assert & Assertion (and maybe others, I haven't done an exhaustive check) + */ +namespace os { - __coverity_panic__(); + namespace dialogs + { + void Error(const char* text) + { + __coverity_panic__(); + } + + void AssertMessage(const char * text, const char * filename, int linenum, const char * format, ...) + { + __coverity_panic__(); + } + } } - -void WinAssert(char * text, char *filename, int line, const char * format, ... ) -{ - __coverity_panic__(); -} - -# define Assert(expr) do {\ - if (!(expr)) {\ - WinAssert(#expr,__FILE__,__LINE__);\ - }\ - ASSUME( expr );\ - } while (0) - -# ifndef _MSC_VER // non MS compilers -# define Assertion(expr, msg, ...) do {\ - if (!(expr)) {\ - WinAssert(#expr,__FILE__,__LINE__, msg , ##__VA_ARGS__ );\ - }\ - } while (0) -# else -# if _MSC_VER >= 1400 // VC 2005 or greater -# define Assertion(expr, msg, ...) do {\ - if (!(expr)) {\ - WinAssert(#expr,__FILE__,__LINE__, msg, __VA_ARGS__ );\ - }\ - ASSUME(expr);\ - } while (0) -# else // older MSVC compilers -# define Assertion(expr, msg) do {\ - if (!(expr)) {\ - WinAssert(#expr,__FILE__,__LINE__);\ - }\ - } while (0) -# endif -# endif - -