]> Savannah Git Hosting - gnulib.git/commitdiff
memset_explicit: Fix compilation error on some OpenSolaris derivatives.
authorBruno Haible <bruno@clisp.org>
Fri, 19 Apr 2024 22:09:11 +0000 (00:09 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 19 Apr 2024 22:09:11 +0000 (00:09 +0200)
* m4/extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Arrange to define
__STDC_WANT_LIB_EXT1__ to 1.
* modules/memset_explicit (Depends-on): Add extensions.
* m4/memset_explicit.m4 (gl_FUNC_MEMSET_EXPLICIT): Require
gl_USE_SYSTEM_EXTENSIONS.
* lib/memset_explicit.c (__STDC_WANT_LIB_EXT1__): Remove definition.

ChangeLog
lib/memset_explicit.c
m4/extensions.m4
m4/memset_explicit.m4
modules/memset_explicit

index 65770c9c33ab76b03f8d50495bbdd2acf91a2351..1a8d80790b41c616b1d0202b264a80f9294c0d93 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-04-19  Bruno Haible  <bruno@clisp.org>
+
+       memset_explicit: Fix compilation error on some OpenSolaris derivatives.
+       * m4/extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Arrange to define
+       __STDC_WANT_LIB_EXT1__ to 1.
+       * modules/memset_explicit (Depends-on): Add extensions.
+       * m4/memset_explicit.m4 (gl_FUNC_MEMSET_EXPLICIT): Require
+       gl_USE_SYSTEM_EXTENSIONS.
+       * lib/memset_explicit.c (__STDC_WANT_LIB_EXT1__): Remove definition.
+
 2024-04-19  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Make use of GLModule's __hash__ method.
index cf6cc6478477b7ae0f6f6a79d13cebc693735648..33c098734820e2d04a852768a12ae5edf839fabc 100644 (file)
 
 #include <config.h>
 
-/* memset_s need this define */
-#if HAVE_MEMSET_S
-# define __STDC_WANT_LIB_EXT1__ 1
-#endif
-
+/* Specification.  */
 #include <string.h>
 
 /* Set S's bytes to C, where S has LEN bytes.  The compiler will not
index 887c6515642b4ee30fb4d02f34c1b212fb545497..fae414135818bfa8c7d2d67f547968da7a0bc59f 100644 (file)
@@ -1,5 +1,5 @@
 # extensions.m4
-# serial 23  -*- Autoconf -*-
+# serial 24  -*- Autoconf -*-
 dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -230,4 +230,10 @@ AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
         [Define to enable the declarations of ISO C 11 types and functions.])
       ;;
   esac
+
+  dnl On OpenSolaris derivatives, the include files contains a couple of
+  dnl declarations that are only activated with an explicit
+  dnl -D__STDC_WANT_LIB_EXT1__.
+  AC_DEFINE([__STDC_WANT_LIB_EXT1__], [1],
+    [Define to enable the declarations of ISO C 23 Annex K types and functions.])
 ])
index a47973ec4a51af6a8ffe139165db2179b991a710..499a95968ab48cfaccc9f34a0ea6610041894f8a 100644 (file)
@@ -1,5 +1,5 @@
 # memset_explicit.m4
-# serial 2
+# serial 3
 dnl Copyright 2022-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,6 +8,8 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_MEMSET_EXPLICIT],
 [
   AC_REQUIRE([gl_STRING_H_DEFAULTS])
+  dnl Persuade OpenSolaris derivatives' <string.h> to declare memset_s().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 
   gl_CHECK_FUNCS_ANDROID([memset_explicit], [[#include <string.h>]])
   if test $ac_cv_func_memset_explicit = no; then
index da16edefd6371451e0b2ee839391406c4b1ee303..294c9f4d8efec2e24edc976845eec44492e026f0 100644 (file)
@@ -7,6 +7,7 @@ m4/memset_explicit.m4
 
 Depends-on:
 string
+extensions
 
 configure.ac:
 gl_FUNC_MEMSET_EXPLICIT