Fixes #21650 --- Clang currently inserts an implicit `return 0;` in `main()` when compiling in `C89` mode, even though the `C89` standard doesn't require this behavior. This patch changes that behavior by emitting a warning instead of silently inserting the implicit return under `-pedantic`.
11 lines
458 B
C
11 lines
458 B
C
/* RUN: %clang_cc1 -std=c89 -fsyntax-only -verify -Wno-strict-prototypes -pedantic %s
|
|
* RUN: %clang_cc1 -std=c89 -fsyntax-only -verify -Wno-strict-prototypes -Wmain-return-type %s
|
|
* RUN: %clang_cc1 -std=c89 -fsyntax-only -verify=implicit-main-return -Wno-strict-prototypes -pedantic -Wno-main-return-type %s
|
|
*/
|
|
|
|
/* implicit-main-return-no-diagnostics */
|
|
|
|
int main() {
|
|
|
|
} /* expected-warning {{implicit '0' return value from 'main' is a C99 extension}} */
|