analyzer: fix testsuite issues seen with mingw [PR102052]

gcc/testsuite/ChangeLog:
	PR analyzer/102052
	* gcc.dg/analyzer/fields.c (size_t): Use __SIZE_TYPE__ rather than
	hardcoding long unsigned int.
	* gcc.dg/analyzer/gzio-3.c (size_t): Likewise.
	* gcc.dg/analyzer/gzio-3a.c (size_t): Likewise.
	* gcc.dg/analyzer/pr98969.c (test_1): Use __UINTPTR_TYPE__ rather
	than long int.
	(test_2): Likewise.
	* gcc.dg/analyzer/pr99716-2.c (test_mountpoint): Use "rand" rather
	than "random".
	* gcc.dg/analyzer/pr99774-1.c (size_t): Use __SIZE_TYPE__ rather
	than hardcoding long unsigned int.
	* gcc.dg/analyzer/strndup-1.c: Add MinGW to targets that don't
	implement strndup.
	* gcc.dg/analyzer/zlib-5.c (size_t): Use __SIZE_TYPE__ rather
	than hardcoding long unsigned int.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This commit is contained in:
David Malcolm 2022-02-09 17:55:55 -05:00
parent 3d7341cd73
commit 8383d41d70
8 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
typedef long unsigned int size_t;
typedef __SIZE_TYPE__ size_t;
extern size_t strlen (const char *__s)
__attribute__ ((__nothrow__ , __leaf__))

View File

@ -1,4 +1,4 @@
typedef long unsigned int size_t;
typedef __SIZE_TYPE__ size_t;
typedef struct _IO_FILE FILE;
extern size_t fread(void *__restrict __ptr, size_t __size, size_t __n,
FILE *__restrict __stream);

View File

@ -1,4 +1,4 @@
typedef long unsigned int size_t;
typedef __SIZE_TYPE__ size_t;
typedef struct _IO_FILE FILE;
extern size_t fread(void *__restrict __ptr, size_t __size, size_t __n,
FILE *__restrict __stream);

View File

@ -4,14 +4,14 @@ struct foo
};
void
test_1 (long int i)
test_1 (__UINTPTR_TYPE__ i)
{
struct foo *f = (struct foo *)i;
f->expr = __builtin_malloc (1024);
} /* { dg-bogus "leak" } */
void
test_2 (long int i)
test_2 (__UINTPTR_TYPE__ i)
{
__builtin_free (((struct foo *)i)->expr);
__builtin_free (((struct foo *)i)->expr); /* { dg-warning "double-'free' of '\\*\\(\\(struct foo \\*\\)i\\)\\.expr'" } */

View File

@ -10,7 +10,7 @@ extern int foo (void);
void
test_mountpoint (const char *mp)
{
const int nr_passes = 5 + (random () & 31);
const int nr_passes = 5 + (rand () & 31);
int pass;
int ret = 1;
FILE *fp;

View File

@ -7,7 +7,7 @@ typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint64_t;
typedef unsigned long uint64_t;
typedef long unsigned int size_t;
typedef __SIZE_TYPE__ size_t;
extern void *calloc(size_t __nmemb, size_t __size)
__attribute__((__nothrow__, __leaf__))

View File

@ -1,4 +1,4 @@
/* { dg-skip-if "no strndup in libc" { *-*-darwin[789]* *-*-darwin10* } } */
/* { dg-skip-if "no strndup in libc" { *-*-darwin[789]* *-*-darwin10* *-*-mingw* } } */
#include <string.h>
#include <stdlib.h>

View File

@ -2,7 +2,7 @@
#include "analyzer-decls.h"
typedef long unsigned int size_t;
typedef __SIZE_TYPE__ size_t;
typedef unsigned char Byte;
typedef unsigned int uInt;
typedef unsigned long uLong;