]> git.eshelyaron.com Git - emacs.git/commitdiff
Pacify GCC 15 -Wunterminated-string-initialization
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 20 Apr 2025 02:22:37 +0000 (19:22 -0700)
committerEshel Yaron <me@eshelyaron.com>
Mon, 21 Apr 2025 20:41:23 +0000 (22:41 +0200)
* src/fns.c (hexbuf_digest):
* src/json.c (json_out_string):
Add ATTRIBUTE_NONSTRING to character arrays that are not strings.

(cherry picked from commit e2fb12a40ca2b90dfedbfe916ed8a87345ca89f1)

src/fns.c
src/json.c

index fd240d55f6da2b5f2ed75a836ee382c6e8153c59..eefc74b3b386b6fd33ff54cfab7ccad3e27cf5e9 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -6015,7 +6015,7 @@ hexbuf_digest (char *hexbuf, void const *digest, int digest_size)
 
   for (int i = digest_size - 1; i >= 0; i--)
     {
-      static char const hexdigit[16] = "0123456789abcdef";
+      static char const hexdigit[16] ATTRIBUTE_NONSTRING = "0123456789abcdef";
       int p_i = p[i];
       hexbuf[2 * i] = hexdigit[p_i >> 4];
       hexbuf[2 * i + 1] = hexdigit[p_i & 0xf];
index beac242b709dabdc421a390b3690adc627999392..44eae653eb538cb82957774448189793b518404a 100644 (file)
@@ -323,7 +323,7 @@ json_out_string (json_out_t *jo, Lisp_Object str, int skip)
 {
   /* FIXME: this code is slow, make faster! */
 
-  static const char hexchar[16] = "0123456789ABCDEF";
+  static const char hexchar[16] ATTRIBUTE_NONSTRING = "0123456789ABCDEF";
   ptrdiff_t len = SBYTES (str);
   json_make_room (jo, len + 2);
   json_out_byte (jo, '"');