-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake: sparse.template: add COMMAND_ERROR_IS_FATAL #67036
cmake: sparse.template: add COMMAND_ERROR_IS_FATAL #67036
Conversation
There are some situations like zephyrproject-rtos#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 <marc.herbert@intel.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
More generally speaking, the default behavior of execute_process() to
ignore errors is crazy.
and to top it, it was not until CMake 3.19 that COMMAND_ERROR_IS_FATAL
was introduced.
Until then you actually had to use RESULT_VARIABLE
/ RESULTS_VARIABLE
to get return code, and then use an if()
test to decide if execution should be aborted.
Hence a reason why most execute_process()
calls are not using COMMAND_ERROR_IS_FATAL
.
Thanks for this cleanup.
Thanks for the review and additional context.
Time for a big search/replace? |
Just a one-word long, CMake option fix... anyone besides Torsten? |
There are some situations like #67035 or #63003 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?