macros.c revision 7143aab97c6e849a5a5005b7853b8c7d5af008ed
17143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor// RUN: %clang_cc1 -emit-module -o %t/macros.pcm -DMODULE %s 27143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor// RUN: %clang_cc1 -verify -I %t %s 37143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor 47143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#if defined(MODULE) 57143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#define INTEGER(X) int 67143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#define FLOAT float 77143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#define DOUBLE double 87143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor 97143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#__export_macro__ INTEGER 107143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#__export_macro__ DOUBLE 117143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor 127143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#else 137143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor 147143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor__import_module__ macros; 157143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor 167143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#ifndef INTEGER 177143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor# error INTEGER macro should be visible 187143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#endif 197143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor 207143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#ifdef FLOAT 217143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor# error FLOAT macro should not be visible 227143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#endif 237143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor 247143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#ifdef MODULE 257143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor# error MODULE macro should not be visible 267143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#endif 277143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor 287143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregordouble d; 297143aab97c6e849a5a5005b7853b8c7d5af008edDouglas GregorDOUBLE *dp = &d; 307143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor 317143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#__export_macro__ WIBBLE // expected-error{{no macro named 'WIBBLE' to export}} 327143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor 337143aab97c6e849a5a5005b7853b8c7d5af008edDouglas Gregor#endif 34