blob: 8fefe7a9cffc24e8db537552e9f9747caa2ffa11 [file] [log] [blame]
Douglas Gregor7143aab2011-09-01 17:04:32 +00001// RUN: %clang_cc1 -emit-module -o %t/macros.pcm -DMODULE %s
Douglas Gregor6e975c42011-09-13 23:15:45 +00002// RUN: %clang_cc1 -verify -fmodule-cache-path %t -fdisable-module-hash %s
Douglas Gregor7143aab2011-09-01 17:04:32 +00003
4#if defined(MODULE)
5#define INTEGER(X) int
6#define FLOAT float
7#define DOUBLE double
8
9#__export_macro__ INTEGER
10#__export_macro__ DOUBLE
11
Douglas Gregorce835df2011-09-14 22:14:14 +000012int (INTEGER);
13
Douglas Gregor7143aab2011-09-01 17:04:32 +000014#else
15
16__import_module__ macros;
17
18#ifndef INTEGER
19# error INTEGER macro should be visible
20#endif
21
22#ifdef FLOAT
23# error FLOAT macro should not be visible
24#endif
25
26#ifdef MODULE
27# error MODULE macro should not be visible
28#endif
29
30double d;
31DOUBLE *dp = &d;
32
33#__export_macro__ WIBBLE // expected-error{{no macro named 'WIBBLE' to export}}
34
Douglas Gregorce835df2011-09-14 22:14:14 +000035void f() {
36 int i = INTEGER; // the value was exported, the macro was not.
37}
Douglas Gregor7143aab2011-09-01 17:04:32 +000038#endif