From ec37879038217a74cd056001b40d9898b4d86eec Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 3 Sep 2024 10:16:05 -0400 Subject: [PATCH] appl/tests: auditdns eliminate use of 'restrict' keyword if !C99 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'restrict' keyword was introduced in C99 and provides a hint to the compiler that can be used to better optimized code. The 'restrict' keyword results in build failures when the compiler is not C99. auditdns.c:101:37: error: expected ‘;’, ‘,’ or ‘)’ before ‘hints’ const struct addrinfo *restrict hints, ^ auditdns.c:409:45: error: expected ‘;’, ‘,’ or ‘)’ before ‘sa’ getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, ^ This change defines 'register' to nothing if the compiler does not implement the C99 standard. Observed with gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44). --- appl/test/auditdns.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/appl/test/auditdns.c b/appl/test/auditdns.c index 4f5b1dde5..3a79af45e 100644 --- a/appl/test/auditdns.c +++ b/appl/test/auditdns.c @@ -40,6 +40,10 @@ #include "resolve.h" #include "roken.h" +#if (__STDC_VERSION__ - 0) < 199901L +# define restrict /* empty */ +#endif + struct rk_dns_reply * rk_dns_lookup(const char *domain, const char *type_name) {