xref: /llvm-project/clang/test/Driver/m-and-mm.c (revision 55abd2b2956f91e3f69b375b22ab0f848e08aa20)
1 // RUN: %clang -M %s 2>&1 | FileCheck %s --implicit-check-not=warning
2 // RUN: %clang -MM %s 2>&1 | FileCheck %s --implicit-check-not=warning
3 
4 // CHECK: m-and-mm.o:
5 // TEST-I: {{.*}}test.i:
6 // TEST: {{.*}}test:
7 
8 // RUN: mkdir -p %t.dir
9 
10 /// if -MD and -MMD are not specified, -o specifies the dependency file name.
11 // RUN: rm -f %t.dir/test.i
12 // RUN: %clang -M %s -o %t.dir/test.i
13 // RUN: FileCheck %s < %t.dir/test.i
14 // RUN: rm -f %t.dir/test.i
15 // RUN: %clang -MM %s -o %t.dir/test.i
16 // RUN: FileCheck %s < %t.dir/test.i
17 
18 // RUN: rm -f %t.dir/test.d
19 // RUN: %clang -fsyntax-only -MD %s -o %t.dir/test.i
20 // RUN: FileCheck --check-prefix=TEST-I %s < %t.dir/test.d
21 
22 // RUN: rm -f %t.dir/test.d
23 // RUN: %clang -M -MD %s -o %t.dir/test.i
24 // RUN: FileCheck --check-prefix=TEST-I %s < %t.dir/test.d
25 
26 /// If the output file name does not have a suffix, just append `.d`.
27 // RUN: rm -f %t.dir/test.d
28 // RUN: %clang -fsyntax-only -MD %s -o %t.dir/test
29 // RUN: FileCheck --check-prefix=TEST %s < %t.dir/test.d
30 
31 #warning "-M and -MM suppresses warnings, thus this warning shouldn't show up"
main(void)32 int main(void)
33 {
34     return 0;
35 }
36