aboutsummaryrefslogtreecommitdiff
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Misc/warning-flags.c3
-rw-r--r--clang/test/PCH/empty-with-headers.c27
-rw-r--r--clang/test/Parser/completely-empty-header-file.h0
-rw-r--r--clang/test/Parser/empty-translation-unit.c10
-rw-r--r--clang/test/Parser/opencl-pragma.cl2
-rw-r--r--clang/test/Preprocessor/undef-error.c2
-rw-r--r--clang/test/Sema/c89-2.c2
7 files changed, 41 insertions, 5 deletions
diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c
index 98130c5..cdfb38f 100644
--- a/clang/test/Misc/warning-flags.c
+++ b/clang/test/Misc/warning-flags.c
@@ -17,7 +17,7 @@ This test serves two purposes:
The list of warnings below should NEVER grow. It should gradually shrink to 0.
-CHECK: Warnings without flags (242):
+CHECK: Warnings without flags (241):
CHECK-NEXT: ext_anonymous_struct_union_qualified
CHECK-NEXT: ext_binary_literal
CHECK-NEXT: ext_cast_fn_obj
@@ -26,7 +26,6 @@ CHECK-NEXT: ext_designated_init
CHECK-NEXT: ext_duplicate_declspec
CHECK-NEXT: ext_ellipsis_exception_spec
CHECK-NEXT: ext_empty_fnmacro_arg
-CHECK-NEXT: ext_empty_source_file
CHECK-NEXT: ext_enum_friend
CHECK-NEXT: ext_enum_value_not_int
CHECK-NEXT: ext_enumerator_list_comma
diff --git a/clang/test/PCH/empty-with-headers.c b/clang/test/PCH/empty-with-headers.c
new file mode 100644
index 0000000..751be1c
--- /dev/null
+++ b/clang/test/PCH/empty-with-headers.c
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic-errors %s
+// RUN: %clang_cc1 -fsyntax-only -std=c99 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic-errors -include-pch %t %s
+
+// RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic-errors -DINCLUDED %s -verify
+// This last one should warn for -Wempty-translation-unit (C99 6.9p1).
+
+#if defined(INCLUDED)
+
+// empty except for the prefix header
+
+#elif defined(HEADER)
+
+typedef int my_int;
+#define INCLUDED
+
+#else
+
+#define HEADER
+#include "empty-with-headers.c"
+// empty except for the header
+
+#endif
+
+// This should only fire if the header is not included,
+// either explicitly or as a prefix header.
+// expected-error{{ISO C requires a translation unit to contain at least one declaration.}}
diff --git a/clang/test/Parser/completely-empty-header-file.h b/clang/test/Parser/completely-empty-header-file.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Parser/completely-empty-header-file.h
diff --git a/clang/test/Parser/empty-translation-unit.c b/clang/test/Parser/empty-translation-unit.c
new file mode 100644
index 0000000..0dbf37e
--- /dev/null
+++ b/clang/test/Parser/empty-translation-unit.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic -W -verify %s
+// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++03 -pedantic-errors -W %s
+
+#include "completely-empty-header-file.h"
+// no-warning -- an empty file is OK
+
+#define A_MACRO_IS_NOT_GOOD_ENOUGH 1
+
+// In C we should get this warning, but in C++ we shouldn't.
+// expected-warning{{ISO C requires a translation unit to contain at least one declaration.}}
diff --git a/clang/test/Parser/opencl-pragma.cl b/clang/test/Parser/opencl-pragma.cl
index 1946077..4c48b2a 100644
--- a/clang/test/Parser/opencl-pragma.cl
+++ b/clang/test/Parser/opencl-pragma.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -verify -pedantic -Wno-empty-translation-unit -fsyntax-only
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
diff --git a/clang/test/Preprocessor/undef-error.c b/clang/test/Preprocessor/undef-error.c
index ad611de..959c163 100644
--- a/clang/test/Preprocessor/undef-error.c
+++ b/clang/test/Preprocessor/undef-error.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -pedantic-errors -verify
+// RUN: %clang_cc1 %s -pedantic-errors -Wno-empty-translation-unit -verify
// PR2045
#define b
diff --git a/clang/test/Sema/c89-2.c b/clang/test/Sema/c89-2.c
index f6f6bd9..14b955a 100644
--- a/clang/test/Sema/c89-2.c
+++ b/clang/test/Sema/c89-2.c
@@ -1,4 +1,4 @@
-/* RUN: %clang_cc1 %s -std=c89 -pedantic-errors -verify
+/* RUN: %clang_cc1 %s -std=c89 -pedantic-errors -Wno-empty-translation-unit -verify
*/
#if 1LL /* expected-error {{long long}} */