Home | History | Annotate | Download | only in Modules
      1 // RUN: %clang_cc1 -emit-module -o %t/macros.pcm -DMODULE %s
      2 // RUN: %clang_cc1 -verify -fmodule-cache-path %t -fdisable-module-hash %s
      3 // RUN: %clang_cc1 -E -fmodule-cache-path %t -fdisable-module-hash %s | FileCheck -check-prefix CHECK-PREPROCESSED %s
      4 
      5 #if defined(MODULE)
      6 #define INTEGER(X) int
      7 #define FLOAT float
      8 #define DOUBLE double
      9 
     10 #__export_macro__ INTEGER
     11 #__private_macro__ FLOAT
     12 #__private_macro__ MODULE
     13 
     14 int (INTEGER);
     15 
     16 #else
     17 
     18 __import_module__ macros;
     19 
     20 #ifndef INTEGER
     21 #  error INTEGER macro should be visible
     22 #endif
     23 
     24 #ifdef FLOAT
     25 #  error FLOAT macro should not be visible
     26 #endif
     27 
     28 #ifdef MODULE
     29 #  error MODULE macro should not be visible
     30 #endif
     31 
     32 // CHECK-PREPROCESSED: double d
     33 double d;
     34 DOUBLE *dp = &d;
     35 
     36 #__export_macro__ WIBBLE // expected-error{{no macro named 'WIBBLE' to export}}
     37 
     38 void f() {
     39   // CHECK-PREPROCESSED: int i = INTEGER;
     40   int i = INTEGER; // the value was exported, the macro was not.
     41 }
     42 #endif
     43