analyzer: don't use <setjmp.h> in tests [PR97394]

PR analyzer/97394 reports issues with analyzer setjmp results
when testing against MUSL.  This patch fixes up gcc.dg/analyzer
so that it doesn't use <setjmp.h>.

gcc/testsuite/ChangeLog:
	PR analyzer/97394
	* gcc.dg/analyzer/setjmp-pr93378.c: Use test-setjmp.h rather than
	<setjmp.h>.
	* gcc.dg/analyzer/sigsetjmp-5.c: Likewise.
	* gcc.dg/analyzer/sigsetjmp-6.c: Likewise.
	* gcc.dg/analyzer/test-setjmp.h: Don't include <setjmp.h>.
	Provide decls of jmp_buf, sigjmp_buf, setjmp, sigsetjmp,
	longjmp, and siglongjmp.
This commit is contained in:
David Malcolm 2020-10-13 15:56:45 -04:00
parent 270c5a982c
commit 974e3975c5
4 changed files with 15 additions and 6 deletions

@ -1,7 +1,7 @@
/* { dg-additional-options "-O1 -g" } */
/* { dg-require-effective-target indirect_jumps } */
#include <setjmp.h>
#include "test-setjmp.h"
jmp_buf buf;

@ -1,6 +1,6 @@
/* { dg-require-effective-target sigsetjmp } */
#include <setjmp.h>
#include "test-setjmp.h"
#include <stddef.h>
#include "analyzer-decls.h"

@ -1,6 +1,6 @@
/* { dg-require-effective-target sigsetjmp } */
#include <setjmp.h>
#include "test-setjmp.h"
#include <stddef.h>
#include <stdlib.h>

@ -7,10 +7,19 @@
setjmp is a function on some systems and a macro on others.
This header provides a SETJMP macro in a (fake) system header,
for consistency of output across such systems. */
#include <setjmp.h>
along with precanned decls of setjmp, for consistency of output across
different systems. */
#pragma GCC system_header
struct __jmp_buf_tag {};
typedef struct __jmp_buf_tag jmp_buf[1];
typedef struct __jmp_buf_tag sigjmp_buf[1];
extern int setjmp(jmp_buf env);
extern int sigsetjmp(sigjmp_buf env, int savesigs);
extern void longjmp(jmp_buf env, int val);
extern void siglongjmp(sigjmp_buf env, int val);
#define SETJMP(E) setjmp(E)