analyzer: remove __analyzer builtins

Message ID 20191218143655.4770-1-dmalcolm@redhat.com
State New
Headers show
Series
  • analyzer: remove __analyzer builtins
Related show

Commit Message

David Malcolm Dec. 18, 2019, 2:36 p.m.
On Fri, 2019-12-13 at 13:31 -0500, David Malcolm wrote:
> On Fri, 2019-12-13 at 19:27 +0100, Jakub Jelinek wrote:

> > On Fri, Dec 13, 2019 at 01:11:05PM -0500, David Malcolm wrote:

> > > gcc/ChangeLog:

> > > 	* builtins.def (BUILT_IN_ANALYZER_BREAK): New builtin.

> > > 	(BUILT_IN_ANALYZER_DUMP): New builtin.

> > > 	(BUILT_IN_ANALYZER_DUMP_EXPLODED_NODES): New builtin.

> > > 	(BUILT_IN_ANALYZER_DUMP_NUM_HEAP_REGIONS): New builtin.

> > > 	(BUILT_IN_ANALYZER_DUMP_PATH): New builtin.

> > > 	(BUILT_IN_ANALYZER_DUMP_REGION_MODEL): New builtin.

> > > 	(BUILT_IN_ANALYZER_EVAL): New builtin.

> > 

> > Is it a good idea to add further builtins without __builtin_

> > prefix (unless required for interoperability etc.)?

> 

> I think I can do all of these with just string matching on the fndecl

> names; would that be preferable to having them as builtins?


The patch that added __analyzer_* builtins to builtins.def isn't needed:
the functions are only used during DejaGnu testing, and only for
comparison by name during compile-only tests - they're never actually
defined.

This patch eliminates the builtins in favor of a header file in the
DejaGnu testsuite.

Jakub: do you prefer this approach? (eliminating the builtins in favor of
"magic" function names for use just using analyzer DejaGnu tests)

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu; 
pushed to branch dmalcolm/analyzer on the GCC git mirror.

Dave


gcc/ChangeLog:
	* builtins.def: Delete the analyzer builtins.
	* doc/analyzer.texi (Builtins for Debugging the Analyzer): Rename
	to...
	(Special Functions for Debugging the Analyzer): ...this.  Add a
	leading paragraph.  Document __analyzer_dump_region_model and
	__analyzer_eval.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/abort.c: Include "analyzer-decls.h".
	* gcc.dg/analyzer/analyzer-decls.h: New header.
	* gcc.dg/analyzer/conditionals-2.c: Include "analyzer-decls.h".
	* gcc.dg/analyzer/conditionals-3.c: Likewise.
	* gcc.dg/analyzer/conditionals-notrans.c: Likewise.
	* gcc.dg/analyzer/conditionals-trans.c: Likewise.
	* gcc.dg/analyzer/data-model-1.c: Likewise.
	* gcc.dg/analyzer/data-model-16.c: Likewise.
	* gcc.dg/analyzer/data-model-18.c: Likewise.
	* gcc.dg/analyzer/data-model-5d.c: Likewise.
	* gcc.dg/analyzer/data-model-6.c: Likewise.
	* gcc.dg/analyzer/data-model-7.c: Likewise.
	* gcc.dg/analyzer/data-model-8.c: Likewise.
	* gcc.dg/analyzer/data-model-9.c: Likewise.
	* gcc.dg/analyzer/equivalence.c: Likewise.
	* gcc.dg/analyzer/function-ptr-2.c: Likewise.
	* gcc.dg/analyzer/loop-2.c: Likewise.
	* gcc.dg/analyzer/loop-2a.c: Likewise.
	* gcc.dg/analyzer/loop-4.c: Likewise.
	* gcc.dg/analyzer/loop.c: Likewise.
	* gcc.dg/analyzer/malloc-paths-10.c: Likewise.
	* gcc.dg/analyzer/malloc-vs-local-1a.c: Likewise.
	* gcc.dg/analyzer/malloc-vs-local-1b.c: Likewise.
	* gcc.dg/analyzer/malloc-vs-local-2.c: Likewise.
	* gcc.dg/analyzer/malloc-vs-local-3.c: Likewise.
	* gcc.dg/analyzer/operations.c: Likewise.
	* gcc.dg/analyzer/params-2.c: Likewise.
	* gcc.dg/analyzer/params.c: Likewise.
	* gcc.dg/analyzer/paths-1.c: Likewise.
	* gcc.dg/analyzer/paths-1a.c: Likewise.
	* gcc.dg/analyzer/paths-2.c: Likewise.
	* gcc.dg/analyzer/paths-3.c: Likewise.
	* gcc.dg/analyzer/paths-4.c: Likewise.
	* gcc.dg/analyzer/paths-5.c: Likewise.
	* gcc.dg/analyzer/paths-6.c: Likewise.
	* gcc.dg/analyzer/paths-7.c: Likewise.
	* gcc.dg/analyzer/setjmp-2.c: Likewise.
	* gcc.dg/analyzer/setjmp-3.c: Likewise.
	* gcc.dg/analyzer/setjmp-4.c: Likewise.
	* gcc.dg/analyzer/setjmp-5.c: Likewise.
	* gcc.dg/analyzer/setjmp-8.c: Likewise.
	* gcc.dg/analyzer/setjmp-9.c: Likewise.
	* gcc.dg/analyzer/switch.c: Likewise.
	* gcc.dg/analyzer/zlib-1.c: Likewise.
	* gcc.dg/analyzer/zlib-5.c: Likewise.
---
 gcc/builtins.def                              | 33 -----------------
 gcc/doc/analyzer.texi                         | 19 +++++++++-
 gcc/testsuite/gcc.dg/analyzer/abort.c         |  1 +
 .../gcc.dg/analyzer/analyzer-decls.h          | 36 +++++++++++++++++++
 .../gcc.dg/analyzer/conditionals-2.c          |  1 +
 .../gcc.dg/analyzer/conditionals-3.c          |  2 ++
 .../gcc.dg/analyzer/conditionals-notrans.c    |  1 +
 .../gcc.dg/analyzer/conditionals-trans.c      |  1 +
 gcc/testsuite/gcc.dg/analyzer/data-model-1.c  |  1 +
 gcc/testsuite/gcc.dg/analyzer/data-model-16.c |  2 ++
 gcc/testsuite/gcc.dg/analyzer/data-model-18.c |  2 ++
 gcc/testsuite/gcc.dg/analyzer/data-model-5d.c |  1 +
 gcc/testsuite/gcc.dg/analyzer/data-model-6.c  |  1 +
 gcc/testsuite/gcc.dg/analyzer/data-model-7.c  |  1 +
 gcc/testsuite/gcc.dg/analyzer/data-model-8.c  |  2 ++
 gcc/testsuite/gcc.dg/analyzer/data-model-9.c  |  1 +
 gcc/testsuite/gcc.dg/analyzer/equivalence.c   |  2 ++
 .../gcc.dg/analyzer/function-ptr-2.c          |  1 +
 gcc/testsuite/gcc.dg/analyzer/loop-2.c        |  1 +
 gcc/testsuite/gcc.dg/analyzer/loop-2a.c       |  1 +
 gcc/testsuite/gcc.dg/analyzer/loop-4.c        |  2 ++
 gcc/testsuite/gcc.dg/analyzer/loop.c          |  2 ++
 .../gcc.dg/analyzer/malloc-paths-10.c         |  1 +
 .../gcc.dg/analyzer/malloc-vs-local-1a.c      |  1 +
 .../gcc.dg/analyzer/malloc-vs-local-1b.c      |  1 +
 .../gcc.dg/analyzer/malloc-vs-local-2.c       |  1 +
 .../gcc.dg/analyzer/malloc-vs-local-3.c       |  1 +
 gcc/testsuite/gcc.dg/analyzer/operations.c    |  2 ++
 gcc/testsuite/gcc.dg/analyzer/params-2.c      |  1 +
 gcc/testsuite/gcc.dg/analyzer/params.c        |  2 ++
 gcc/testsuite/gcc.dg/analyzer/paths-1.c       |  2 ++
 gcc/testsuite/gcc.dg/analyzer/paths-1a.c      |  2 ++
 gcc/testsuite/gcc.dg/analyzer/paths-2.c       |  2 ++
 gcc/testsuite/gcc.dg/analyzer/paths-3.c       |  1 +
 gcc/testsuite/gcc.dg/analyzer/paths-4.c       |  2 ++
 gcc/testsuite/gcc.dg/analyzer/paths-5.c       |  2 ++
 gcc/testsuite/gcc.dg/analyzer/paths-6.c       |  1 +
 gcc/testsuite/gcc.dg/analyzer/paths-7.c       |  1 +
 gcc/testsuite/gcc.dg/analyzer/setjmp-2.c      |  1 +
 gcc/testsuite/gcc.dg/analyzer/setjmp-3.c      |  1 +
 gcc/testsuite/gcc.dg/analyzer/setjmp-4.c      |  1 +
 gcc/testsuite/gcc.dg/analyzer/setjmp-5.c      |  1 +
 gcc/testsuite/gcc.dg/analyzer/setjmp-8.c      |  1 +
 gcc/testsuite/gcc.dg/analyzer/setjmp-9.c      |  1 +
 gcc/testsuite/gcc.dg/analyzer/switch.c        |  2 ++
 gcc/testsuite/gcc.dg/analyzer/zlib-1.c        |  2 ++
 gcc/testsuite/gcc.dg/analyzer/zlib-5.c        |  2 ++
 47 files changed, 115 insertions(+), 34 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h

-- 
2.21.0

Comments

Jakub Jelinek Dec. 18, 2019, 2:45 p.m. | #1
On Wed, Dec 18, 2019 at 09:36:55AM -0500, David Malcolm wrote:
> This patch eliminates the builtins in favor of a header file in the

> DejaGnu testsuite.

> 

> Jakub: do you prefer this approach? (eliminating the builtins in favor of

> "magic" function names for use just using analyzer DejaGnu tests)


Yeah, certainly.  Thanks.

	Jakub

Patch

diff --git a/gcc/builtins.def b/gcc/builtins.def
index f34e95fe4bb0..d8233f5f760f 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -1107,37 +1107,4 @@  DEF_GCC_BUILTIN (BUILT_IN_LINE, "LINE", BT_FN_INT, ATTR_NOTHROW_LEAF_LIST)
 /* HSAIL/BRIG frontend builtins.  */
 #include "brig-builtins.def"
 
-
-/* Analyzer builtins.  */
-DEF_BUILTIN (BUILT_IN_ANALYZER_BREAK, "__analyzer_break",
-	     BUILT_IN_NORMAL, BT_FN_VOID, BT_LAST,
-	     false, false, false, ATTR_NULL, true, true)
-
-DEF_BUILTIN (BUILT_IN_ANALYZER_DUMP, "__analyzer_dump",
-	     BUILT_IN_NORMAL, BT_FN_VOID, BT_LAST,
-	     false, false, false, ATTR_NULL, true, true)
-
-DEF_BUILTIN (BUILT_IN_ANALYZER_DUMP_EXPLODED_NODES,
-	     "__analyzer_dump_exploded_nodes",
-	     BUILT_IN_NORMAL, BT_FN_VOID_INT, BT_LAST,
-	     false, false, false, ATTR_NULL, true, true)
-
-DEF_BUILTIN (BUILT_IN_ANALYZER_DUMP_NUM_HEAP_REGIONS,
-	     "__analyzer_dump_num_heap_regions",
-	     BUILT_IN_NORMAL, BT_FN_VOID, BT_LAST,
-	     false, false, false, ATTR_NULL, true, true)
-
-DEF_BUILTIN (BUILT_IN_ANALYZER_DUMP_PATH, "__analyzer_dump_path",
-	     BUILT_IN_NORMAL, BT_FN_VOID, BT_LAST,
-	     false, false, false, ATTR_NULL, true, true)
-
-DEF_BUILTIN (BUILT_IN_ANALYZER_DUMP_REGION_MODEL,
-	     "__analyzer_dump_region_model",
-	     BUILT_IN_NORMAL, BT_FN_VOID, BT_LAST,
-	     false, false, false, ATTR_NULL, true, true)
-
-DEF_BUILTIN (BUILT_IN_ANALYZER_EVAL, "__analyzer_eval",
-	     BUILT_IN_NORMAL, BT_FN_VOID_INT, BT_LAST,
-	     false, false, false, ATTR_NULL, true, true)
-
 #undef DEF_BUILTIN
diff --git a/gcc/doc/analyzer.texi b/gcc/doc/analyzer.texi
index 3f5999f14dd0..67efa52953b8 100644
--- a/gcc/doc/analyzer.texi
+++ b/gcc/doc/analyzer.texi
@@ -433,7 +433,12 @@  Signal handling
 @cindex analyzer, debugging
 @cindex static analyzer, debugging
 
-@subsection Builtins for Debugging the Analyzer
+@subsection Special Functions for Debugging the Analyzer
+
+The analyzer recognizes various special functions by name, for use
+in debugging the analyzer.  Declarations can be seen in the testsuite
+in @file{analyzer-decls.h}.  None of these functions are actually
+implemented.
 
 Add:
 @smallexample
@@ -472,6 +477,18 @@  will dump just the number of nodes, and their IDs.
 
 will also dump all of the states within those nodes.
 
+@smallexample
+   __analyzer_dump_region_model ();
+@end smallexample
+will dump the region_model's state to stderr.
+
+@smallexample
+__analyzer_eval (expr);
+@end smallexample
+will emit a warning with text "TRUE", FALSE" or "UNKNOWN" based on the
+truthfulness of the argument.  This is useful for writing DejaGnu tests.
+
+
 @subsection Other Debugging Techniques
 
 One approach when tracking down where a particular bogus state is
diff --git a/gcc/testsuite/gcc.dg/analyzer/abort.c b/gcc/testsuite/gcc.dg/analyzer/abort.c
index cfbf74ca3901..ea1756e47cb0 100644
--- a/gcc/testsuite/gcc.dg/analyzer/abort.c
+++ b/gcc/testsuite/gcc.dg/analyzer/abort.c
@@ -1,6 +1,7 @@ 
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 extern void foo ();
 extern void bar ();
diff --git a/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h b/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
new file mode 100644
index 000000000000..180e873b67c9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
@@ -0,0 +1,36 @@ 
+#ifndef ANALYZER_DECLS_H
+#define ANALYZER_DECLS_H
+
+/* Function decls with special meaning to the analyzer.
+   None of these are actually implemented.  */
+
+/* Trigger a breakpoint in the analyzer when reached.  */
+extern void __analyzer_break (void);
+
+/* Dump copious information about the analyzer’s state when reached.  */
+extern void __analyzer_dump (void);
+
+/* Dump information after analysis on all of the exploded nodes at this
+   program point.
+
+   __analyzer_dump_exploded_nodes (0);
+   will dump just the number of nodes, and their IDs.
+
+   __analyzer_dump_exploded_nodes (1);
+   will also dump all of the states within those nodes.  */
+extern void __analyzer_dump_exploded_nodes (int);
+
+extern void __analyzer_dump_num_heap_regions (void);
+
+/* Emit a placeholder "note" diagnostic with a path to this call site,
+   if the analyzer finds a feasible path to it.  */
+extern void __analyzer_dump_path (void);
+
+/* Dump the region_model's state to stderr.  */
+extern void __analyzer_dump_region_model (void);
+
+/* Emit a warning with text "TRUE", FALSE" or "UNKNOWN" based on the
+   truthfulness of the argument.  */
+extern void __analyzer_eval (int);
+
+#endif /* #ifndef ANALYZER_DECLS_H.  */
diff --git a/gcc/testsuite/gcc.dg/analyzer/conditionals-2.c b/gcc/testsuite/gcc.dg/analyzer/conditionals-2.c
index f3f1ac77b493..6f291f4861b2 100644
--- a/gcc/testsuite/gcc.dg/analyzer/conditionals-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/conditionals-2.c
@@ -2,6 +2,7 @@ 
 /* { dg-additional-options "-O2" } */
 
 #include <stddef.h>
+#include "analyzer-decls.h"
 
 #define Z_NULL 0
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/conditionals-3.c b/gcc/testsuite/gcc.dg/analyzer/conditionals-3.c
index d19a8b76edee..5f29f215dd17 100644
--- a/gcc/testsuite/gcc.dg/analyzer/conditionals-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/conditionals-3.c
@@ -1,5 +1,7 @@ 
 /* { dg-additional-options "-fno-analyzer-state-merge" } */
 
+#include "analyzer-decls.h"
+
 static void only_called_when_flag_a_true (int i)
 {
   __analyzer_eval (i == 42); /* { dg-warning "TRUE" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/conditionals-notrans.c b/gcc/testsuite/gcc.dg/analyzer/conditionals-notrans.c
index 79ffe74b4ed3..8e4ea5f58a71 100644
--- a/gcc/testsuite/gcc.dg/analyzer/conditionals-notrans.c
+++ b/gcc/testsuite/gcc.dg/analyzer/conditionals-notrans.c
@@ -1,4 +1,5 @@ 
 /* { dg-additional-options "-fno-analyzer-transitivity" } */
+#include "analyzer-decls.h"
 
 void test (int i, int j)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/conditionals-trans.c b/gcc/testsuite/gcc.dg/analyzer/conditionals-trans.c
index 3f7eb5b48623..ab34618c4110 100644
--- a/gcc/testsuite/gcc.dg/analyzer/conditionals-trans.c
+++ b/gcc/testsuite/gcc.dg/analyzer/conditionals-trans.c
@@ -1,4 +1,5 @@ 
 /* { dg-additional-options "-fanalyzer-transitivity" } */
+#include "analyzer-decls.h"
 
 void test (int i, int j)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
index d720a64a3f6e..a5840a259446 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
@@ -1,6 +1,7 @@ 
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include "analyzer-decls.h"
 
 struct foo
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-16.c b/gcc/testsuite/gcc.dg/analyzer/data-model-16.c
index 3bfdbdd18740..a8acfbeeb77a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-16.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-16.c
@@ -1,5 +1,7 @@ 
 /* Labels as values.  */
 
+#include "analyzer-decls.h"
+
 extern void foo (void);
 
 void *x, *y, *z;
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-18.c b/gcc/testsuite/gcc.dg/analyzer/data-model-18.c
index 88ea41df79ef..7b096b0674d6 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-18.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-18.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 void test (int *p, int i, int j)
 {
   p[3] = 42;
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-5d.c b/gcc/testsuite/gcc.dg/analyzer/data-model-5d.c
index 50ab0ac31255..8c7bfa91a968 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-5d.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-5d.c
@@ -3,6 +3,7 @@ 
 #include <stddef.h>
 #include <string.h>
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 typedef struct base_obj base_obj;
 typedef struct type_obj type_obj;
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-6.c b/gcc/testsuite/gcc.dg/analyzer/data-model-6.c
index 8b63ab2e2558..78a797ead76e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-6.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-6.c
@@ -1,4 +1,5 @@ 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 /* Verify that we don't accumulate state after a malloc/free pair.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-7.c b/gcc/testsuite/gcc.dg/analyzer/data-model-7.c
index 6c8ab0ac958f..67a681be607f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-7.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-7.c
@@ -1,4 +1,5 @@ 
 /* { dg-additional-options "-fno-analyzer-state-merge" } */
+#include "analyzer-decls.h"
 
 int test_40 (int flag)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-8.c b/gcc/testsuite/gcc.dg/analyzer/data-model-8.c
index 2c83c75d9e62..aff903691960 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-8.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-8.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 struct base
 {
   int i;
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-9.c b/gcc/testsuite/gcc.dg/analyzer/data-model-9.c
index a1a46c6952ad..bab4b573f5bd 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-9.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-9.c
@@ -1,5 +1,6 @@ 
 #include <stdlib.h>
 #include <string.h>
+#include "analyzer-decls.h"
 
 struct foo
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/equivalence.c b/gcc/testsuite/gcc.dg/analyzer/equivalence.c
index fb2866014026..609b6fdef50c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/equivalence.c
+++ b/gcc/testsuite/gcc.dg/analyzer/equivalence.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 void test (int p, int q, int r)
 {
   if (p == 42)
diff --git a/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c b/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c
index 81044a7922d5..411b1b39377f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/function-ptr-2.c
@@ -1,4 +1,5 @@ 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 typedef void (*fn_ptr_t) (void *);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/loop-2.c b/gcc/testsuite/gcc.dg/analyzer/loop-2.c
index 2a6edc4d6a96..595f23915caa 100644
--- a/gcc/testsuite/gcc.dg/analyzer/loop-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/loop-2.c
@@ -1,4 +1,5 @@ 
 /* { dg-additional-options "-fno-analyzer-state-purge" } */
+#include "analyzer-decls.h"
 
 struct s
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/loop-2a.c b/gcc/testsuite/gcc.dg/analyzer/loop-2a.c
index 94eff82a8ab5..d50bfe0f31b7 100644
--- a/gcc/testsuite/gcc.dg/analyzer/loop-2a.c
+++ b/gcc/testsuite/gcc.dg/analyzer/loop-2a.c
@@ -1,4 +1,5 @@ 
 /* { dg-additional-options "-fno-analyzer-state-purge" } */
+#include "analyzer-decls.h"
 
 union u
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/loop-4.c b/gcc/testsuite/gcc.dg/analyzer/loop-4.c
index 7e3e7ab98eeb..105237570d1f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/loop-4.c
+++ b/gcc/testsuite/gcc.dg/analyzer/loop-4.c
@@ -3,6 +3,8 @@ 
 
 /* Example of nested loops.  */
 
+#include "analyzer-decls.h"
+
 void test(void)
 {
   int i, j, k;
diff --git a/gcc/testsuite/gcc.dg/analyzer/loop.c b/gcc/testsuite/gcc.dg/analyzer/loop.c
index 32fb0516ea1a..3f29fa6146e2 100644
--- a/gcc/testsuite/gcc.dg/analyzer/loop.c
+++ b/gcc/testsuite/gcc.dg/analyzer/loop.c
@@ -1,5 +1,7 @@ 
 /* { dg-additional-options "-fno-analyzer-state-purge" } */
 
+#include "analyzer-decls.h"
+
 void test(void)
 {
   int i;
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c b/gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c
index 3eb5ffc8e8fe..2a2937ed043e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c
@@ -1,4 +1,5 @@ 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 int test (int flag)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c
index d7dfb0643036..72360c2f9fad 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c
@@ -1,6 +1,7 @@ 
 /* { dg-additional-options "-fno-analyzer-call-summaries -fanalyzer-transitivity" } */
 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 extern int foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c
index 7f1dd911dfb2..1997bb7adb42 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c
@@ -1,6 +1,7 @@ 
 /* { dg-additional-options "-fanalyzer-call-summaries" } */
 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 extern int foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c
index 03078729b5fd..74d9687b960f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c
@@ -1,4 +1,5 @@ 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 extern int foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c
index 2a0c8a49d1a9..fe9b240be5b7 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c
@@ -1,4 +1,5 @@ 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 extern int foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/operations.c b/gcc/testsuite/gcc.dg/analyzer/operations.c
index 9ea232728d4a..0f8aad21afe7 100644
--- a/gcc/testsuite/gcc.dg/analyzer/operations.c
+++ b/gcc/testsuite/gcc.dg/analyzer/operations.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 void test (int i, int j)
 {
   int k, m;
diff --git a/gcc/testsuite/gcc.dg/analyzer/params-2.c b/gcc/testsuite/gcc.dg/analyzer/params-2.c
index 1584ebdd63d9..433c658720f2 100644
--- a/gcc/testsuite/gcc.dg/analyzer/params-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/params-2.c
@@ -1,4 +1,5 @@ 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 static void ensure_equal (int a, int b)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/params.c b/gcc/testsuite/gcc.dg/analyzer/params.c
index ff405f2224b2..02371da98871 100644
--- a/gcc/testsuite/gcc.dg/analyzer/params.c
+++ b/gcc/testsuite/gcc.dg/analyzer/params.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 static int called_function(int j)
 {
   int k;
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-1.c b/gcc/testsuite/gcc.dg/analyzer/paths-1.c
index 246f6cdfb5d5..064687744723 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/paths-1.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 struct foo
 {
   int m_flag;
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-1a.c b/gcc/testsuite/gcc.dg/analyzer/paths-1a.c
index a6e2679cc1aa..8760de93499f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-1a.c
+++ b/gcc/testsuite/gcc.dg/analyzer/paths-1a.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 union foo
 {
   int m_flag;
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-2.c b/gcc/testsuite/gcc.dg/analyzer/paths-2.c
index 8637c8c9ace9..c48a2d7758c5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/paths-2.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 int test (int a)
 {
   if (a != 42 && a != 113) {
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-3.c b/gcc/testsuite/gcc.dg/analyzer/paths-3.c
index d03ab02f203d..440213b79915 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/paths-3.c
@@ -1,6 +1,7 @@ 
 /* { dg-additional-options "-fanalyzer-transitivity" } */
 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 int test_1 (int a, int b)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-4.c b/gcc/testsuite/gcc.dg/analyzer/paths-4.c
index 307bc976dba4..34bd09eee057 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-4.c
+++ b/gcc/testsuite/gcc.dg/analyzer/paths-4.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 struct state
 {
   int mode;
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-5.c b/gcc/testsuite/gcc.dg/analyzer/paths-5.c
index d3589b597c3c..f96169d9d2bc 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-5.c
+++ b/gcc/testsuite/gcc.dg/analyzer/paths-5.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 void test (int *p, int n)
 {
   int i;
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-6.c b/gcc/testsuite/gcc.dg/analyzer/paths-6.c
index bf4b6f349475..7a1a94228dd9 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-6.c
+++ b/gcc/testsuite/gcc.dg/analyzer/paths-6.c
@@ -1,4 +1,5 @@ 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 /* Verify that ordering of writes doesn't matter when merging states.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-7.c b/gcc/testsuite/gcc.dg/analyzer/paths-7.c
index 7a0826ddc51d..6a99e64439fc 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-7.c
+++ b/gcc/testsuite/gcc.dg/analyzer/paths-7.c
@@ -1,4 +1,5 @@ 
 #include <stdlib.h>
+#include "analyzer-decls.h"
 
 extern int foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/setjmp-2.c b/gcc/testsuite/gcc.dg/analyzer/setjmp-2.c
index 7afe66ebeb4b..2ba3913b4c75 100644
--- a/gcc/testsuite/gcc.dg/analyzer/setjmp-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/setjmp-2.c
@@ -2,6 +2,7 @@ 
 
 #include <setjmp.h>
 #include <stddef.h>
+#include "analyzer-decls.h"
 
 extern void foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/setjmp-3.c b/gcc/testsuite/gcc.dg/analyzer/setjmp-3.c
index 36814a7d366c..e89599c42878 100644
--- a/gcc/testsuite/gcc.dg/analyzer/setjmp-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/setjmp-3.c
@@ -2,6 +2,7 @@ 
 
 #include <setjmp.h>
 #include <stddef.h>
+#include "analyzer-decls.h"
 
 extern int foo (int) __attribute__ ((__pure__));
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/setjmp-4.c b/gcc/testsuite/gcc.dg/analyzer/setjmp-4.c
index c45efd43e6ac..a5b9e9d5d3d6 100644
--- a/gcc/testsuite/gcc.dg/analyzer/setjmp-4.c
+++ b/gcc/testsuite/gcc.dg/analyzer/setjmp-4.c
@@ -1,6 +1,7 @@ 
 /* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-nn-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
 
 #include <setjmp.h>
+#include "analyzer-decls.h"
 
 extern int foo (int) __attribute__ ((__pure__));
 static jmp_buf buf;
diff --git a/gcc/testsuite/gcc.dg/analyzer/setjmp-5.c b/gcc/testsuite/gcc.dg/analyzer/setjmp-5.c
index faac51c664ef..e9d49b41a6e3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/setjmp-5.c
+++ b/gcc/testsuite/gcc.dg/analyzer/setjmp-5.c
@@ -2,6 +2,7 @@ 
 
 #include <setjmp.h>
 #include <stddef.h>
+#include "analyzer-decls.h"
 
 static jmp_buf env;
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/setjmp-8.c b/gcc/testsuite/gcc.dg/analyzer/setjmp-8.c
index 41f00a763395..f876b8f8a12f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/setjmp-8.c
+++ b/gcc/testsuite/gcc.dg/analyzer/setjmp-8.c
@@ -2,6 +2,7 @@ 
 
 #include <setjmp.h>
 #include <stddef.h>
+#include "analyzer-decls.h"
 
 extern int foo (int) __attribute__ ((__pure__));
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/setjmp-9.c b/gcc/testsuite/gcc.dg/analyzer/setjmp-9.c
index b442f6355ae3..153676bca8c1 100644
--- a/gcc/testsuite/gcc.dg/analyzer/setjmp-9.c
+++ b/gcc/testsuite/gcc.dg/analyzer/setjmp-9.c
@@ -2,6 +2,7 @@ 
 
 #include <setjmp.h>
 #include <stddef.h>
+#include "analyzer-decls.h"
 
 extern int foo (int) __attribute__ ((__pure__));
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/switch.c b/gcc/testsuite/gcc.dg/analyzer/switch.c
index e26177067fa8..ad4b6568dc2a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/switch.c
+++ b/gcc/testsuite/gcc.dg/analyzer/switch.c
@@ -1,5 +1,7 @@ 
 /* { dg-additional-options "-fanalyzer-transitivity" } */
 
+#include "analyzer-decls.h"
+
 void test (int i)
 {
   switch (i)
diff --git a/gcc/testsuite/gcc.dg/analyzer/zlib-1.c b/gcc/testsuite/gcc.dg/analyzer/zlib-1.c
index 52d3c629db72..5537c984e1aa 100644
--- a/gcc/testsuite/gcc.dg/analyzer/zlib-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/zlib-1.c
@@ -1,3 +1,5 @@ 
+#include "analyzer-decls.h"
+
 typedef void (*free_func)(void *opaque, void *address);
 
 typedef struct z_stream_s {
diff --git a/gcc/testsuite/gcc.dg/analyzer/zlib-5.c b/gcc/testsuite/gcc.dg/analyzer/zlib-5.c
index bcf8a0a4a9b0..715604dbe774 100644
--- a/gcc/testsuite/gcc.dg/analyzer/zlib-5.c
+++ b/gcc/testsuite/gcc.dg/analyzer/zlib-5.c
@@ -1,5 +1,7 @@ 
 /* { dg-additional-options "-O3" } */
 
+#include "analyzer-decls.h"
+
 typedef long unsigned int size_t;
 typedef unsigned char Byte;
 typedef unsigned int uInt;