INN commit: trunk (4 files)
INN Commit
rra at isc.org
Sat May 16 21:02:15 UTC 2020
Date: Saturday, May 16, 2020 @ 14:02:15
Author: iulius
Revision: 10369
Update to latest C TAP Harness anbd rra-c-util upstream versions
Modified:
trunk/include/clibrary.h
trunk/lib/snprintf.c
trunk/support/getrra-c-util
trunk/tests/runtests.c
-----------------------+
include/clibrary.h | 12 +++++++++++-
lib/snprintf.c | 31 ++++++++++++++++++++++++++++---
support/getrra-c-util | 4 ++--
tests/runtests.c | 3 +++
4 files changed, 44 insertions(+), 6 deletions(-)
Modified: include/clibrary.h
===================================================================
--- include/clibrary.h 2020-05-16 20:38:07 UTC (rev 10368)
+++ include/clibrary.h 2020-05-16 21:02:15 UTC (rev 10369)
@@ -27,7 +27,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2014, 2016, 2018 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2014, 2016, 2018, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2006-2011, 2013-2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -130,6 +130,16 @@
# endif
#endif
+/*
+ * If explicit_bzero is not available, fall back on memset. This does NOT
+ * provide any of the security guarantees of explicit_bzero and will probably
+ * be optimized away by the compiler. It just ensures that code will compile
+ * and function on systems without explicit_bzero.
+ */
+#if !HAVE_EXPLICIT_BZERO
+# define explicit_bzero(s, n) memset((s), 0, (n))
+#endif
+
BEGIN_DECLS
/*
Modified: lib/snprintf.c
===================================================================
--- lib/snprintf.c 2020-05-16 20:38:07 UTC (rev 10368)
+++ lib/snprintf.c 2020-05-16 21:02:15 UTC (rev 10369)
@@ -26,6 +26,28 @@
# define vsnprintf test_vsnprintf
#endif
+/*
+ * __attribute__ is available in gcc 2.5 and later, but only with gcc 2.7
+ * could you use the __format__ form of the attributes, which is what we use
+ * (to avoid confusion with other macros).
+ */
+#ifndef __attribute__
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __attribute__(spec) /* empty */
+# endif
+#endif
+
+/*
+ * Older Clang doesn't support __attribute__((fallthrough)) properly and
+ * complains about the empty statement that it is decorating. Suppress that
+ * warning. Also suppress warnings about unknown attributes to handle older
+ * Clang versions.
+ */
+#if !defined(__attribute__) && (defined(__llvm__) || defined(__clang__))
+# pragma GCC diagnostic ignored "-Wattributes"
+# pragma GCC diagnostic ignored "-Wmissing-declarations"
+#endif
+
/* Specific to rra-c-util, but only when debugging is enabled. */
#ifdef DEBUG_SNPRINTF
# include "inn/messages.h"
@@ -367,7 +389,8 @@
break;
case 'X':
flags |= DP_F_UP;
- /* fallthrough */
+ __attribute__((fallthrough));
+ /* fall through */
case 'x':
flags |= DP_F_UNSIGNED;
if (cflags == DP_C_SHORT)
@@ -389,7 +412,8 @@
break;
case 'E':
flags |= DP_F_UP;
- /* fallthrough */
+ __attribute__((fallthrough));
+ /* fall through */
case 'e':
if (cflags == DP_C_LDOUBLE)
fvalue = va_arg (args, LDOUBLE);
@@ -399,7 +423,8 @@
break;
case 'G':
flags |= DP_F_UP;
- /* fallthrough */
+ __attribute__((fallthrough));
+ /* fall through */
case 'g':
flags |= DP_F_FP_G;
if (cflags == DP_C_LDOUBLE)
Modified: support/getrra-c-util
===================================================================
--- support/getrra-c-util 2020-05-16 20:38:07 UTC (rev 10368)
+++ support/getrra-c-util 2020-05-16 21:02:15 UTC (rev 10369)
@@ -119,7 +119,7 @@
# define SEEK_END 2\\
#endif\\
" \
- -e "122 i \\
+ -e "135 i \\
/*\\
* Handle defining fseeko and ftello. If HAVE_FSEEKO is defined, the system\\
* header files take care of this for us. Otherwise, see if we're building\\
@@ -161,7 +161,7 @@
extern int symlink(const char *, const char *);\\
#endif\\
" \
- -e "163 i \\
+ -e "172 i \\
#if !HAVE_DECL_STRLCAT\\
extern size_t strlcat(char *, const char *, size_t);\\
#endif\\
Modified: tests/runtests.c
===================================================================
--- tests/runtests.c 2020-05-16 20:38:07 UTC (rev 10368)
+++ tests/runtests.c 2020-05-16 21:02:15 UTC (rev 10369)
@@ -388,6 +388,9 @@
static void *
x_reallocarray(void *p, size_t n, size_t size, const char *file, int line)
{
+ n = (n > 0) ? n : 1;
+ size = (size > 0) ? size : 1;
+
if (n > 0 && UINT_MAX / n <= size)
sysdie("realloc too large at %s line %d", file, line);
p = realloc(p, n * size);
More information about the inn-committers
mailing list