xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/config_macros.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc@import config;
2f4a2713aSLionel Sambuc
3f4a2713aSLionel Sambucint *test_foo() {
4f4a2713aSLionel Sambuc  return foo();
5f4a2713aSLionel Sambuc}
6f4a2713aSLionel Sambuc
7f4a2713aSLionel Sambucchar *test_bar() {
8f4a2713aSLionel Sambuc  return bar(); // expected-warning{{implicit declaration of function 'bar' is invalid in C99}} \
9f4a2713aSLionel Sambuc                // expected-warning{{incompatible integer to pointer conversion}}
10f4a2713aSLionel Sambuc}
11f4a2713aSLionel Sambuc
12f4a2713aSLionel Sambuc#undef WANT_FOO // expected-note{{macro was #undef'd here}}
13f4a2713aSLionel Sambuc@import config; // expected-warning{{#undef of configuration macro 'WANT_FOO' has no effect on the import of 'config'; pass '-UWANT_FOO' on the command line to configure the module}}
14f4a2713aSLionel Sambuc
15f4a2713aSLionel Sambuc#define WANT_FOO 2 // expected-note{{macro was defined here}}
16f4a2713aSLionel Sambuc@import config; // expected-warning{{definition of configuration macro 'WANT_FOO' has no effect on the import of 'config'; pass '-DWANT_FOO=...' on the command line to configure the module}}
17f4a2713aSLionel Sambuc
18f4a2713aSLionel Sambuc#undef WANT_FOO
19f4a2713aSLionel Sambuc#define WANT_FOO 1
20f4a2713aSLionel Sambuc@import config; // okay
21f4a2713aSLionel Sambuc
22f4a2713aSLionel Sambuc#define WANT_BAR 1 // expected-note{{macro was defined here}}
23f4a2713aSLionel Sambuc@import config; // expected-warning{{definition of configuration macro 'WANT_BAR' has no effect on the import of 'config'; pass '-DWANT_BAR=...' on the command line to configure the module}}
24f4a2713aSLionel Sambuc
25f4a2713aSLionel Sambuc// RUN: rm -rf %t
26f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fmodules -x objective-c -fmodules-cache-path=%t -DWANT_FOO=1 -emit-module -fmodule-name=config %S/Inputs/module.map
27*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs -DWANT_FOO=1 %s -verify
28f4a2713aSLionel Sambuc
29