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