Support for labels as values (GNU extension)
GNU C / Clang support an extension where the address of a label can be taken as a value and assigned to a variable, and then jumped to using goto.
https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
For example, this small test program:
int main(void)
{
int r;
foo:
r = 4;
void *f = &&foo;
goto *f;
return 0;
}
causes the following errors from FlexeLint:
--- Module: main.c (C)
_
void *f = &&foo;
main.c 8 Error 24: Expected an expression, found '&&'
main.c 8 Error 40: Undeclared identifier 'foo'
_
goto *f;
main.c 11 Error 10: Expecting identifier
Is there some combination of flags that can be used to check code using this extension, or does lint support it somehow?
This extension is supported in the upcoming PC-lint Plus.