Apply 9cfe9507fcc22cd4a0c4da486ea1c7f0de6b075f for C23 attribute compliance.

Requested by Jan-Benedict Glaw.
This commit is contained in:
christos 2023-01-15 18:12:37 +00:00
parent d8998d034a
commit 20fbed3887
5 changed files with 38 additions and 33 deletions

View File

@ -85,6 +85,11 @@ Release 2022g - 2022-11-29 08:58:31 -0800
lines are in the file 'backward'. (Inspired by a suggestion from
Stephen Colebourne.)
On C23-compatible platforms tzcode no longer uses syntax like
'static [[noreturn]] void usage(void);'. Instead, it uses
'[[noreturn]] static void usage(void);' as strict C23 requires.
(Problem reported by Houge Langley.)
Release 2022f - 2022-10-28 18:04:57 -0700

View File

@ -1,4 +1,4 @@
/* $NetBSD: localtime.c,v 1.136 2022/12/11 17:57:23 christos Exp $ */
/* $NetBSD: localtime.c,v 1.137 2023/01/15 18:12:37 christos Exp $ */
/* Convert timestamp from time_t to struct tm. */
@ -12,7 +12,7 @@
#if 0
static char elsieid[] = "@(#)localtime.c 8.17";
#else
__RCSID("$NetBSD: localtime.c,v 1.136 2022/12/11 17:57:23 christos Exp $");
__RCSID("$NetBSD: localtime.c,v 1.137 2023/01/15 18:12:37 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -894,7 +894,7 @@ is_digit(char c)
** Return a pointer to that character.
*/
static ATTRIBUTE_REPRODUCIBLE const char *
ATTRIBUTE_REPRODUCIBLE static const char *
getzname(register const char *strp)
{
register char c;
@ -915,7 +915,7 @@ getzname(register const char *strp)
** We don't do any checking here; checking is done later in common-case code.
*/
static ATTRIBUTE_REPRODUCIBLE const char *
ATTRIBUTE_REPRODUCIBLE static const char *
getqzname(register const char *strp, const int delim)
{
register int c;

View File

@ -1,6 +1,6 @@
/* Private header for tzdb code. */
/* $NetBSD: private.h,v 1.64 2022/12/11 17:57:23 christos Exp $ */
/* $NetBSD: private.h,v 1.65 2023/01/15 18:12:37 christos Exp $ */
#ifndef PRIVATE_H
#define PRIVATE_H
@ -646,7 +646,7 @@ char *asctime(struct tm const *);
char *asctime_r(struct tm const *restrict, char *restrict);
char *ctime(time_t const *);
char *ctime_r(time_t const *, char *);
double difftime(time_t, time_t) ATTRIBUTE_UNSEQUENCED;
ATTRIBUTE_UNSEQUENCED double difftime(time_t, time_t);
size_t strftime(char *restrict, size_t, char const *restrict,
struct tm const *restrict);
# if HAVE_STRFTIME_L
@ -762,10 +762,10 @@ timezone_t tzalloc(char const *);
void tzfree(timezone_t);
# ifdef STD_INSPIRED
# if TZ_TIME_T || !defined posix2time_z
time_t posix2time_z(timezone_t __restrict, time_t) ATTRIBUTE_REPRODUCIBLE;
ATTRIBUTE_REPRODUCIBLE time_t posix2time_z(timezone_t __restrict, time_t);
# endif
# if TZ_TIME_T || !defined time2posix_z
time_t time2posix_z(timezone_t __restrict, time_t) ATTRIBUTE_REPRODUCIBLE;
ATTRIBUTE_REPRODUCIBLE time_t time2posix_z(timezone_t __restrict, time_t);
# endif
# endif
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: zdump.c,v 1.60 2022/12/13 19:08:42 christos Exp $ */
/* $NetBSD: zdump.c,v 1.61 2023/01/15 18:12:37 christos Exp $ */
/* Dump time zone data in a textual format. */
/*
@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: zdump.c,v 1.60 2022/12/13 19:08:42 christos Exp $");
__RCSID("$NetBSD: zdump.c,v 1.61 2023/01/15 18:12:37 christos Exp $");
#endif /* !defined lint */
#ifndef NETBSD_INSPIRED
@ -94,7 +94,7 @@ static bool warned;
static bool errout;
static char const *abbr(struct tm const *);
static intmax_t delta(struct tm *, struct tm *) ATTRIBUTE_REPRODUCIBLE;
ATTRIBUTE_REPRODUCIBLE static intmax_t delta(struct tm *, struct tm *);
static void dumptime(struct tm const *);
static time_t hunt(timezone_t, time_t, time_t, bool);
static void show(timezone_t, char *, time_t, bool);
@ -102,7 +102,7 @@ static void showextrema(timezone_t, char *, time_t, struct tm *, time_t);
static void showtrans(char const *, struct tm const *, time_t, char const *,
char const *);
static const char *tformat(void);
static time_t yeartot(intmax_t) ATTRIBUTE_REPRODUCIBLE;
ATTRIBUTE_REPRODUCIBLE static time_t yeartot(intmax_t);
/* Is C an ASCII digit? */
static bool
@ -130,7 +130,7 @@ is_alpha(char a)
}
}
static ATTRIBUTE_NORETURN void
ATTRIBUTE_NORETURN static void
size_overflow(void)
{
fprintf(stderr, _("%s: size overflow\n"), progname);
@ -139,7 +139,7 @@ size_overflow(void)
/* Return A + B, exiting if the result would overflow either ptrdiff_t
or size_t. */
static ATTRIBUTE_REPRODUCIBLE ptrdiff_t
ATTRIBUTE_REPRODUCIBLE static ptrdiff_t
sumsize(size_t a, size_t b)
{
#ifdef ckd_add
@ -156,7 +156,7 @@ sumsize(size_t a, size_t b)
/* Return a pointer to a newly allocated buffer of size SIZE, exiting
on failure. SIZE should be nonzero. */
static void * ATTRIBUTE_MALLOC
ATTRIBUTE_MALLOC static void *
xmalloc(size_t size)
{
void *p = malloc(size);
@ -922,7 +922,7 @@ showextrema(timezone_t tz, char *zone, time_t lo, struct tm *lotmp, time_t hi)
# include <stdarg.h>
/* A substitute for snprintf that is good enough for zdump. */
static int ATTRIBUTE_FORMAT((printf, 3, 4))
ATTRIBUTE_FORMAT((printf, 3, 4)) static int
my_snprintf(char *s, size_t size, char const *format, ...)
{
int n;

View File

@ -1,4 +1,4 @@
/* $NetBSD: zic.c,v 1.87 2022/12/13 19:08:42 christos Exp $ */
/* $NetBSD: zic.c,v 1.88 2023/01/15 18:12:37 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
** 2006-07-17 by Arthur David Olson.
@ -11,7 +11,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: zic.c,v 1.87 2022/12/13 19:08:42 christos Exp $");
__RCSID("$NetBSD: zic.c,v 1.88 2023/01/15 18:12:37 christos Exp $");
#endif /* !defined lint */
/* Use the system 'time' function, instead of any private replacement.
@ -472,20 +472,20 @@ static char roll[TZ_MAX_LEAPS];
** Memory allocation.
*/
static ATTRIBUTE_NORETURN void
ATTRIBUTE_NORETURN static void
memory_exhausted(const char *msg)
{
fprintf(stderr, _("%s: Memory exhausted: %s\n"), progname, msg);
exit(EXIT_FAILURE);
}
static ATTRIBUTE_NORETURN void
ATTRIBUTE_NORETURN static void
size_overflow(void)
{
memory_exhausted(_("size overflow"));
}
static ATTRIBUTE_REPRODUCIBLE ptrdiff_t
ATTRIBUTE_REPRODUCIBLE static ptrdiff_t
size_sum(size_t a, size_t b)
{
#ifdef ckd_add
@ -500,7 +500,7 @@ size_sum(size_t a, size_t b)
size_overflow();
}
static ATTRIBUTE_REPRODUCIBLE ptrdiff_t
ATTRIBUTE_REPRODUCIBLE static ptrdiff_t
size_product(ptrdiff_t nitems, ptrdiff_t itemsize)
{
#ifdef ckd_mul
@ -515,7 +515,7 @@ size_product(ptrdiff_t nitems, ptrdiff_t itemsize)
size_overflow();
}
static ATTRIBUTE_REPRODUCIBLE ptrdiff_t
ATTRIBUTE_REPRODUCIBLE static ptrdiff_t
align_to(ptrdiff_t size, ptrdiff_t alignment)
{
ptrdiff_t lo_bits = alignment - 1, sum = size_sum(size, lo_bits);
@ -539,7 +539,7 @@ memcheck(void *ptr)
return ptr;
}
static void * ATTRIBUTE_MALLOC
ATTRIBUTE_MALLOC static void *
emalloc(size_t size)
{
return memcheck(malloc(size));
@ -551,7 +551,7 @@ erealloc(void *ptr, size_t size)
return memcheck(realloc(ptr, size));
}
static char * ATTRIBUTE_MALLOC
ATTRIBUTE_MALLOC static char *
estrdup(char const *str)
{
return memcheck(strdup(str));
@ -622,7 +622,7 @@ eat(int fnum, lineno num)
eats(fnum, num, 0, -1);
}
static void ATTRIBUTE_FORMAT((printf, 1, 0))
ATTRIBUTE_FORMAT((printf, 1, 0)) static void
verror(const char *const string, va_list args)
{
/*
@ -640,7 +640,7 @@ verror(const char *const string, va_list args)
fprintf(stderr, "\n");
}
static void ATTRIBUTE_FORMAT((printf, 1, 2))
ATTRIBUTE_FORMAT((printf, 1, 2)) static void
error(const char *const string, ...)
{
va_list args;
@ -650,7 +650,7 @@ error(const char *const string, ...)
errors = true;
}
static void ATTRIBUTE_FORMAT((printf, 1, 2))
ATTRIBUTE_FORMAT((printf, 1, 2)) static void
warning(const char *const string, ...)
{
va_list args;
@ -680,7 +680,7 @@ close_file(FILE *stream, char const *dir, char const *name,
}
}
static ATTRIBUTE_NORETURN void
ATTRIBUTE_NORETURN static void
usage(FILE *stream, int status)
{
fprintf(stream,
@ -3626,7 +3626,7 @@ lowerit(char a)
}
/* case-insensitive equality */
static ATTRIBUTE_REPRODUCIBLE bool
ATTRIBUTE_REPRODUCIBLE static bool
ciequal(const char *ap, const char *bp)
{
while (lowerit(*ap) == lowerit(*bp++))
@ -3635,7 +3635,7 @@ ciequal(const char *ap, const char *bp)
return false;
}
static ATTRIBUTE_REPRODUCIBLE bool
ATTRIBUTE_REPRODUCIBLE static bool
itsabbr(const char *abbr, const char *word)
{
if (lowerit(*abbr) != lowerit(*word))
@ -3651,7 +3651,7 @@ itsabbr(const char *abbr, const char *word)
/* Return true if ABBR is an initial prefix of WORD, ignoring ASCII case. */
static ATTRIBUTE_REPRODUCIBLE bool
ATTRIBUTE_REPRODUCIBLE static bool
ciprefix(char const *abbr, char const *word)
{
do
@ -3775,7 +3775,7 @@ oadd(zic_t t1, zic_t t2)
time_overflow();
}
static ATTRIBUTE_REPRODUCIBLE zic_t
ATTRIBUTE_REPRODUCIBLE static zic_t
tadd(zic_t t1, zic_t t2)
{
#ifdef ckd_add