brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 34ed268 Raw
45 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -Wno-header-guard %s2// RUN: %clang_cc1 -fsyntax-only -Wheader-guard -fno-diagnostics-show-line-numbers %s 2>&1 | FileCheck %s3 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#include "Inputs/unlikely-to-be-header-guard.h"10 11#include "Inputs/bad-header-guard.h"12// CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}:13// CHECK: {{.*}}bad-header-guard.h:1:9: warning: 'bad_header_guard' is used as a header guard here, followed by #define of a different macro14// CHECK: {{^}}#ifndef bad_header_guard15// CHECK: {{^}}        ^~~~~~~~~~~~~~~~16// CHECK: {{.*}}bad-header-guard.h:2:9: note: 'bad_guard' is defined here; did you mean 'bad_header_guard'?17// CHECK: {{^}}#define bad_guard18// CHECK: {{^}}        ^~~~~~~~~19// CHECK: {{^}}        bad_header_guard20 21#include "Inputs/bad-header-guard-defined.h"22// CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}:23// CHECK: {{.*}}bad-header-guard-defined.h:1:2: warning: 'foo' is used as a header guard here, followed by #define of a different macro24// CHECK: {{^}}#if !defined(foo)25// CHECK: {{^}} ^~26// CHECK: {{.*}}bad-header-guard-defined.h:2:9: note: 'goo' is defined here; did you mean 'foo'?27// CHECK: {{^}}#define goo28// CHECK: {{^}}        ^~~29// CHECK: {{^}}        foo30 31#include "Inputs/multiple.h"32#include "Inputs/multiple.h"33#include "Inputs/multiple.h"34#include "Inputs/multiple.h"35// CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}:36// CHECK: {{.*}}multiple.h:1:9: warning: 'multiple' is used as a header guard here, followed by #define of a different macro37// CHECK: {{^}}#ifndef multiple38// CHECK: {{^}}        ^~~~~~~~39// CHECK: {{.*}}multiple.h:2:9: note: 'multi' is defined here; did you mean 'multiple'?40// CHECK: {{^}}#define multi41// CHECK: {{^}}        ^~~~~42// CHECK: {{^}}        multiple43 44// CHECK: 3 warnings generated.45