jjb: fix coverity on gcc >= 7
[lttng-ci.git] / scripts / common / coverity.sh
index 0a760bd847b3d822af862126f531510092c23ce9..7b06f554647af35fc1f5e3163199f7cad6102d1c 100755 (executable)
@@ -112,6 +112,28 @@ if [ -d "$WORKSPACE/src/linux" ]; then
        export KERNELDIR="$WORKSPACE/src/linux"
 fi
 
+# Hack to get coverity with gcc >= 7
+#
+# We have to define the _Float* types as those are not defined by coverity and as result
+# the codes linking agains those (pretty much anything linking against stdlib.h and math.h)
+# won't be covered.
+echo "
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _Float128 long double
+#define _Float64x long double
+#define _Float64 double
+#define _Float32x double
+#define _Float32 float
+
+#ifdef __cplusplus
+}
+#endif" >> /tmp/coverity.h
+
+export CPPFLAGS="-include /tmp/coverity.h ${CPPFLAGS:-}"
+
 
 # Verify upload is permitted
 set +x
@@ -213,7 +235,7 @@ response=$(curl \
   "$UPLOAD_URL")
 set -x
 status_code=$(echo "$response" | sed -n '$p')
-if [ "$status_code" == "201" ]; then
+if [ "${status_code:0:1}" == "2" ]; then
   echo -e "\033[33;1mCoverity Scan upload successful.\033[0m"
 else
   TEXT=$(echo "$response" | sed '$d')
This page took 0.033146 seconds and 4 git commands to generate.