]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
m4/dovecot.m4, lib: Add ATTR_NONSTRING macro
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 14 Oct 2025 09:38:08 +0000 (12:38 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 14 Oct 2025 15:27:29 +0000 (15:27 +0000)
m4/dovecot.m4
src/lib/macros.h

index 3e1aadf004d5b9453fe88575470791c818005b5b..6e6bdc2101ff8d7ccde48523377691340679cb9a 100644 (file)
@@ -6,7 +6,7 @@ dnl This file is free software; the authors give
 dnl unlimited permission to copy and/or distribute it, with or without
 dnl modifications, as long as this notice is preserved.
 
-# serial 44
+# serial 45
 
 dnl
 dnl Check for support for D_FORTIFY_SOURCE=2
@@ -79,6 +79,15 @@ AC_DEFUN([DC_DOVECOT_CFLAGS],[
         dnl gcc4
         AM_CFLAGS="$AM_CFLAGS -Wstrict-aliasing=2"
       ],[])
+
+    old_cflags=$CFLAGS
+    CFLAGS="$CFLAGS -Werror"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+      const unsigned char foo[4] __attribute__((nonstring)) = "1234";
+      ]], [[]])],[
+        AC_DEFINE(HAVE_ATTR_NONSTRING,, [define if you have nonstring attribute])
+      ])
+    CFLAGS="$old_cflags"
   ])
 ])
 
index b7c1adc789237891d876fbb423871f085f79bc3a..ebc1bf23f8c25894ddf4758a94f49d7074f3ef9e 100644 (file)
 #else
 #  define ATTR_DEPRECATED(str)
 #endif
+#ifdef HAVE_ATTR_NONSTRING
+#  define ATTR_NONSTRING __attribute__((nonstring))
+#else
+#  define ATTR_NONSTRING
+#endif
 
 /* Macros to provide type safety for callback functions' context parameters.
    This is used like: