]> granicus.if.org Git - clang/commitdiff
actually also compile output in tests for -frewrite-includes
authorLubos Lunak <l.lunak@centrum.cz>
Wed, 18 Sep 2019 19:12:14 +0000 (19:12 +0000)
committerLubos Lunak <l.lunak@centrum.cz>
Wed, 18 Sep 2019 19:12:14 +0000 (19:12 +0000)
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

test/Frontend/Inputs/NextIncludes/rewrite-includes9.h
test/Frontend/Inputs/rewrite-includes1.h
test/Frontend/Inputs/rewrite-includes2.h
test/Frontend/Inputs/rewrite-includes3.h
test/Frontend/Inputs/rewrite-includes4.h
test/Frontend/Inputs/rewrite-includes5.h
test/Frontend/Inputs/rewrite-includes6.h
test/Frontend/Inputs/rewrite-includes7.h
test/Frontend/rewrite-includes-cli-include.c
test/Frontend/rewrite-includes-conditions.c
test/Frontend/rewrite-includes.c

index b074bd1a4468c498ca1ad64aae49fd6ec4f0d0d5..75e4c963fd40aa1ab3fd611f045adeb2f459918c 100644 (file)
@@ -1 +1 @@
-included_line9
+int included_line9;
index 1b6c80d5f43582f8a5abc6419730b9331259cdd2..3312f9ff9025e4d7f8706a40cd9d04cc7897ad74 100644 (file)
@@ -1,3 +1,3 @@
 #pragma clang system_header
-included_line1
+int included_line1;
 #include "rewrite-includes2.h"
index 1114e51cc1351184168b39aa774b091acfb1d91f..d1097c8e17a9494878d5c97f6a472412ce6b0378 100644 (file)
@@ -1 +1 @@
-included_line2
+int included_line2;
index 3757bc8b3416d5abb5c25ec8d6fb45a3ec174919..2abf780590a449dd62ef9080159ae6c99730e173 100644 (file)
@@ -1 +1 @@
-included_line3
+unsigned int included_line3 = -10;
index b4e25d26f62df5f2b235745e36267121c8533162..7a442013f72279986067a6084735c31a3c9536e2 100644 (file)
@@ -1 +1 @@
-included_line4
+int included_line4;
index 934bf413e50ffc627f3aed746ba305199c4fbc56..0de12113cb64766be38140805ad829ea344d7fb6 100644 (file)
@@ -1 +1 @@
-included_line5
+int included_line5;
index c18e5013affc0e7e8393c895a71c8fd4fe3a92b6..5d891446234e612b92afd412e4e42cb7b3defd3e 100644 (file)
@@ -1,2 +1,2 @@
 #pragma once
-included_line6
+int included_line6;
index da00d4fb97d825635d88f312c7e4e1db57133493..221bab82df3045613147a9a09f7a6171502135d2 100644 (file)
@@ -1,4 +1,4 @@
 #ifndef REWRITE_INCLUDES_7
 #define REWRITE_INCLUDES_7
-included_line7
+int included_line7;
 #endif
index ba96039bdd5ade02163f6d07d76ffdde8dcb8a40..d63f966f79ca6afd9d13f21f1f042274ed0a493e 100644 (file)
@@ -2,7 +2,7 @@
 main_file_line
 // CHECK: {{^}}# 1 "<built-in>"{{$}}
 // CHECK-NEXT: {{^}}# 1 "{{.*[/\\]Inputs(/|\\\\)}}rewrite-includes2.h" 1{{$}}
-// CHECK-NEXT: {{^}}included_line2{{$}}
+// CHECK-NEXT: {{^}}int included_line2;{{$}}
 // CHECK-NEXT: {{^}}# 1 "<built-in>" 2{{$}}
 // CHECK-NEXT: {{^}}# 1 "{{.*}}rewrite-includes-cli-include.c"{{$}}
 // CHECK-NEXT: FileCheck
index ec05805032c79ead957195bc206de14134a8fbf1..57a2e0d160ef05856aad3bec54ee889968cf3f1c 100644 (file)
@@ -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(<rewrite-includes1.h>)
+#if __has_include(<rewrite-includes3.h>)
+#include <rewrite-includes3.h>
 #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(<rewrite-includes1.h>)
+// CHECK-NEXT: #if __has_include(<rewrite-includes3.h>)
 // 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'
index ec8c4130e32ea55b2fd5810264acc753a23e3494..cf5c296bac21b11e6f1936aec27c5c0770bf6430 100644 (file)
@@ -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(<rewrite-includes8.h>){{$}}
@@ -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(<rewrite-includes9.h>){{$}}
@@ -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 <rewrite-includes9.h>{{$}}
 // 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'