Douglas Gregor | 7143aab | 2011-09-01 17:04:32 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-module -o %t/macros.pcm -DMODULE %s |
Douglas Gregor | 6e975c4 | 2011-09-13 23:15:45 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -verify -fmodule-cache-path %t -fdisable-module-hash %s |
Douglas Gregor | 7143aab | 2011-09-01 17:04:32 +0000 | [diff] [blame] | 3 | |
| 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 Gregor | ce835df | 2011-09-14 22:14:14 +0000 | [diff] [blame^] | 12 | int (INTEGER); |
| 13 | |
Douglas Gregor | 7143aab | 2011-09-01 17:04:32 +0000 | [diff] [blame] | 14 | #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 | |
| 30 | double d; |
| 31 | DOUBLE *dp = &d; |
| 32 | |
| 33 | #__export_macro__ WIBBLE // expected-error{{no macro named 'WIBBLE' to export}} |
| 34 | |
Douglas Gregor | ce835df | 2011-09-14 22:14:14 +0000 | [diff] [blame^] | 35 | void f() { |
| 36 | int i = INTEGER; // the value was exported, the macro was not. |
| 37 | } |
Douglas Gregor | 7143aab | 2011-09-01 17:04:32 +0000 | [diff] [blame] | 38 | #endif |