Bruno Haible <br...@clisp.org> writes: >> Do gcc and clang not warn about this? > > With option '-pedantic', they warn, yes: > > $ cat foo.c > extern void foobar (int); > void foo (int x) { return foobar (x); } > > $ gcc -Wall -S -pedantic foo.c > foo.c: In function ‘foo’: > foo.c:2:27: warning: ISO C forbids ‘return’ with expression, in function > returning void [-Wpedantic] > 2 | void foo (int x) { return foobar (x); } > | ^~~~~~~~~~ > > $ clang -Wall -S -pedantic foo.c > foo.c:2:20: warning: void function 'foo' should not return void expression > [-Wpedantic] > 2 | void foo (int x) { return foobar (x); } > | ^ ~~~~~~~~~~ > > I thought that 'return' of a void expression was documented as a GCC > extension. But I can't find it in the documentation now.
Interesting, good to know. Thanks for the info. Collin