mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Deprecate 'tmpnam' and add '--disable-tmpnam' configure option.
* configure.ac: Add '--disable-tmpnam'. * libguile/posix.c (tmpnam): Conditionalize on 'SCM_ENABLE_DEPRECATED' and 'ENABLE_TMPNAM'. Call 'scm_c_issue_deprecation_warning'. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
bef5e0b393
commit
b62d849d36
2 changed files with 19 additions and 0 deletions
|
@ -166,6 +166,10 @@ AC_ARG_ENABLE(regex,
|
|||
[ --disable-regex omit regular expression interfaces],,
|
||||
enable_regex=yes)
|
||||
|
||||
AC_ARG_ENABLE(tmpnam,
|
||||
AS_HELP_STRING([--disable-tmpnam],[omit POSIX tmpnam]),,
|
||||
enable_tmpnam=yes)
|
||||
|
||||
AC_ARG_ENABLE([deprecated],
|
||||
AS_HELP_STRING([--disable-deprecated],[omit deprecated features]))
|
||||
|
||||
|
@ -909,6 +913,10 @@ if test "$enable_regex" = yes; then
|
|||
AC_DEFINE([ENABLE_REGEX], 1, [Define when regex support is enabled.])
|
||||
fi
|
||||
|
||||
if test "$enable_tmpnam" = yes; then
|
||||
AC_DEFINE([ENABLE_TMPNAM], 1, [Define when tmpnam support is enabled.])
|
||||
fi
|
||||
|
||||
AC_REPLACE_FUNCS([strerror memmove])
|
||||
|
||||
# Reasons for testing:
|
||||
|
|
|
@ -87,6 +87,10 @@
|
|||
#include "vectors.h"
|
||||
#include "version.h"
|
||||
|
||||
#if (SCM_ENABLE_DEPRECATED == 1)
|
||||
#include "deprecation.h"
|
||||
#endif
|
||||
|
||||
#include "posix.h"
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
|
@ -1588,6 +1592,8 @@ SCM_DEFINE (scm_environ, "environ", 0, 1, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
#if (SCM_ENABLE_DEPRECATED == 1)
|
||||
#ifdef ENABLE_TMPNAM
|
||||
#ifdef L_tmpnam
|
||||
|
||||
SCM_DEFINE (scm_tmpnam, "tmpnam", 0, 0, 0,
|
||||
|
@ -1602,6 +1608,9 @@ SCM_DEFINE (scm_tmpnam, "tmpnam", 0, 0, 0,
|
|||
char name[L_tmpnam];
|
||||
char *rv;
|
||||
|
||||
scm_c_issue_deprecation_warning
|
||||
("Use of tmpnam is deprecated. Use mkstemp! instead.");
|
||||
|
||||
SCM_SYSCALL (rv = tmpnam (name));
|
||||
if (rv == NULL)
|
||||
/* not SCM_SYSERROR since errno probably not set. */
|
||||
|
@ -1610,6 +1619,8 @@ SCM_DEFINE (scm_tmpnam, "tmpnam", 0, 0, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
SCM_DEFINE (scm_tmpfile, "tmpfile", 0, 0, 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue