Skip to content

Commit d4b0273

Browse files
marc-hbfabiobaltieri
authored andcommitted
cmake: sparse.template: add COMMAND_ERROR_IS_FATAL
There are some situations like #67035 where sparse aborts and returns an error code before the compiler has generated the .obj file; without any clear indication that the .obj is missing (in normal situations sparse prints warnings and _does_ creates the .obj file) Also, builds are parallel by default and sparse runs tend to be massive walls of text which all conspires to make it totally impossible to find the relevant error message. Instead, we get an link-time error. The only clear indication is the exit code. So catch it and abort the build ASAP thanks to COMMAND_ERROR_IS_FATAL. More generally speaking, the default behavior of execute_process() to ignore errors is crazy. How frequently does a build system run commands that do NOT matter? Signed-off-by: Marc Herbert <[email protected]>
1 parent ca8ee0e commit d4b0273

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmake/sca/sparse/sparse.template

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ endforeach()
1616
foreach(i RANGE ${end_of_options} ${CMAKE_ARGC})
1717
list(APPEND ARGS ${CMAKE_ARGV${i}})
1818
endforeach()
19-
execute_process(COMMAND @CMAKE_COMMAND@ -E env REAL_CC=@CMAKE_C_COMPILER@ @SPARSE_COMPILER@ ${ARGS})
19+
execute_process(COMMAND @CMAKE_COMMAND@ -E env REAL_CC=@CMAKE_C_COMPILER@ @SPARSE_COMPILER@ ${ARGS}
20+
COMMAND_ERROR_IS_FATAL ANY
21+
)

0 commit comments

Comments
 (0)