]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Fri, 17 Nov 2023 08:53:25 +0000 (09:53 +0100)
committerJulien Grall <julien@xen.org>
Wed, 29 Nov 2023 17:25:38 +0000 (18:25 +0100)
To be able to check for the existence of the necessary subsections in
the documentation for MISRA C:2012 Dir 4.1, ECLAIR needs to have a source
file that is built.

This file is generated from 'C-runtime-failures.rst' in docs/misra
and the configuration is updated accordingly.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
automation/eclair_analysis/build.sh
automation/eclair_analysis/prepare.sh

index ec087dd822fa1ec658bd81ef4c1208a83be08421..122b93b805817ff0aae66ae3ee9cb893e8c1ac91 100755 (executable)
@@ -33,12 +33,35 @@ else
   PROCESSORS=6
 fi
 
+# Variables driving the build
+CC=${CROSS_COMPILE}gcc-12
+CXX=${CROSS_COMPILE}g++-12
+
+runtime_failures_docs() {
+  doc="C-runtime-failures.rst"
+  builddir="automation/eclair_analysis"
+  
+  cd "${builddir}"
+  printf "/*\n\n" >"${doc}.c"
+  sed -e 's|\*/|*//*|g' "../../docs/misra/${doc}" >>"${doc}.c"
+  
+  # At least a dummy decl is needed to comply with the C standard.
+  printf "\n\n*/\ntypedef int dummy_typedef;\n" >>"${doc}.c"
+  
+  # The C language standard applicable to Xen is C99 (with extensions),
+  # therefore even this dummy file needs to be compiled with -std=c99.
+  # Cannot redirect to /dev/null because it would be excluded from the analysis
+  "${CC}" -std=c99 -c "${doc}.c" -o "${doc}.o"
+  cd -
+}
+
 (
-  cd xen
+  runtime_failures_docs
 
   make "-j${PROCESSORS}" "-l${PROCESSORS}.0"    \
        "CROSS_COMPILE=${CROSS_COMPILE}"         \
-       "CC=${CROSS_COMPILE}gcc-12"              \
-       "CXX=${CROSS_COMPILE}g++-12"             \
-       "XEN_TARGET_ARCH=${XEN_TARGET_ARCH}"
+       "CC=${CC}"                               \
+       "CXX=${CXX}"                             \
+       "XEN_TARGET_ARCH=${XEN_TARGET_ARCH}"     \
+       -C xen
 )
index 0cac5eba00aea9cfc1aadabbe5006961ae8796ef..fe9d16e48ecc6cb2340b9f8d91d82382afa2ac13 100755 (executable)
@@ -35,11 +35,12 @@ else
 fi
 
 (
-    cd xen
-    cp "${CONFIG_FILE}" .config
+    ./configure
+    cp "${CONFIG_FILE}" xen/.config
     make clean
     find . -type f -name "*.safparse" -print -delete
-    make -f ${script_dir}/Makefile.prepare prepare
+    cd xen
+    make -f "${script_dir}/Makefile.prepare" prepare
     # Translate the /* SAF-n-safe */ comments into ECLAIR CBTs
     scripts/xen-analysis.py --run-eclair --no-build --no-clean
 )