| 1 |
// Allowing a file to end without a newline was adopted as a Defect Report in |
| 2 |
// WG21 (CWG787) and in WG14 (added to the list of changes which apply to |
| 3 |
// earlier revisions of C in C2y). So it should not issue a pedantic diagnostic |
| 4 |
// in any language mode. |
| 5 |
|
| 6 |
// RUN: %clang_cc1 -fsyntax-only -Wnewline-eof -verify %s |
| 7 |
// RUN: %clang_cc1 -fsyntax-only -pedantic -verify=good %s |
| 8 |
// RUN: %clang_cc1 -fsyntax-only -std=c89 -pedantic -Wno-comment -verify=good %s |
| 9 |
// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++03 -pedantic -verify=good %s |
| 10 |
// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++11 -Wnewline-eof -verify %s |
| 11 |
// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++11 -Werror -pedantic %s |
| 12 |
// RUN: %clang_cc1 -fsyntax-only -Wnewline-eof %s 2>&1 | FileCheck %s |
| 13 |
// good-no-diagnostics |
| 14 |
|
| 15 |
// Make sure the diagnostic shows up properly at the end of the last line. |
| 16 |
// CHECK: newline-eof.c:[[@LINE+3]]:67 |
| 17 |
|
| 18 |
// The following line isn't terminated, don't fix it. |
| 19 |
void foo(void) {} // expected-warning{{no newline at end of file}} |