* should be sent to the e-mail address below. This program is part of C TAP
* Harness <https://www.eyrie.org/~eagle/software/c-tap-harness/>.
*
- * Copyright 2000-2001, 2004, 2006-2019 Russ Allbery <eagle@eyrie.org>
+ * Copyright 2000-2001, 2004, 2006-2019, 2022 Russ Allbery <eagle@eyrie.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#endif
/* Test status codes. */
-enum test_status { TEST_FAIL, TEST_PASS, TEST_SKIP, TEST_INVALID };
+enum test_status {
+ TEST_FAIL,
+ TEST_PASS,
+ TEST_SKIP,
+ TEST_INVALID
+};
/* Really, just a boolean, but this is more self-documenting. */
-enum test_verbose { CONCISE = 0, VERBOSE = 1 };
+enum test_verbose {
+ CONCISE = 0,
+ VERBOSE = 1
+};
/* Indicates the state of our plan. */
enum plan_status {
# endif
#endif
+/*
+ * Suppress the argument to __malloc__ in Clang (not supported in at least
+ * version 13) and GCC versions prior to 11.
+ */
+#if !defined(__attribute__) && !defined(__malloc__)
+# if defined(__clang__) || __GNUC__ < 11
+# define __malloc__(dalloc) __malloc__
+# endif
+#endif
+
/*
* LLVM and Clang pretend to be GCC but don't support all of the __attribute__
* settings that GCC does. For them, suppress warnings about unknown
static void sysdie(const char *, ...)
__attribute__((__nonnull__, __noreturn__, __format__(printf, 1, 2)));
static void *x_calloc(size_t, size_t, const char *, int)
- __attribute__((__alloc_size__(1, 2), __malloc__, __nonnull__));
+ __attribute__((__alloc_size__(1, 2), __malloc__(free), __nonnull__));
static void *x_malloc(size_t, const char *, int)
- __attribute__((__alloc_size__(1), __malloc__, __nonnull__));
+ __attribute__((__alloc_size__(1), __malloc__(free), __nonnull__));
static void *x_reallocarray(void *, size_t, size_t, const char *, int)
- __attribute__((__alloc_size__(2, 3), __malloc__, __nonnull__(4)));
+ __attribute__((__alloc_size__(2, 3), __malloc__(free), __nonnull__(4)));
static char *x_strdup(const char *, const char *, int)
- __attribute__((__malloc__, __nonnull__));
+ __attribute__((__malloc__(free), __nonnull__));
static char *x_strndup(const char *, size_t, const char *, int)
- __attribute__((__malloc__, __nonnull__));
+ __attribute__((__malloc__(free), __nonnull__));
/*
char *copy;
/* Don't assume that the source string is nul-terminated. */
- for (p = s; (size_t)(p - s) < size && *p != '\0'; p++)
+ for (p = s; (size_t) (p - s) < size && *p != '\0'; p++)
;
- len = (size_t)(p - s);
+ len = (size_t) (p - s);
copy = (char *) malloc(len + 1);
if (copy == NULL)
sysdie("failed to strndup %lu bytes at %s line %d",