[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [RFC PATCH 2/3] docs: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR
On Tue, Aug 22, 2023 at 12:10:28PM +0200, Jan Beulich wrote: > On 22.08.2023 10:27, Nicola Vetrini wrote: > >>> +C-runtime-failures.c: C-runtime-failures.rst > >>> +# sed is used in place of cat to prevent occurrences of '*/' > >>> +# in the .rst from breaking the compilation > >>> + ( \ > >>> + echo "$${MISRA_HEADER}"; \ > >>> + sed -e 's|*/|*//*|' $<; \ > >>> + echo "$${MISRA_FOOTER}" \ > >>> + ) > $@ > >> > >> The rule of thumb is to generate into a temporary file (then you also > >> don't need to wrap everything in parentheses [or braces]), and then > >> use mv to produce the final output. This escapes anomalies with failed > >> or interrupted commands. > >> > > > > I do see your point for temporary files, though wrapping commands with > > parentheses is a > > fairly common pattern in Xen Makefiles afaict. > > Now I'm curious: Grepping for ') >' underneath xen/ I couldn't find a > single instance in any makefile. (I'm not going to exclude there are a > few uses, but then likely not merely to combine multiple commands' > output.) Maybe using `{ } > out` might be better that using `( ) > out`. I think it would result in one less fork of the shell, without changing the resulting file, so always good to take. You should add also `set -e` at the beginning, to take care of the `sed` command failing. Or just use a temporary file. -- Anthony PERARD
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |