xref: /llvm-project/clang/test/Lexer/newline-eof.c (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1 // RUN: %clang_cc1 -fsyntax-only -Wnewline-eof -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
3 // RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++03 -pedantic -verify %s
4 // RUN: %clang_cc1 -fsyntax-only -Wnewline-eof %s 2>&1 | FileCheck %s
5 
6 // In C++11 mode, this is allowed, so don't warn in pedantic mode.
7 // RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++11 -Wnewline-eof -verify %s
8 // RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++11 -Werror -pedantic %s
9 
10 // Make sure the diagnostic shows up properly at the end of the last line.
11 // CHECK: newline-eof.c:[[@LINE+3]]:67
12 
13 // The following line isn't terminated, don't fix it.
foo(void)14 void foo(void) {} // expected-warning{{no newline at end of file}}