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