[PROPOSED 1/3] Pacify GCC 15 -Wunterminated-string-initialization
* private.h (ATTRIBUTE_NONSTRING): New macro. * localtime.c (tzdirslash) [!OPENAT_TZDIR]: Use it. --- localtime.c | 3 +++ private.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/localtime.c b/localtime.c index 186c7bf3..8ef529d5 100644 --- a/localtime.c +++ b/localtime.c @@ -571,6 +571,9 @@ union input_buffer { }; /* TZDIR with a trailing '/'. It is null-terminated if OPENAT_TZDIR. */ +#if !OPENAT_TZDIR +ATTRIBUTE_NONSTRING +#endif static char const tzdirslash[sizeof TZDIR + OPENAT_TZDIR] = TZDIR "/"; static size_t const tzdirslashlen = sizeof TZDIR; diff --git a/private.h b/private.h index 867340fa..23f1d9fb 100644 --- a/private.h +++ b/private.h @@ -555,6 +555,12 @@ typedef unsigned long uintmax_t; # define HAVE___HAS_C_ATTRIBUTE false #endif +#if 8 <= __GNUC__ +# define ATTRIBUTE_NONSTRING __attribute__((__nonstring__)) +#else +# define ATTRIBUTE_NONSTRING +#endif + #if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(deprecated) # define ATTRIBUTE_DEPRECATED [[deprecated]] -- 2.51.0
* Makefile (UNUSUAL_OK_CHARSET): Add ‘⟨’ and ‘⟩’. groff 1.23 -man .UR puts these into the .txt files. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 47d0643c..d1a9a69c 100644 --- a/Makefile +++ b/Makefile @@ -547,7 +547,7 @@ SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' # These non-alphabetic, non-ASCII printable characters are # used in commentary or in generated *.txt files # and are not likely to cause confusion. -UNUSUAL_OK_CHARSET= §«°±»½¾×–‘’“”•→−≤★⯪ +UNUSUAL_OK_CHARSET= §«°±»½¾×–‘’“”•→−≤★⟨⟩⯪ # Put this in a bracket expression to match spaces. s = [:space:] -- 2.51.0
* localtime.c (TZ_STRLEN_MAX): Document that longer names work, albeit less efficiently. --- localtime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/localtime.c b/localtime.c index 8ef529d5..2da68ab4 100644 --- a/localtime.c +++ b/localtime.c @@ -336,6 +336,8 @@ static struct state *const lclptr = &lclmem; static struct state *const gmtptr = &gmtmem; #endif /* State Farm */ +/* Maximum number of bytes in an efficiently-handled TZ string. + Longer strings work, albeit less efficiently. */ #ifndef TZ_STRLEN_MAX # define TZ_STRLEN_MAX 255 #endif /* !defined TZ_STRLEN_MAX */ -- 2.51.0
participants (1)
-
Paul Eggert