In most projects a definite pattern that's unlikely to be executed is a
PRINT_ERR macro which is basically a wrapper around fprintf() call. E.g.
if (some_error) {
PRINT_ERR("ERR");
// do cleanup
return;
}
I wonder, is there a way to hint GCC that, whenever that code appears,
whatever branch was prior to that is unlikely to be executed? E.g. can I
add a `__builtin_expect(1, 0)` just before the fprintf, or is there
anything alike?
I realize I have to use __builtin_expect() inside an `if(some_error)`
condition, but it's not future-proof and clutters the code (the
documentation for the built-in warns against its usage for a reason, I
guess).