]> 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, 26 Apr 2024 08:56:26 +0000 (10:56 +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 18f412a483dac30727e935c8ec087d5b28d353e7..fb370bedccce125885863e48eb44ad8966ff1e44 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-08  Bruno Haible  <bruno@clisp.org>
 
        ptsname_r: Work around ptsname_r bug on NetBSD 10.0.
index 6d21a5e8797f5b1ad379076da052437b0cd540bc..33c098734820e2d04a852768a12ae5edf839fabc 100644 (file)
@@ -1,5 +1,5 @@
 /* Erase sensitive data from memory.
-   Copyright 2022-2023 Free Software Foundation, Inc.
+   Copyright 2022-2024 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as
 
 #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 5336b8daf7e4a41ccba40626ed451b2c34981b6c..f600f61ec0892b390e1fdbcf5505162a45e396f8 100644 (file)
@@ -1,7 +1,7 @@
-# serial 23  -*- Autoconf -*-
+# serial 25  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2023 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -229,4 +229,15 @@ 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__.
+  AH_VERBATIM([USE_ISO_C_23_ANNEX_K_EXTENSIONS],
+[/* Define to enable the declarations of ISO C 23 Annex K types and functions.  */
+#if !(defined __STDC_WANT_LIB_EXT1__ && __STDC_WANT_LIB_EXT1__)
+#undef/**/__STDC_WANT_LIB_EXT1__
+#define __STDC_WANT_LIB_EXT1__ 1
+#endif
+])
 ])
index 19514ff917e65487d8fdf5995d55d43f58540435..bed6f14b0c3bd6ef9f999c2b8f053786ca15c3a5 100644 (file)
@@ -1,4 +1,4 @@
-# memset_explicit.m4 serial 2
+# memset_explicit.m4 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,
@@ -7,6 +7,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