From: Lubos Lunak Date: Wed, 18 Sep 2019 19:12:14 +0000 (+0000) Subject: actually also compile output in tests for -frewrite-includes X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=145d99a86a154481fd062c3702b025094a70aacd;p=clang actually also compile output in tests for -frewrite-includes Checking that the created output matches something is nice, but this should also check whether the output makes sense. Differential Revision: https://reviews.llvm.org/D63979 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372250 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Frontend/Inputs/NextIncludes/rewrite-includes9.h b/test/Frontend/Inputs/NextIncludes/rewrite-includes9.h index b074bd1a44..75e4c963fd 100644 --- a/test/Frontend/Inputs/NextIncludes/rewrite-includes9.h +++ b/test/Frontend/Inputs/NextIncludes/rewrite-includes9.h @@ -1 +1 @@ -included_line9 +int included_line9; diff --git a/test/Frontend/Inputs/rewrite-includes1.h b/test/Frontend/Inputs/rewrite-includes1.h index 1b6c80d5f4..3312f9ff90 100644 --- a/test/Frontend/Inputs/rewrite-includes1.h +++ b/test/Frontend/Inputs/rewrite-includes1.h @@ -1,3 +1,3 @@ #pragma clang system_header -included_line1 +int included_line1; #include "rewrite-includes2.h" diff --git a/test/Frontend/Inputs/rewrite-includes2.h b/test/Frontend/Inputs/rewrite-includes2.h index 1114e51cc1..d1097c8e17 100644 --- a/test/Frontend/Inputs/rewrite-includes2.h +++ b/test/Frontend/Inputs/rewrite-includes2.h @@ -1 +1 @@ -included_line2 +int included_line2; diff --git a/test/Frontend/Inputs/rewrite-includes3.h b/test/Frontend/Inputs/rewrite-includes3.h index 3757bc8b34..2abf780590 100644 --- a/test/Frontend/Inputs/rewrite-includes3.h +++ b/test/Frontend/Inputs/rewrite-includes3.h @@ -1 +1 @@ -included_line3 +unsigned int included_line3 = -10; diff --git a/test/Frontend/Inputs/rewrite-includes4.h b/test/Frontend/Inputs/rewrite-includes4.h index b4e25d26f6..7a442013f7 100644 --- a/test/Frontend/Inputs/rewrite-includes4.h +++ b/test/Frontend/Inputs/rewrite-includes4.h @@ -1 +1 @@ -included_line4 +int included_line4; diff --git a/test/Frontend/Inputs/rewrite-includes5.h b/test/Frontend/Inputs/rewrite-includes5.h index 934bf413e5..0de12113cb 100644 --- a/test/Frontend/Inputs/rewrite-includes5.h +++ b/test/Frontend/Inputs/rewrite-includes5.h @@ -1 +1 @@ -included_line5 +int included_line5; diff --git a/test/Frontend/Inputs/rewrite-includes6.h b/test/Frontend/Inputs/rewrite-includes6.h index c18e5013af..5d89144623 100644 --- a/test/Frontend/Inputs/rewrite-includes6.h +++ b/test/Frontend/Inputs/rewrite-includes6.h @@ -1,2 +1,2 @@ #pragma once -included_line6 +int included_line6; diff --git a/test/Frontend/Inputs/rewrite-includes7.h b/test/Frontend/Inputs/rewrite-includes7.h index da00d4fb97..221bab82df 100644 --- a/test/Frontend/Inputs/rewrite-includes7.h +++ b/test/Frontend/Inputs/rewrite-includes7.h @@ -1,4 +1,4 @@ #ifndef REWRITE_INCLUDES_7 #define REWRITE_INCLUDES_7 -included_line7 +int included_line7; #endif diff --git a/test/Frontend/rewrite-includes-cli-include.c b/test/Frontend/rewrite-includes-cli-include.c index ba96039bdd..d63f966f79 100644 --- a/test/Frontend/rewrite-includes-cli-include.c +++ b/test/Frontend/rewrite-includes-cli-include.c @@ -2,7 +2,7 @@ main_file_line // CHECK: {{^}}# 1 ""{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes2.h" 1{{$}} -// CHECK-NEXT: {{^}}included_line2{{$}} +// CHECK-NEXT: {{^}}int included_line2;{{$}} // CHECK-NEXT: {{^}}# 1 "" 2{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*}}rewrite-includes-cli-include.c"{{$}} // CHECK-NEXT: FileCheck diff --git a/test/Frontend/rewrite-includes-conditions.c b/test/Frontend/rewrite-includes-conditions.c index ec05805032..57a2e0d160 100644 --- a/test/Frontend/rewrite-includes-conditions.c +++ b/test/Frontend/rewrite-includes-conditions.c @@ -1,26 +1,27 @@ -// RUN: %clang_cc1 -verify -E -frewrite-includes -I %S/Inputs %s -o - | FileCheck -strict-whitespace %s -// expected-no-diagnostics +// RUN: %clang_cc1 -E -frewrite-includes -I %S/Inputs %s -o - | FileCheck -strict-whitespace %s +// RUN: %clang_cc1 -E -frewrite-includes -I %S/Inputs %s -o - | %clang_cc1 -Wall -Wextra -Wconversion -x c -fsyntax-only 2>&1 | FileCheck -check-prefix=COMPILE --implicit-check-not warning: %s #define value1 1 #if value1 -line1 +int line1; #else -line2 +int line2; #endif #define value2 2 #if value1 == value2 -line3 +int line3; #elif value1 > value2 -line4 +int line4; #elif value1 < value2 -line5 +int line5; #else -line6 +int line6; #endif -#if __has_include() +#if __has_include() +#include #endif #define HAS_INCLUDE(x) __has_include(x) @@ -35,13 +36,15 @@ commented out #if value1 < value2 \ || value1 != value2 -line7 +int line7; #endif #if value1 /* */ #endif +static int unused; + // ENDCOMPARE // CHECK: #if 0 /* disabled by -frewrite-includes */ @@ -75,7 +78,7 @@ line7 // CHECK-NEXT: # 18 "{{.*}}rewrite-includes-conditions.c" // CHECK: #if 0 /* disabled by -frewrite-includes */ -// CHECK-NEXT: #if __has_include() +// CHECK-NEXT: #if __has_include() // CHECK-NEXT: #endif // CHECK-NEXT: #endif /* disabled by -frewrite-includes */ // CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */ @@ -86,7 +89,7 @@ line7 // CHECK-NEXT: #endif // CHECK-NEXT: #endif /* disabled by -frewrite-includes */ // CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */ -// CHECK-NEXT: # 29 "{{.*}}rewrite-includes-conditions.c" +// CHECK-NEXT: # 30 "{{.*}}rewrite-includes-conditions.c" // CHECK: #if 0 /* disabled by -frewrite-includes */ // CHECK-NEXT: #if value1 < value2 \ @@ -94,7 +97,7 @@ line7 // CHECK-NEXT: #endif // CHECK-NEXT: #endif /* disabled by -frewrite-includes */ // CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */ -// CHECK-NEXT: # 38 "{{.*}}rewrite-includes-conditions.c" +// CHECK-NEXT: # 39 "{{.*}}rewrite-includes-conditions.c" // CHECK: #if 0 /* disabled by -frewrite-includes */ // CHECK-NEXT: #if value1 /* @@ -102,6 +105,9 @@ line7 // CHECK-NEXT: #endif // CHECK-NEXT: #endif /* disabled by -frewrite-includes */ // CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */ -// CHECK-NEXT: # 43 "{{.*}}rewrite-includes-conditions.c" +// CHECK-NEXT: # 44 "{{.*}}rewrite-includes-conditions.c" // CHECK: {{^}}// ENDCOMPARE{{$}} + +// COMPILE: Inputs/rewrite-includes3.h:1:31: warning: implicit conversion changes signedness: +// COMPILE: rewrite-includes-conditions.c:46:12: warning: unused variable 'unused' diff --git a/test/Frontend/rewrite-includes.c b/test/Frontend/rewrite-includes.c index ec8c4130e3..cf5c296bac 100644 --- a/test/Frontend/rewrite-includes.c +++ b/test/Frontend/rewrite-includes.c @@ -1,8 +1,9 @@ -// RUN: not %clang_cc1 -verify -E -frewrite-includes -DFIRST -I %S/Inputs -I %S/Inputs/NextIncludes %s -o - | FileCheck -strict-whitespace %s -// RUN: not %clang_cc1 -verify -E -frewrite-includes -P -DFIRST -I %S/Inputs -I %S/Inputs/NextIncludes %s -o - | FileCheck -check-prefix=CHECKNL -strict-whitespace %s +// RUN: %clang_cc1 -E -frewrite-includes -DFIRST -I %S/Inputs -I %S/Inputs/NextIncludes %s -o - | FileCheck -strict-whitespace %s +// RUN: %clang_cc1 -E -frewrite-includes -P -DFIRST -I %S/Inputs -I %S/Inputs/NextIncludes %s -o - | FileCheck -check-prefix=CHECKNL -strict-whitespace %s +// RUN: %clang_cc1 -E -frewrite-includes -DFIRST -I %S/Inputs -I %S/Inputs/NextIncludes %s -o - | %clang_cc1 -Wall -Wextra -Wconversion -DFIRST -x c -fsyntax-only 2>&1 | FileCheck -check-prefix=COMPILE --implicit-check-not warning: %s // STARTCOMPARE #define A(a,b) a ## b -A(1,2) +A(in,t) a; #include "rewrite-includes1.h" #ifdef FIRST #define HEADER "rewrite-includes3.h" @@ -21,94 +22,95 @@ A(1,2) #include "rewrite-includes7.h" #include "rewrite-includes8.h" #include "rewrite-includes9.h" +static int unused; // ENDCOMPARE // CHECK: {{^}}# 1 "{{.*}}rewrite-includes.c"{{$}} // CHECK: {{^}}// STARTCOMPARE{{$}} // CHECK-NEXT: {{^}}#define A(a,b) a ## b{{$}} -// CHECK-NEXT: {{^}}A(1,2){{$}} +// CHECK-NEXT: {{^}}A(in,t) a;{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes1.h"{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECK-NEXT: {{^}}# 6 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}# 7 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes1.h" 1{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#pragma clang system_header{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 2 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes1.h" 3{{$}} -// CHECK-NEXT: {{^}}included_line1{{$}} +// CHECK-NEXT: {{^}}int included_line1;{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes2.h"{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 3 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes1.h" 3{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes2.h" 1 3{{$}} -// CHECK-NEXT: {{^}}included_line2{{$}} +// CHECK-NEXT: {{^}}int included_line2;{{$}} // CHECK-NEXT: {{^}}# 4 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes1.h" 2 3{{$}} -// CHECK-NEXT: {{^}}# 7 "{{.*}}rewrite-includes.c" 2{{$}} +// CHECK-NEXT: {{^}}# 8 "{{.*}}rewrite-includes.c" 2{{$}} // CHECK-NEXT: {{^}}#ifdef FIRST{{$}} // CHECK-NEXT: {{^}}#define HEADER "rewrite-includes3.h"{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include HEADER{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECK-NEXT: {{^}}# 9 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}# 10 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes3.h" 1{{$}} -// CHECK-NEXT: {{^}}included_line3{{$}} -// CHECK-NEXT: {{^}}# 10 "{{.*}}rewrite-includes.c" 2{{$}} +// CHECK-NEXT: {{^}}unsigned int included_line3 = -10;{{$}} +// CHECK-NEXT: {{^}}# 11 "{{.*}}rewrite-includes.c" 2{{$}} // CHECK-NEXT: {{^}}#else{{$}} -// CHECK-NEXT: {{^}}# 11 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}# 12 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes4.h"{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECK-NEXT: {{^}}# 11 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 12 "{{.*}}rewrite-includes.c"{{$}} -// CHECK-NEXT: {{^}}#endif{{$}} // CHECK-NEXT: {{^}}# 13 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}#endif{{$}} +// CHECK-NEXT: {{^}}# 14 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}} // indented{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#/**/include /**/ "rewrite-includes5.h" /**/ {{\\}}{{$}} // CHECK-NEXT: {{^}} {{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECK-NEXT: {{^}}# 15 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}# 16 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes5.h" 1{{$}} -// CHECK-NEXT: {{^}}included_line5{{$}} -// CHECK-NEXT: {{^}}# 16 "{{.*}}rewrite-includes.c" 2{{$}} +// CHECK-NEXT: {{^}}int included_line5;{{$}} +// CHECK-NEXT: {{^}}# 17 "{{.*}}rewrite-includes.c" 2{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes6.h" // comment{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECK-NEXT: {{^}}# 16 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}# 17 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes6.h" 1{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#pragma once{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 2 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes6.h"{{$}} -// CHECK-NEXT: {{^}}included_line6{{$}} -// CHECK-NEXT: {{^}}# 17 "{{.*}}rewrite-includes.c" 2{{$}} +// CHECK-NEXT: {{^}}int included_line6;{{$}} +// CHECK-NEXT: {{^}}# 18 "{{.*}}rewrite-includes.c" 2{{$}} // CHECK-NEXT: {{^}} {{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes6.h" /* comment{{$}} // CHECK-NEXT: {{^}} continues */{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECK-NEXT: {{^}}# 19 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 20 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}# 21 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes7.h"{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECK-NEXT: {{^}}# 20 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}# 21 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes7.h" 1{{$}} // CHECK-NEXT: {{^}}#ifndef REWRITE_INCLUDES_7{{$}} // CHECK-NEXT: {{^}}#define REWRITE_INCLUDES_7{{$}} -// CHECK-NEXT: {{^}}included_line7{{$}} +// CHECK-NEXT: {{^}}int included_line7;{{$}} // CHECK-NEXT: {{^}}#endif{{$}} // CHECK-NEXT: {{^}}# 5 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes7.h"{{$}} -// CHECK-NEXT: {{^}}# 21 "{{.*}}rewrite-includes.c" 2{{$}} +// CHECK-NEXT: {{^}}# 22 "{{.*}}rewrite-includes.c" 2{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes7.h"{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECK-NEXT: {{^}}# 21 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 22 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}# 23 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes8.h"{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECK-NEXT: {{^}}# 22 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}# 23 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes8.h" 1{{$}} // CHECK-NEXT: {{^}}#if 0 /* disabled by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#if __has_include_next(){{$}} @@ -133,11 +135,11 @@ A(1,2) // CHECK-NEXT: {{^}}# 5 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes8.h"{{$}} // CHECK-NEXT: {{^}}#endif{{$}} // CHECK-NEXT: {{^}}# 6 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes8.h"{{$}} -// CHECK-NEXT: {{^}}# 23 "{{.*}}rewrite-includes.c" 2{{$}} +// CHECK-NEXT: {{^}}# 24 "{{.*}}rewrite-includes.c" 2{{$}} // CHECK-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#include "rewrite-includes9.h"{{$}} // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECK-NEXT: {{^}}# 23 "{{.*}}rewrite-includes.c"{{$}} +// CHECK-NEXT: {{^}}# 24 "{{.*}}rewrite-includes.c"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h" 1{{$}} // CHECK-NEXT: {{^}}#if 0 /* disabled by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}#if __has_include_next(){{$}} @@ -150,33 +152,34 @@ A(1,2) // CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECK-NEXT: {{^}}# 2 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h"{{$}} // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)NextIncludes(/|\\\\)}}rewrite-includes9.h" 1{{$}} -// CHECK-NEXT: {{^}}included_line9{{$}} +// CHECK-NEXT: {{^}}int included_line9;{{$}} // CHECK-NEXT: {{^}}# 3 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h" 2{{$}} // CHECK-NEXT: {{^}}#endif{{$}} // CHECK-NEXT: {{^}}# 4 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes9.h"{{$}} -// CHECK-NEXT: {{^}}# 24 "{{.*}}rewrite-includes.c" 2{{$}} +// CHECK-NEXT: {{^}}# 25 "{{.*}}rewrite-includes.c" 2{{$}} +// CHECK-NEXT: {{^}}static int unused;{{$}} // CHECK-NEXT: {{^}}// ENDCOMPARE{{$}} // CHECKNL: {{^}}// STARTCOMPARE{{$}} // CHECKNL-NEXT: {{^}}#define A(a,b) a ## b{{$}} -// CHECKNL-NEXT: {{^}}A(1,2){{$}} +// CHECKNL-NEXT: {{^}}A(in,t) a;{{$}} // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include "rewrite-includes1.h"{{$}} // CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#pragma clang system_header{{$}} // CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECKNL-NEXT: {{^}}included_line1{{$}} +// CHECKNL-NEXT: {{^}}int included_line1;{{$}} // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include "rewrite-includes2.h"{{$}} // CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECKNL-NEXT: {{^}}included_line2{{$}} +// CHECKNL-NEXT: {{^}}int included_line2;{{$}} // CHECKNL-NEXT: {{^}}#ifdef FIRST{{$}} // CHECKNL-NEXT: {{^}}#define HEADER "rewrite-includes3.h"{{$}} // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include HEADER{{$}} // CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECKNL-NEXT: {{^}}included_line3{{$}} +// CHECKNL-NEXT: {{^}}unsigned int included_line3 = -10;{{$}} // CHECKNL-NEXT: {{^}}#else{{$}} // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include "rewrite-includes4.h"{{$}} @@ -187,14 +190,14 @@ A(1,2) // CHECKNL-NEXT: {{^}}#/**/include /**/ "rewrite-includes5.h" /**/ {{\\}}{{$}} // CHECKNL-NEXT: {{^}} {{$}} // CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECKNL-NEXT: {{^}}included_line5{{$}} +// CHECKNL-NEXT: {{^}}int included_line5;{{$}} // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include "rewrite-includes6.h" // comment{{$}} // CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#pragma once{{$}} // CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECKNL-NEXT: {{^}}included_line6{{$}} +// CHECKNL-NEXT: {{^}}int included_line6;{{$}} // CHECKNL-NEXT: {{^}} {{$}} // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include "rewrite-includes6.h" /* comment{{$}} @@ -205,7 +208,7 @@ A(1,2) // CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#ifndef REWRITE_INCLUDES_7{{$}} // CHECKNL-NEXT: {{^}}#define REWRITE_INCLUDES_7{{$}} -// CHECKNL-NEXT: {{^}}included_line7{{$}} +// CHECKNL-NEXT: {{^}}int included_line7;{{$}} // CHECKNL-NEXT: {{^}}#endif{{$}} // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include "rewrite-includes7.h"{{$}} @@ -242,6 +245,10 @@ A(1,2) // CHECKNL-NEXT: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}} // CHECKNL-NEXT: {{^}}#include_next {{$}} // CHECKNL-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}} -// CHECKNL-NEXT: {{^}}included_line9{{$}} +// CHECKNL-NEXT: {{^}}int included_line9;{{$}} // CHECKNL-NEXT: {{^}}#endif{{$}} +// CHECKNL-NEXT: {{^}}static int unused;{{$}} // CHECKNL-NEXT: {{^}}// ENDCOMPARE{{$}} + +// COMPILE: Inputs/rewrite-includes3.h:1:31: warning: implicit conversion changes signedness: +// COMPILE: rewrite-includes.c:25:12: warning: unused variable 'unused'