Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/time Apply 9cfe9507fcc22cd4a0c4da486ea1c7f0de6b075f...



details:   https://anonhg.NetBSD.org/src/rev/bcab20660a82
branches:  trunk
changeset: 373064:bcab20660a82
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 15 18:12:37 2023 +0000

description:
Apply 9cfe9507fcc22cd4a0c4da486ea1c7f0de6b075f for C23 attribute compliance.
Requested by Jan-Benedict Glaw.

diffstat:

 lib/libc/time/NEWS        |   5 +++++
 lib/libc/time/localtime.c |   8 ++++----
 lib/libc/time/private.h   |   8 ++++----
 lib/libc/time/zdump.c     |  16 ++++++++--------
 lib/libc/time/zic.c       |  34 +++++++++++++++++-----------------
 5 files changed, 38 insertions(+), 33 deletions(-)

diffs (truncated from 306 to 300 lines):

diff -r f14c3a63b1b0 -r bcab20660a82 lib/libc/time/NEWS
--- a/lib/libc/time/NEWS        Sun Jan 15 16:45:32 2023 +0000
+++ b/lib/libc/time/NEWS        Sun Jan 15 18:12:37 2023 +0000
@@ -85,6 +85,11 @@
     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
 
diff -r f14c3a63b1b0 -r bcab20660a82 lib/libc/time/localtime.c
--- a/lib/libc/time/localtime.c Sun Jan 15 16:45:32 2023 +0000
+++ b/lib/libc/time/localtime.c Sun Jan 15 18:12:37 2023 +0000
@@ -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 @@
 ** 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 @@
 ** 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;
diff -r f14c3a63b1b0 -r bcab20660a82 lib/libc/time/private.h
--- a/lib/libc/time/private.h   Sun Jan 15 16:45:32 2023 +0000
+++ b/lib/libc/time/private.h   Sun Jan 15 18:12:37 2023 +0000
@@ -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_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 @@
 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
diff -r f14c3a63b1b0 -r bcab20660a82 lib/libc/time/zdump.c
--- a/lib/libc/time/zdump.c     Sun Jan 15 16:45:32 2023 +0000
+++ b/lib/libc/time/zdump.c     Sun Jan 15 18:12:37 2023 +0000
@@ -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    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 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 @@
        }
 }
 
-static ATTRIBUTE_NORETURN void
+ATTRIBUTE_NORETURN static void
 size_overflow(void)
 {
   fprintf(stderr, _("%s: size overflow\n"), progname);
@@ -139,7 +139,7 @@
 
 /* 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 @@
 
 /* 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 @@
 # 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;
diff -r f14c3a63b1b0 -r bcab20660a82 lib/libc/time/zic.c
--- a/lib/libc/time/zic.c       Sun Jan 15 16:45:32 2023 +0000
+++ b/lib/libc/time/zic.c       Sun Jan 15 18:12:37 2023 +0000
@@ -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 @@
 ** 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_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_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 @@
        return ptr;
 }
 
-static void * ATTRIBUTE_MALLOC
+ATTRIBUTE_MALLOC static void *
 emalloc(size_t size)
 {
        return memcheck(malloc(size));
@@ -551,7 +551,7 @@
        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 @@
        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 @@
        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 @@
        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 @@
   }
 }
 
-static ATTRIBUTE_NORETURN void
+ATTRIBUTE_NORETURN static void
 usage(FILE *stream, int status)
 {
   fprintf(stream,
@@ -3626,7 +3626,7 @@
 }
 
 /* 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 @@
        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 @@
 
 /* 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 @@
   time_overflow();
 }



Home | Main Index | Thread Index | Old Index