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