File: header.cpp

package info (click to toggle)
llvm-toolchain-3.4 1%3A3.4.2-13
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 253,236 kB
  • ctags: 276,203
  • sloc: cpp: 1,665,580; ansic: 298,647; asm: 206,157; objc: 84,350; python: 73,119; sh: 23,466; perl: 5,679; makefile: 5,542; ml: 5,250; pascal: 2,467; lisp: 1,420; xml: 679; cs: 236; csh: 117
file content (44 lines) | stat: -rw-r--r-- 1,957 bytes parent folder | download | duplicates (28)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// RUN: %clang_cc1 -fsyntax-only -Wno-header-guard %s
// RUN: %clang_cc1 -fsyntax-only -Wheader-guard %s 2>&1 | FileCheck %s

#include "Inputs/good-header-guard.h"
#include "Inputs/no-define.h"
#include "Inputs/different-define.h"
#include "Inputs/out-of-order-define.h"
#include "Inputs/tokens-between-ifndef-and-define.h"
#include "Inputs/unlikely-to-be-header-guard.h"

#include "Inputs/bad-header-guard.h"
// CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}:
// 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
// CHECK: {{^}}#ifndef bad_header_guard
// CHECK: {{^}}        ^~~~~~~~~~~~~~~~
// CHECK: {{.*}}bad-header-guard.h:2:9: note: 'bad_guard' is defined here; did you mean 'bad_header_guard'?
// CHECK: {{^}}#define bad_guard
// CHECK: {{^}}        ^~~~~~~~~
// CHECK: {{^}}        bad_header_guard

#include "Inputs/bad-header-guard-defined.h"
// CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}:
// CHECK: {{.*}}bad-header-guard-defined.h:1:2: warning: 'foo' is used as a header guard here, followed by #define of a different macro
// CHECK: {{^}}#if !defined(foo)
// CHECK: {{^}} ^~
// CHECK: {{.*}}bad-header-guard-defined.h:2:9: note: 'goo' is defined here; did you mean 'foo'?
// CHECK: {{^}}#define goo
// CHECK: {{^}}        ^~~
// CHECK: {{^}}        foo

#include "Inputs/multiple.h"
#include "Inputs/multiple.h"
#include "Inputs/multiple.h"
#include "Inputs/multiple.h"
// CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}:
// CHECK: {{.*}}multiple.h:1:9: warning: 'multiple' is used as a header guard here, followed by #define of a different macro
// CHECK: {{^}}#ifndef multiple
// CHECK: {{^}}        ^~~~~~~~
// CHECK: {{.*}}multiple.h:2:9: note: 'multi' is defined here; did you mean 'multiple'?
// CHECK: {{^}}#define multi
// CHECK: {{^}}        ^~~~~
// CHECK: {{^}}        multiple

// CHECK: 3 warnings generated.