-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect -Wnewline-eof even in C++11 mode.
If the user has requested this warning, we should emit it, even if it's not an extension in the current language mode. However, being an extension is more important, so prefer the pedantic warning or the pedantic-compatibility warning if those are enabled. <rdar://problem/12922063> llvm-svn: 189110
- Loading branch information
1 parent
c7cda1c
commit 4c55d45
Showing
6 changed files
with
36 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| // RUN: %clang_cc1 -fsyntax-only -Wc++98-compat-pedantic -std=c++11 -verify %s | ||
| // RUN: %clang_cc1 -fsyntax-only -Wc++98-compat-pedantic -Wnewline-eof -std=c++11 -verify %s | ||
|
|
||
| // The following line isn't terminated, don't fix it. | ||
| void foo() {} // expected-warning{{C++98 requires newline at end of file}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,15 @@ | ||
| // RUN: %clang_cc1 -fsyntax-only -Wnewline-eof -verify %s | ||
| // RUN: %clang_cc1 -fsyntax-only -Wnewline-eof %s 2>&1 | FileCheck %s | ||
| // RUN: %clang -fsyntax-only -Wnewline-eof -verify %s | ||
| // RUN: %clang -fsyntax-only -pedantic -verify %s | ||
| // RUN: %clang -fsyntax-only -x c++ -std=c++03 -pedantic -verify %s | ||
| // RUN: %clang -fsyntax-only -Wnewline-eof %s 2>&1 | FileCheck %s | ||
| // rdar://9133072 | ||
|
|
||
| // In C++11 mode, this is allowed, so don't warn in pedantic mode. | ||
| // RUN: %clang -fsyntax-only -x c++ -std=c++11 -Wnewline-eof -verify %s | ||
| // RUN: %clang -fsyntax-only -x c++ -std=c++11 -pedantic %s | ||
|
|
||
| // Make sure the diagnostic shows up properly at the end of the last line. | ||
| // CHECK: newline-eof.c:9:63 | ||
| // CHECK: newline-eof.c:[[@LINE+3]]:63 | ||
|
|
||
| // The following line isn't terminated, don't fix it. | ||
| void foo() {} // expected-warning{{no newline at end of file}} |