xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/empty-with-headers.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic-errors %s
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c99 -emit-pch -o %t %s
3*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic-errors -include-pch %t %s
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic-errors -DINCLUDED %s -verify
6*f4a2713aSLionel Sambuc // This last one should warn for -Wempty-translation-unit (C99 6.9p1).
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc #if defined(INCLUDED)
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc // empty except for the prefix header
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc #elif defined(HEADER)
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc typedef int my_int;
15*f4a2713aSLionel Sambuc #define INCLUDED
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc #else
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc #define HEADER
20*f4a2713aSLionel Sambuc #include "empty-with-headers.c"
21*f4a2713aSLionel Sambuc // empty except for the header
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc #endif
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc // This should only fire if the header is not included,
26*f4a2713aSLionel Sambuc // either explicitly or as a prefix header.
27*f4a2713aSLionel Sambuc // expected-error{{ISO C requires a translation unit to contain at least one declaration}}
28