I have macro like this:
#define error_exit(format, ...) \
error_at_line(EXIT_FAILURE, 0, __FILE__, __LINE__, format, ##__VA_ARGS__)
that I use to as a general fatal error function. Unfortunately, error_at_line doesn’t have the noreturn gcc attribute because if you specify 0 as the first argument it does return. This causes problems, specifically, I get uninitialized variable warnings because gcc can’t figure out that error_exit will never return.
For example:
int x;
switch(...) {
case VALID:
x = 1;
break;
default:
error_exit(...);
}
return x;
gives me warning. So, how can I go about apply noreturn to a macro or even specific function invocation?
Assuming GCC ≥ 4.5.0,