use the documentation for MISRA C:2012 Dir 4.1
PATCH v4 1/2 automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
In reply to Nicola VetriniTo 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.
---
Changes from RFC:
- Dropped unused/useless code
- Revised the sed command
- Revised the clean target
Changes in v2:
- Added explanative comment to the makefile
- printf instead of echo
Changes in v3:
- Terminate the generated file with a newline
- Build it with -std=c99, so that the documentation
for D1.1 applies.
Changes in v5:
- Transform and build the file directly in the eclair-specific directory
--- automation/eclair_analysis/build.sh | 21 +++++++++++++++++++-- automation/eclair_analysis/prepare.sh | 7 ++++--- 2 files changed, 23 insertions(+), 5 deletions(-)
automation/eclair_analysis/build.sh +19 -2
@@ -33,12 +33,29 @@ else PROCESSORS=6 fi +runtime_failures_docs() { + doc="C-runtime-failures.rst" + builddir="automation/eclair_analysis" + + cp "docs/misra/${doc}" "${builddir}" + cd "${builddir}" + printf "/*\n\n" >"${doc}.tmp" + sed -e 's|\*/|*//*|g' "${doc}" >>"${doc}.tmp" + printf "\n\n*/\n" >>"${doc}.tmp" + mv "${doc}.tmp" "${doc}.c" + + # Cannot redirect to /dev/null because it would be excluded from the analysis + "${CROSS_COMPILE}gcc-12" -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}" + "XEN_TARGET_ARCH=${XEN_TARGET_ARCH}" \ + -C xen )
automation/eclair_analysis/prepare.sh +4 -3
@@ -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 )
Signature · 1 line
2.34.1
v4 cover use the documentation for MISRA C:2012 Dir 4.1
This series addresses some concerns raised on patches 2 and 3 from [1]. Note that patch 1 from that series has already been applied.
Patch 1 comprises a modified version of patches 2 and 3 of the previous series. Patch 2 is brand new, as it merely clarifies how to write such documentation.
[1] https://lore.kernel.org/xen-devel/[email protected]/
Nicola Vetrini (2):
automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to
ECLAIR
docs/misra: add guidance on the format of Dir 4.1 docs for ECLAIR
automation/eclair_analysis/build.sh | 21 +++++++++++++++++++-- automation/eclair_analysis/prepare.sh | 7 ++++--- docs/misra/C-runtime-failures.rst | 8 ++++++++ 3 files changed, 31 insertions(+), 5 deletions(-)
Signature · 1 line
2.34.1
PATCH v4 2/2 docs/misra: add guidance on the format of Dir 4.1 docs for ECLAIR
Additional guidance on the formatting of the document for ECLAIR is supplied.
--- docs/misra/C-runtime-failures.rst | 8 ++++++++ 1 file changed, 8 insertions(+)
docs/misra/C-runtime-failures.rst +8 -0
@@ -12,6 +12,14 @@ built-in checks that are present in the language. The presence of such documentation is requested by MISRA C:2012 Directive 4.1, whose headline states: "Run-time failures shall be minimized". +The ECLAIR checker for MISRA C:2012 Directive 4.1 requires the documentation +to be supplied using the following format: + +``Documentation for MISRA C:2012 Dir 4.1: <category> <description>`` + +The matched categories are the ones listed below (e.g., ``overflow`` and +``unexpected wrapping``). The content of the description is not checked and can +span multiple lines. Documentation for MISRA C:2012 Dir 4.1: overflow ________________________________________________
Signature · 1 line
2.34.1
Re: [XEN PATCH v4 1/2] automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
In reply to Nicola VetriniQuoted 8 lines · Nicola Vetrini
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 <[email protected]>
This is actually match better than before, thanks!
Re: [XEN PATCH v4 2/2] docs/misra: add guidance on the format of Dir 4.1 docs for ECLAIR
In reply to Nicola VetriniQuoted 4 lines · Nicola Vetrini
Additional guidance on the formatting of the document for ECLAIR is supplied.
Signed-off-by Nicola Vetrini <[email protected]>
Re: [XEN PATCH v4 1/2] automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
In reply to Nicola VetriniHi,
Quoted 34 lines · Nicola Vetrini
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 <[email protected]>---
Changes from RFC:
- Dropped unused/useless code
- Revised the sed command
- Revised the clean targetChanges in v2:
- Added explanative comment to the makefile
- printf instead of echoChanges in v3:
- Terminate the generated file with a newline
- Build it with -std=c99, so that the documentation
for D1.1 applies.
Changes in v5:
- Transform and build the file directly in the eclair-specific directory--- automation/eclair_analysis/build.sh | 21 +++++++++++++++++++-- automation/eclair_analysis/prepare.sh | 7 ++++--- 2 files changed, 23 insertions(+), 5 deletions(-)automation/eclair_analysis/build.sh +0
-0
automation/eclair_analysis/build.sh else · line 40
Quoted 8 lines
automation/eclair_analysis/build.sh +5
-0@@ -33,12 +33,29 @@ else PROCESSORS=6 fi +runtime_failures_docs() { + doc="C-runtime-failures.rst" + builddir="automation/eclair_analysis" + + cp "docs/misra/${doc}" "${builddir}"
Is it necessary to copy the .rst? IOW, would it be sufficient to use...
automation/eclair_analysis/build.sh else · line 43
Quoted 3 lines
automation/eclair_analysis/build.sh +3
-0+ cd "${builddir}" + printf "/*\n\n" >"${doc}.tmp" + sed -e 's|\*/|*//*|g' "${doc}" >>"${doc}.tmp"
... docs/misc/${doc} here?
automation/eclair_analysis/build.sh else · line 45
Quoted 2 lines
automation/eclair_analysis/build.sh +2
-0+ printf "\n\n*/\n" >>"${doc}.tmp" + mv "${doc}.tmp" "${doc}.c"
NIT: I am not sure why you need to first create .tmp and then create.c.
automation/eclair_analysis/build.sh else · line 48
Quoted 3 lines
automation/eclair_analysis/build.sh +3
-0+ + # Cannot redirect to /dev/null because it would be excluded from the analysis + "${CROSS_COMPILE}gcc-12" -std=c99 -c "${doc}.c" -o "${doc}.o"
NIT: It would be helpful to specify why -std=c99 is used. Above, you suggest this is to enable D1.1.
NIT: Can we define CC and use here and ...
automation/eclair_analysis/build.sh else · line 57
Quoted 10 lines
automation/eclair_analysis/build.sh +4
-1+ cd - +} + ( - cd xen + runtime_failures_docs make "-j${PROCESSORS}" "-l${PROCESSORS}.0" \ "CROSS_COMPILE=${CROSS_COMPILE}" \ "CC=${CROSS_COMPILE}gcc-12" \
...? This would make easier to re-use the code.
Quoted 15 lines
automation/eclair_analysis/build.sh +2
-1"CXX=${CROSS_COMPILE}g++-12" \ - "XEN_TARGET_ARCH=${XEN_TARGET_ARCH}" + "XEN_TARGET_ARCH=${XEN_TARGET_ARCH}" \ + -C xen )automation/eclair_analysis/prepare.sh +0
-2@@ -35,11 +35,12 @@ else fi ( - cd xen - cp "${CONFIG_FILE}" .config
automation/eclair_analysis/prepare.sh else · line 46
Quoted 10 lines
automation/eclair_analysis/prepare.sh +4
-1+ ./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 )
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH v4 2/2] docs/misra: add guidance on the format of Dir 4.1 docs for ECLAIR
In reply to Nicola VetriniHi Nicola,
Quoted 4 lines · Nicola Vetrini
Additional guidance on the formatting of the document for ECLAIR is supplied.
Signed-off-by Nicola Vetrini <[email protected]>
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH v4 1/2] automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
In reply to Julien GrallQuoted 48 lines · Julien Grall
Hi,
Quoted 35 lines · Nicola Vetrini
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 <[email protected]>---
Changes from RFC:
- Dropped unused/useless code
- Revised the sed command
- Revised the clean targetChanges in v2:
- Added explanative comment to the makefile
- printf instead of echoChanges in v3:
- Terminate the generated file with a newline
- Build it with -std=c99, so that the documentation for D1.1 applies.
Changes in v5:
- Transform and build the file directly in the eclair-specific directory--- automation/eclair_analysis/build.sh | 21 +++++++++++++++++++-- automation/eclair_analysis/prepare.sh | 7 ++++--- 2 files changed, 23 insertions(+), 5 deletions(-)automation/eclair_analysis/build.sh +0
-0automation/eclair_analysis/build.sh else · line 39
Quoted 7 lines
automation/eclair_analysis/build.sh +4
-0@@ -33,12 +33,29 @@ else PROCESSORS=6 fi +runtime_failures_docs() { + doc="C-runtime-failures.rst" + builddir="automation/eclair_analysis" + + cp "docs/misra/${doc}" "${builddir}"Is it necessary to copy the .rst? IOW, would it be sufficient to use...
Quoted 6 lines
automation/eclair_analysis/build.sh else · line 43
Quoted 3 lines
automation/eclair_analysis/build.sh +3
-0+ cd "${builddir}" + printf "/*\n\n" >"${doc}.tmp" + sed -e 's|\*/|*//*|g' "${doc}" >>"${doc}.tmp"... docs/misc/${doc} here?
I didn't want to leave a stray file under docs/misra, but it's not essential.
Quoted 5 lines
automation/eclair_analysis/build.sh else · line 45
Quoted 2 lines
automation/eclair_analysis/build.sh +2
-0+ printf "\n\n*/\n" >>"${doc}.tmp" + mv "${doc}.tmp" "${doc}.c"NIT: I am not sure why you need to first create .tmp and then
create.c.
Wasn't this a pattern to defend against interruptions of the build, just as I did in v3?
+$(TARGETS:.o=.c): %.c: %.rst
+ printf "/*\n\n" > [email protected] + sed -e 's|\*/|*//*|g' $< >> [email protected] + printf "\n\n*/\n" >> [email protected] + mv [email protected] $@
Quoted 7 lines
Quoted 4 lines
automation/eclair_analysis/build.sh +2
-0+ + # Cannot redirect to /dev/null because it would be excluded fromthe analysis
+ "${CROSS_COMPILE}gcc-12" -std=c99 -c "${doc}.c" -o "${doc}.o"NIT: It would be helpful to specify why -std=c99 is used. Above, you suggest this is to enable D1.1.
Yeah, the comment in the changelog should be pasted here
Quoted 14 lines
NIT: Can we define CC and use here and ...
automation/eclair_analysis/build.sh else · line 57
Quoted 9 lines
automation/eclair_analysis/build.sh +4
-1+ cd - +} + ( - cd xen + runtime_failures_docs make "-j${PROCESSORS}" "-l${PROCESSORS}.0" \ "CROSS_COMPILE=${CROSS_COMPILE}" \ "CC=${CROSS_COMPILE}gcc-12" \...? This would make easier to re-use the code.
I don't expect this build script to be changed much to be honest, but if you think this is beneficial then it's ok.
Quoted 26 lines
Quoted 14 lines
"CXX=${CROSS_COMPILE}g++-12" \automation/eclair_analysis/build.sh +2
-1- "XEN_TARGET_ARCH=${XEN_TARGET_ARCH}" + "XEN_TARGET_ARCH=${XEN_TARGET_ARCH}" \ + -C xen )automation/eclair_analysis/prepare.sh +0
-2@@ -35,11 +35,12 @@ else fi ( - cd xen - cp "${CONFIG_FILE}" .configautomation/eclair_analysis/prepare.sh else · line 45
Quoted 10 lines
automation/eclair_analysis/prepare.sh +4
-1+ ./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 )Cheers,
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH v4 1/2] automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
Hi,
Quoted 48 lines · Nicola Vetrini
Quoted 47 lines · Julien Grall
Hi,
Quoted 34 lines · Nicola Vetrini
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 <[email protected]>---
Changes from RFC:
- Dropped unused/useless code
- Revised the sed command
- Revised the clean targetChanges in v2:
- Added explanative comment to the makefile
- printf instead of echoChanges in v3:
- Terminate the generated file with a newline
- Build it with -std=c99, so that the documentation
for D1.1 applies.
Changes in v5:
- Transform and build the file directly in the eclair-specific directory
---
automation/eclair_analysis/build.sh | 21 +++++++++++++++++++--automation/eclair_analysis/prepare.sh| 7 ++++---2 files changed, 23 insertions(+), 5 deletions(-)automation/eclair_analysis/build.sh +0
-0@@ -33,12 +33,29 @@ elseQuoted 7 lines
PROCESSORS=6
fi
+runtime_failures_docs() {
+ doc="C-runtime-failures.rst"
+ builddir="automation/eclair_analysis"
+
+ cp "docs/misra/${doc}" "${builddir}"Is it necessary to copy the .rst? IOW, would it be sufficient to use...
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
+ cd "${builddir}"
+ printf "/*\n\n" >"${doc}.tmp"
+ sed -e 's|\*/|*//*|g' "${doc}" >>"${doc}.tmp"... docs/misc/${doc} here?
I didn't want to leave a stray file under docs/misra, but it's not essential.
I am confused. I am suggesting to use:
sed -e 's|\*/|*//*|g' "../../docs/misc/${doc}" >> "${doc}.tmp"
So *.tmp is still created at the same place.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
+ printf "\n\n*/\n" >>"${doc}.tmp"
+ mv "${doc}.tmp" "${doc}.c"NIT: I am not sure why you need to first create .tmp and then
create.c.
Quoted 7 lines
Wasn't this a pattern to defend against interruptions of the build, just as I did in v3?
+$(TARGETS:.o=.c): %.c: %.rst
+ printf "/*\n\n" > [email protected]
+ sed -e 's|\*/|*//*|g' $< >> [email protected]
+ printf "\n\n*/\n" >> [email protected]
+ mv [email protected] $@
Yes but it makes sense for the Makefile because the target would not be re-executed if *.c exists.
But I don't think this is the case for you because you are using a bash script. So your function should always be re-executed regardless on whether it was interrupted or not.
Quoted 26 lines
Quoted 8 lines
Quoted 5 lines
+
+ # Cannot redirect to/dev/nullbecause it would be excluded from the analysis
+ "${CROSS_COMPILE}gcc-12" -std=c99 -c "${doc}.c" -o "${doc}.o"NIT: It would be helpful to specify why -std=c99 is used. Above, you suggest this is to enable D1.1.
Yeah, the comment in the changelog should be pasted here
Quoted 14 lines
NIT: Can we define CC and use here and ...
Quoted 9 lines
+ cd -
automation/eclair_analysis/build.sh +2
-0+} +(
- cd xen
+runtime_failures_docs
make "-j${PROCESSORS}" "-l${PROCESSORS}.0" \
"CROSS_COMPILE=${CROSS_COMPILE}" \
"CC=${CROSS_COMPILE}gcc-12" \...? This would make easier to re-use the code.
Quoted 2 lines
I don't expect this build script to be changed much to be honest, but if you think this is beneficial then it's ok.
This is not only about code evolving. It makes easier to spot your are using the same compiler. I would not have made the remark if you were using 'gcc'.
But I noticed you were using gcc-12 and originally thought it was a mistake until I saw the second use.
The advantage of a variable CC (and CXX) is you can add a comment on top why you are specifically requestion gcc-12? IOW, why is gcc not fine?
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH v4 1/2] automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
Quoted 59 lines · Julien Grall
Hi,
Quoted 56 lines · Nicola Vetrini
Quoted 54 lines · Julien Grall
Hi,
Quoted 35 lines · Nicola Vetrini
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 <[email protected]>---
Changes from RFC:
- Dropped unused/useless code
- Revised the sed command
- Revised the clean targetChanges in v2:
- Added explanative comment to the makefile
- printf instead of echoChanges in v3:
- Terminate the generated file with a newline
- Build it with -std=c99, so that the documentation
for D1.1 applies.
Changes in v5:
- Transform and build the file directly in the eclair-specific directory
---
automation/eclair_analysis/build.sh | 21 +++++++++++++++++++--automation/eclair_analysis/prepare.sh| 7 ++++---2 files changed, 23 insertions(+), 5 deletions(-)automation/eclair_analysis/build.sh +0
-0@@ -33,12 +33,29 @@ elseQuoted 7 lines
PROCESSORS=6
fi
+runtime_failures_docs() {
+ doc="C-runtime-failures.rst"
+ builddir="automation/eclair_analysis"
+
+ cp "docs/misra/${doc}" "${builddir}"Is it necessary to copy the .rst? IOW, would it be sufficient to use...
Quoted 3 lines
+ cd "${builddir}"
+ printf "/*\n\n" >"${doc}.tmp"
+ sed -e 's|\*/|*//*|g' "${doc}" >>"${doc}.tmp"... docs/misc/${doc} here?
Quoted 8 lines
Quoted 1 line
I didn't want to leave a stray file under docs/misra, but it's not essential.
I am confused. I am suggesting to use:
sed -e 's|\*/|*//*|g' "../../docs/misc/${doc}" >> "${doc}.tmp"
So *.tmp is still created at the same place.
Ok, makes sense.
Quoted 15 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
+ printf "\n\n*/\n" >>"${doc}.tmp"
+ mv "${doc}.tmp" "${doc}.c"NIT: I am not sure why you need to first create .tmp and then
create.c.Quoted 7 lines
Wasn't this a pattern to defend against interruptions of the build, just as I did in v3?
+$(TARGETS:.o=.c): %.c: %.rst
+ printf "/*\n\n" > [email protected]
+ sed -e 's|\*/|*//*|g' $< >> [email protected]
+ printf "\n\n*/\n" >> [email protected]
+ mv [email protected] $@
Quoted 4 lines
Yes but it makes sense for the
Makefilebecause the target would not be re-executed if *.c exists.But I don't think this is the case for you because you are using a bash script. So your function should always be re-executed regardless on whether it was interrupted or not.
Ok.
Quoted 26 lines
Quoted 26 lines
Quoted 8 lines
Quoted 5 lines
+
+ # Cannot redirect to/dev/nullbecause it would be excluded from the analysis
+ "${CROSS_COMPILE}gcc-12" -std=c99 -c "${doc}.c" -o "${doc}.o"NIT: It would be helpful to specify why -std=c99 is used. Above, you suggest this is to enable D1.1.
Yeah, the comment in the changelog should be pasted here
Quoted 14 lines
NIT: Can we define CC and use here and ...
Quoted 9 lines
+ cd -
automation/eclair_analysis/build.sh +2
-0+} +(
- cd xen
+runtime_failures_docs
make "-j${PROCESSORS}" "-l${PROCESSORS}.0" \
"CROSS_COMPILE=${CROSS_COMPILE}" \
"CC=${CROSS_COMPILE}gcc-12" \...? This would make easier to re-use the code.
Quoted 9 lines
Quoted 2 lines
I don't expect this build script to be changed much to be honest, but if you think this is beneficial then it's ok.
This is not only about code evolving. It makes easier to spot your are using the same compiler. I would not have made the remark if you were using 'gcc'.
But I noticed you were using gcc-12 and originally thought it was a mistake until I saw the second use.
The advantage of a variable CC (and CXX) is you can add a comment on top why you are specifically requestion gcc-12? IOW, why is gcc not fine?
The assumptions in C-language-toolchain.rst (which are reflected in the analysis config) are using gcc-12 explicitly; that's just easier from a certification perspective to have a fixed version.
Signature · 2 lines
Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
Re: [XEN PATCH v4 1/2] automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
Quoted 4 lines · Nicola Vetrini
Quoted 3 lines · Julien Grall
But I noticed you were using gcc-12 and originally thought it was a mistake until I saw the second use.
Quoted 8 lines
Quoted 4 lines
The advantage of a variable CC (and CXX) is you can add a comment on top why you are specifically requestion gcc-12? IOW, why is gcc not fine?
The assumptions in
C-language-toolchain.rst(which are reflected in the analysis config) are using gcc-12 explicitly; that's just easier from a certification perspective to have a fixed version.
I'm wondering: Upstream Xen isn't going to undergo any certification effort, aiui. Downstreams who want to do so may have good reasons to choose a specific compiler version, which may well not be gcc12. How are we meaning to deal with that?
Jan
Re: [XEN PATCH v4 1/2] automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
Quoted 10 lines · Jan Beulich
Quoted 9 lines · Nicola Vetrini
Quoted 7 lines · Julien Grall
But I noticed you were using gcc-12 and originally thought it was a mistake until I saw the second use.
The advantage of a variable CC (and CXX) is you can add a comment on top why you are specifically requestion gcc-12? IOW, why is gcc not fine?
Quoted 8 lines
Quoted 3 lines
The assumptions in
C-language-toolchain.rst(which are reflected in the analysis config) are using gcc-12 explicitly; that's just easier from a certification perspective to have a fixed version.I'm wondering: Upstream Xen isn't going to undergo any certification effort, aiui. Downstreams who want to do so may have good reasons to choose a specific compiler version, which may well not be gcc12. How are we meaning to deal with that?
I think the most important part is to detail all our dependencies on the compiler and compiler's specific behaviors. If we do that, taking gcc12 as an example, then any downstream can look at C-language-toolchain.rst and see if there are any differences or any gaps in their compiler of choice compared to the reference (gcc12).
Re: [XEN PATCH v4 1/2] automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
In reply to Nicola VetriniHi,
Quoted 122 lines · Nicola Vetrini
Quoted 59 lines · Julien Grall
Hi,
Quoted 56 lines · Nicola Vetrini
Quoted 54 lines · Julien Grall
Hi,
Quoted 35 lines · Nicola Vetrini
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 <[email protected]>---
Changes from RFC:
- Dropped unused/useless code
- Revised the sed command
- Revised the clean targetChanges in v2:
- Added explanative comment to the makefile
- printf instead of echoChanges in v3:
- Terminate the generated file with a newline
- Build it with -std=c99, so that the documentation
for D1.1 applies.
Changes in v5:
- Transform and build the file directly in the eclair-specific directory
---
automation/eclair_analysis/build.sh | 21 +++++++++++++++++++--automation/eclair_analysis/prepare.sh| 7 ++++---2 files changed, 23 insertions(+), 5 deletions(-)automation/eclair_analysis/build.sh +0
-0@@ -33,12 +33,29 @@ elseQuoted 7 lines
PROCESSORS=6
fi
+runtime_failures_docs() {
+ doc="C-runtime-failures.rst"
+ builddir="automation/eclair_analysis"
+
+ cp "docs/misra/${doc}" "${builddir}"Is it necessary to copy the .rst? IOW, would it be sufficient to use...
Quoted 3 lines
+ cd "${builddir}"
+ printf "/*\n\n" >"${doc}.tmp"
+ sed -e 's|\*/|*//*|g' "${doc}" >>"${doc}.tmp"... docs/misc/${doc} here?
Quoted 8 lines
Quoted 1 line
I didn't want to leave a stray file under docs/misra, but it's not essential.
I am confused. I am suggesting to use:
sed -e 's|\*/|*//*|g' "../../docs/misc/${doc}" >> "${doc}.tmp"
So *.tmp is still created at the same place.
Ok, makes sense.
Quoted 15 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
+ printf "\n\n*/\n" >>"${doc}.tmp"
+ mv "${doc}.tmp" "${doc}.c"NIT: I am not sure why you need to first create .tmp and then
create.c.Quoted 7 lines
Wasn't this a pattern to defend against interruptions of the build, just as I did in v3?
+$(TARGETS:.o=.c): %.c: %.rst
+ printf "/*\n\n" > [email protected]
+ sed -e 's|\*/|*//*|g' $< >> [email protected]
+ printf "\n\n*/\n" >> [email protected]
+ mv [email protected] $@Quoted 4 lines
Yes but it makes sense for the
Makefilebecause the target would not be re-executed if *.c exists.But I don't think this is the case for you because you are using a bash script. So your function should always be re-executed regardless on whether it was interrupted or not.
Ok.
Quoted 29 lines
Quoted 28 lines
Quoted 8 lines
Quoted 5 lines
+
+ # Cannot redirect to/dev/nullbecause it would be excluded from the analysis
+ "${CROSS_COMPILE}gcc-12" -std=c99 -c "${doc}.c" -o "${doc}.o"NIT: It would be helpful to specify why -std=c99 is used. Above, you suggest this is to enable D1.1.
Yeah, the comment in the changelog should be pasted here
Quoted 14 lines
NIT: Can we define CC and use here and ...
Quoted 9 lines
+ cd -
automation/eclair_analysis/build.sh +2
-0+} +(
- cd xen
+runtime_failures_docs
make "-j${PROCESSORS}" "-l${PROCESSORS}.0" \
"CROSS_COMPILE=${CROSS_COMPILE}" \
"CC=${CROSS_COMPILE}gcc-12" \...? This would make easier to re-use the code.
I don't expect this build script to be changed much to be honest, but if you think this is beneficial then it's ok.
Quoted 8 lines
Quoted 6 lines
This is not only about code evolving. It makes easier to spot your are using the same compiler. I would not have made the remark if you were using 'gcc'.
But I noticed you were using gcc-12 and originally thought it was a mistake until I saw the second use.
The advantage of a variable CC (and CXX) is you can add a comment on top why you are specifically requestion gcc-12? IOW, why is gcc not fine?
The assumptions in
C-language-toolchain.rst(which are reflected in the analysis config) are using gcc-12 explicitly; that's just easier from a certification perspective to have a fixed version.
I am not against fixed version. It just needs to be documented. At least reading C-language-toolchain.rst, it is not obvious to me that this is only applying to GCC-12.
Cheers,
Signature · 1 line
Julien Grall
Re: [XEN PATCH v4 1/2] automation/eclair: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
Quoted 148 lines · Julien Grall
Hi,
Quoted 145 lines · Nicola Vetrini
Quoted 63 lines · Julien Grall
Hi,
Quoted 60 lines · Nicola Vetrini
Quoted 58 lines · Julien Grall
Hi,
Quoted 38 lines · Nicola Vetrini
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 <[email protected]>---
Changes from RFC:
- Dropped unused/useless code
- Revised the sed command
- Revised the clean targetChanges in v2:
- Added explanative comment to the makefile
- printf instead of echoChanges in v3:
- Terminate the generated file with a newline
- Build it with -std=c99, so that the documentation
for D1.1 applies.
Changes in v5:
- Transform and build the file directly in the eclair-specific directory
---
automation/eclair_analysis/build.sh | 21 +++++++++++++++++++--automation/eclair_analysis/prepare.sh| 7 ++++---2 files changed, 23 insertions(+), 5 deletions(-)automation/eclair_analysis/build.sh +0
-0@@ -33,12 +33,29 @@ elseQuoted 7 lines
PROCESSORS=6
fi
+runtime_failures_docs() {
+ doc="C-runtime-failures.rst"
+ builddir="automation/eclair_analysis"
+
+ cp "docs/misra/${doc}" "${builddir}"Is it necessary to copy the .rst? IOW, would it be sufficient to use...
Quoted 3 lines
+ cd "${builddir}"
+ printf "/*\n\n" >"${doc}.tmp"
+ sed -e 's|\*/|*//*|g' "${doc}" >>"${doc}.tmp"... docs/misc/${doc} here?
Quoted 9 lines
Quoted 2 lines
I didn't want to leave a stray file under docs/misra, but it's not essential.
I am confused. I am suggesting to use:
sed -e 's|\*/|*//*|g' "../../docs/misc/${doc}" >> "${doc}.tmp"
So *.tmp is still created at the same place.
Ok, makes sense.
Quoted 17 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
+ printf "\n\n*/\n" >>"${doc}.tmp"
+ mv "${doc}.tmp" "${doc}.c"NIT: I am not sure why you need to first create .tmp and then
create.c.Quoted 8 lines
Wasn't this a pattern to defend against interruptions of the build, just as I did in v3?
+$(TARGETS:.o=.c): %.c: %.rst
+ printf "/*\n\n" > [email protected]
+ sed -e 's|\*/|*//*|g' $< >> [email protected]
+ printf "\n\n*/\n" >> [email protected]
+ mv [email protected] $@Quoted 7 lines
Yes but it makes sense for the
Makefilebecause the target would not be re-executed if *.c exists.But I don't think this is the case for you because you are using a bash script. So your function should always be re-executed regardless on whether it was interrupted or not.
Ok.
Quoted 41 lines
Quoted 27 lines
Quoted 9 lines
Quoted 5 lines
+
+ # Cannot redirect to/dev/nullbecause it would be excluded from the analysis
+ "${CROSS_COMPILE}gcc-12" -std=c99 -c "${doc}.c" -o "${doc}.o"NIT: It would be helpful to specify why -std=c99 is used. Above, you suggest this is to enable D1.1.
Yeah, the comment in the changelog should be pasted here
Quoted 14 lines
NIT: Can we define CC and use here and ...
Quoted 9 lines
+ cd -
automation/eclair_analysis/build.sh +2
-0+} +(
- cd xen
+runtime_failures_docs
make "-j${PROCESSORS}" "-l${PROCESSORS}.0" \
"CROSS_COMPILE=${CROSS_COMPILE}" \
"CC=${CROSS_COMPILE}gcc-12" \...? This would make easier to re-use the code.
Quoted 3 lines
I don't expect this build script to be changed much to be honest, but if you think
this is beneficial then it's ok.This is not only about code evolving. It makes easier to spot your are using the same compiler. I would not have made the remark if you were using 'gcc'.
But I noticed you were using gcc-12 and originally thought it was a mistake until I saw the second use.
The advantage of a variable CC (and CXX) is you can add a comment on top why you are specifically requestion gcc-12? IOW, why is gcc not fine?
Quoted 7 lines
Quoted 3 lines
The assumptions in
C-language-toolchain.rst(which are reflected in the analysis config) are using gcc-12 explicitly; that's just easier from a certification perspective to have a fixed version.I am not against fixed version. It just needs to be documented. At least reading
C-language-toolchain.rst, it is not obvious to me that this is only applying to GCC-12.
I did a commit sweep for the old MISRA patches. I didn't commit this series as I imagine it requires a respin.