-
Notifications
You must be signed in to change notification settings - Fork 91
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
Experiment: Lots of small C code fixes #2070
Conversation
Most of these were found using static analysis. Change should not result in any functional changes, just cleaner code.
coco_get_biobj_problem could return invalid results for invalid function indexes. Instead, raise a coco_error().
coco_error() never returns by calling exit(). Let the compiler know that coco_error() cannot return to improve the results from static analysis.
code-experiments/src/coco.h
Outdated
@@ -465,7 +465,7 @@ void coco_free_memory(void *data); | |||
/** | |||
* @brief Signals a fatal error. | |||
*/ | |||
void coco_error(const char *message, ...); | |||
void coco_error(const char *message, ...) __attribute__((noreturn)) __attribute__((__noreturn__)); |
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.
This seems to be the culprit for the AppVeyor failure
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.
I've hidden the attributes behind macros which are defined based on the used compiler. Let's hope this fixes it.
Lots of small code fixes to catch more edge cases, remove dead code.