-Subproject commit ed04bed43efece46d2b476fbb0260f1d1b8aa1fe
+Subproject commit 6405aa895740d960d6f6e70976eeb44bd403f952
AM_PROG_CC_C_O
gl_EARLY
-LT_INIT
-gl_INIT
-
AC_HEADER_ASSERT
AC_C_FLEXIBLE_ARRAY_MEMBER
+AC_C_INLINE
+DX_C_FOR_DECLARATIONS
+
+LT_INIT
+gl_INIT
# Work around quoting bug in Gnulib threadlib.m4 which prevents
# correct detection on e.g., Solaris 8. These platforms require
*/
static int valid_typespec(struct cdecl_declspec *s)
{
+ struct cdecl_declspec *c;
unsigned long map = 0;
- for (struct cdecl_declspec *c = s; c; c = c->next) {
+ for (c = s; c; c = c->next) {
unsigned long bit;
if (cdecl_spec_kind(c) != CDECL_SPEC_TYPE)
*/
static bool valid_declspecs(struct cdecl *decl, bool top)
{
- struct cdecl_declspec *specs = decl->specifiers;
+ struct cdecl_declspec *c, *specs = decl->specifiers;
struct cdecl_declarator *d = decl->declarators;
bool abstract = cdecl_is_abstract(d);
unsigned num_storage = 0;
if (!valid_typespec(specs))
return false;
- for (struct cdecl_declspec *c = specs; c; c = c->next) {
+ for (c = specs; c; c = c->next) {
switch (cdecl_spec_kind(c)) {
case CDECL_SPEC_TYPE:
if (c->type == CDECL_TYPE_VOID &&
{
int opt, mode = MODE_CDECL;
int ret = EXIT_SUCCESS;
+ int i;
const char *filename = NULL;
FILE *infile = NULL;
free(line);
fclose(infile);
} else if (argv[optind]) {
- for (int i = optind; i < argc; i++) {
+ for (i = optind; i < argc; i++) {
if (!test_crossparse(argv[i], mode))
ret = EXIT_FAILURE;
}
char *gen_identifier(struct test_rng *rng)
{
static const char valid[59] = "_bcdefghijklmpqrsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ size_t i, n;
char *str;
- size_t n;
n = test_rng_uniform_int(rng, 10)+1;
str = malloc_nofail(n+1);
/* Exclude 10 digits from the first character. */
str[0] = valid[test_rng_uniform_int(rng, sizeof valid - 10)];
- for (size_t i = 1; i < n; i++)
+ for (i = 1; i < n; i++)
str[i] = valid[test_rng_uniform_int(rng, sizeof valid)];
str[n] = 0;
struct cdecl_declspec *
gen_randomize_specs(struct test_rng *rng, struct cdecl_declspec *specs)
{
- struct cdecl_declspec **p;
- size_t n = 0;
+ struct cdecl_declspec *s, **p;
+ size_t i, n = 0;
if (!specs)
return specs;
- for (struct cdecl_declspec *s = specs; s; s = s->next)
+ for (s = specs; s; s = s->next)
n++;
p = malloc_nofail((n+1) * sizeof *p);
/* Build a temporary array for easy element swapping. */
p[0] = specs;
p[n] = NULL;
- for (size_t i = 1; i < n; i++)
+ for (i = 1; i < n; i++)
p[i] = p[i-1]->next;
/* Knuth shuffle. */
- for (size_t i = 0; i < n; i++) {
+ for (i = 0; i < n; i++) {
struct cdecl_declspec *tmp;
size_t r;
}
/* Fix up the pointers. */
- for (size_t i = 1; i <= n; i++)
+ for (i = 1; i <= n; i++)
p[i-1]->next = p[i];
specs = p[0];
{
unsigned char tmp;
uintmax_t ret = 0;
+ size_t i;
- for (size_t i = 0; i < sizeof ret; i++) {
+ for (i = 0; i < sizeof ret; i++) {
tmp = test_rng_uniform_int(rng, UCHAR_MAX+1);
ret <<= CHAR_BIT;
ret |= tmp;
/*
* Generate random C declarations for testing.
- * Copyright © 2012, 2020, 2022 Nick Bowler
+ * Copyright © 2012, 2020, 2022-2023 Nick Bowler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
int main(int argc, char **argv)
{
const char *seed = "", *count_str = NULL;
+ unsigned long i, count = 0;
+ int opt, mode = MODE_CDECL;
struct test_rng *rng;
struct cdecl *decl;
- unsigned long count = 0;
- int opt, mode = MODE_CDECL;
if (argc > 0)
progname = argv[0];
if (!rng)
return EXIT_FAILURE;
- for (unsigned long i = 0; !count || i < count; i++) {
+ for (i = 0; !count || i < count; i++) {
decl = random_decl(rng);
if (mode == MODE_ENGLISH) {
#include <config.h>
#include "tap.h"
+#if !HAVE_FOR_DECLS
+int main(void)
+{
+ tap_skip_all("cannot compile reference xoshiro256+");
+}
+#else
#include "rng.c"
#include "xos256p.c"
tap_done();
}
+#endif