* 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

Reply via email to