]> granicus.if.org Git - clang/commitdiff
Expose no newline at end of file warning under Wnewline-eof flag.
authorAnna Zaks <ganna@apple.com>
Fri, 22 Jul 2011 23:08:19 +0000 (23:08 +0000)
committerAnna Zaks <ganna@apple.com>
Fri, 22 Jul 2011 23:08:19 +0000 (23:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135822 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticLexKinds.td
test/Lexer/newline-eof.c [new file with mode: 0644]

index 38d6a8001655922397dceb23e047246a4585338e..b93912213ab80256644b9f3300351e8047e8a868 100644 (file)
@@ -38,7 +38,8 @@ def ext_multi_line_bcpl_comment : Extension<"multi-line // comment">,
 def ext_bcpl_comment : Extension<
   "// comments are not allowed in this language">,
   InGroup<Comment>;
-def ext_no_newline_eof : Extension<"no newline at end of file">;
+def ext_no_newline_eof : Extension<"no newline at end of file">, 
+  InGroup<DiagGroup<"newline-eof">>;
 def ext_backslash_newline_eof : Extension<"backslash-newline at end of file">;
 def ext_dollar_in_identifier : Extension<"'$' in identifier">;
 def charize_microsoft_ext : Extension<"@# is a microsoft extension">;
diff --git a/test/Lexer/newline-eof.c b/test/Lexer/newline-eof.c
new file mode 100644 (file)
index 0000000..2f95dc7
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: %clang -fsyntax-only -Wnewline-eof -verify %s 
+// rdar://9133072
+
+// The following line isn't terminated, don't fix it.
+void foo() {} // expected-warning{{No newline at end of file}}
\ No newline at end of file