3 ms·
clang and gcc now warn of that. $ gcc-12 -g -O2 -std=c11 -Wall -Wextra -Wpedantic -Werror c-error.c c-error.c:2:10: error: return type of ‘main’ is not ‘in
by dfawcus 2y ago
clang and gcc now warn of that.
$ gcc-12 -g -O2 -std=c11 -Wall -Wextra -Wpedantic -Werror c-error.c
c-error.c:2:10: error: return type of ‘main’ is not ‘int’ [-Werror=main]
2 | void main()
| ^~~~
c-error.c: In function ‘main’:
c-error.c:5:9: error: this ‘for’ clause does not guard... [-Werror=misleading-indentation]
5 | for (i = 0; i < 10; ++i);
| ^~~
c-error.c:6:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
6 | printf("%d\n", i);
| ^~~~~~
cc1: all warnings being treated as errors
and:
$ clang-14 -g -O2 -std=c11 -Wall -Wextra -Wpedantic -Werror c-error.c
c-error.c:2:5: error: 'main' must return 'int'
void main()
^~~~
int
c-error.c:5:33: error: for loop has empty body [-Werror,-Wempty-body]
for (i = 0; i < 10; ++i);
^
c-error.c:5:33: note: put the semicolon on a separate line to silence this warning
2 errors generated.
Now granted, those are specific implementations, not things mandated by language changes.