coverity: fix multiple source code parse errors

Coverity scans the source code for static analysis, but its parser
has a couple of flaws...
The most common one is the failure to parse deprecation macros in
enum definitions, like:

```
  G_PARAM_PRIVATE GLIB_DEPRECATED_ENUMERATOR_IN_2_26 = G_PARAM_STATIC_NAME,
                  ^
  SD_JOURNAL_SYSTEM_ONLY _sd_deprecated_ = SD_JOURNAL_SYSTEM /* old name */
                         ^
```

but also recent gcc built-in macros, like:

```
  #if __has_builtin(__builtin_is_constant_evaluated)
      ^
  #if _GLIBCXX_HAS_BUILTIN(__has_unique_object_representations)
      ^
```

The solution is to replace the code with regular expressions at an earlier
stage. This can be configured directly in coverity with cov-configure
This commit is contained in:
George Kiagiadakis 2021-09-22 15:07:10 +03:00
parent 3f032ae464
commit 7e8446e984

View File

@ -254,7 +254,15 @@ build_with_coverity:
-Dvulkan=enabled
-Dsdl2=enabled
-Dsndfile=enabled
- cov-build --dir cov-int ninja -C "$BUILD_DIR"
- cov-configure --config coverity_conf.xml
--comptype gcc --compiler cc --template
--xml-option=append_arg@C:--ppp_translator
--xml-option=append_arg@C:"replace/_sd_deprecated_\s+=/ ="
--xml-option=append_arg@C:--ppp_translator
--xml-option=append_arg@C:"replace/GLIB_(DEPRECATED|AVAILABLE)_ENUMERATOR_IN_\d_\d\d(_FOR\(\w+\)|)\s+=/ ="
--xml-option=append_arg@C:--ppp_translator
--xml-option=append_arg@C:"replace/(__has_builtin|_GLIBCXX_HAS_BUILTIN)\(\w+\)/1"
- cov-build --dir cov-int --config coverity_conf.xml ninja -C "$BUILD_DIR"
- tar czf cov-int.tar.gz cov-int
- curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
--form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL