1 // RUN: %clang_cc1 -fsyntax-only -Wno-header-guard %s 2 // RUN: %clang_cc1 -fsyntax-only -Wheader-guard %s 2>&1 | FileCheck %s 3 4 #include "Inputs/good-header-guard.h" 5 #include "Inputs/no-define.h" 6 #include "Inputs/different-define.h" 7 #include "Inputs/out-of-order-define.h" 8 #include "Inputs/tokens-between-ifndef-and-define.h" 9 10 #include "Inputs/bad-header-guard.h" 11 // CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}: 12 // CHECK: {{.*}}bad-header-guard.h:1:9: warning: 'bad_header_guard' is used as a header guard here, followed by #define of a different macro 13 // CHECK: {{^}}#ifndef bad_header_guard 14 // CHECK: {{^}} ^~~~~~~~~~~~~~~~ 15 // CHECK: {{.*}}bad-header-guard.h:2:9: note: 'bad_guard' is defined here; did you mean 'bad_header_guard'? 16 // CHECK: {{^}}#define bad_guard 17 // CHECK: {{^}} ^~~~~~~~~ 18 // CHECK: {{^}} bad_header_guard 19 20 #include "Inputs/multiple.h" 21 #include "Inputs/multiple.h" 22 #include "Inputs/multiple.h" 23 #include "Inputs/multiple.h" 24 // CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}: 25 // CHECK: {{.*}}multiple.h:1:9: warning: 'multiple' is used as a header guard here, followed by #define of a different macro 26 // CHECK: {{^}}#ifndef multiple 27 // CHECK: {{^}} ^~~~~~~~ 28 // CHECK: {{.*}}multiple.h:2:9: note: 'multi' is defined here; did you mean 'multiple'? 29 // CHECK: {{^}}#define multi 30 // CHECK: {{^}} ^~~~~ 31 // CHECK: {{^}} multiple 32 33 // CHECK: 2 warnings generated. 34