Mercurial > hg > octave-lojdl > gnulib-hg
changeset 13457:fd542c59e379
New module '_Exit'.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 12 Jul 2010 18:54:13 +0200 |
parents | fd291325b6d5 |
children | 188d51de4042 |
files | ChangeLog doc/posix-functions/_Exit_C99.texi lib/_Exit.c lib/stdlib.in.h m4/_Exit.m4 m4/stdlib_h.m4 modules/_Exit modules/stdlib tests/test-stdlib-c++.cc |
diffstat | 9 files changed, 124 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-07-12 Bruno Haible <bruno@clisp.org> + + New module '_Exit'. + * lib/stdlib.in.h (__attribute__): New macro. + (_Exit): New declaration. + * lib/_Exit.c: New file. + * m4/_Exit.m4: New file. + * m4/stdlib_h.m4 (gl_STDLIB_H): Check whether _Exit is declared. + (gl_STDLIB_H_DEFAULTS): Initialize GNULIB__EXIT and HAVE__EXIT. + * modules/stdlib (Makefile.am): Substitute GNULIB__EXIT and HAVE__EXIT. + * modules/_Exit: New file. + * tests/test-stdlib-c++.cc (_Exit): Check signature. + * doc/posix-functions/_Exit_C99.texi: Mention the new module. + 2010-07-12 Paul R. Eggert <eggert@cs.ucla.edu> strtod: make it more-accurate typically, and don't require libm
--- a/doc/posix-functions/_Exit_C99.texi +++ b/doc/posix-functions/_Exit_C99.texi @@ -7,15 +7,15 @@ POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/_Exit.html} -Gnulib module: --- +Gnulib module: _Exit Portability problems fixed by Gnulib: @itemize -@end itemize - -Portability problems not fixed by Gnulib: -@itemize @item This function is missing on some platforms: AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x, Interix 3.5, BeOS. @end itemize + +Portability problems not fixed by Gnulib: +@itemize +@end itemize
new file mode 100644 --- /dev/null +++ b/lib/_Exit.c @@ -0,0 +1,27 @@ +/* Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <stdlib.h> + +#include <unistd.h> + +void +_Exit (int status) +{ + _exit (status); +}
--- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -74,6 +74,12 @@ # include <unistd.h> #endif +#ifndef __attribute__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) +# define __attribute__(Spec) /* empty */ +# endif +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -95,6 +101,23 @@ #endif +#if @GNULIB__EXIT@ +/* Terminate the current process with the given return code, without running + the 'atexit' handlers. */ +# if !@HAVE__EXIT@ +_GL_FUNCDECL_SYS (_Exit, void, (int status) __attribute__ ((__noreturn__))); +# endif +_GL_CXXALIAS_SYS (_Exit, void, (int status)); +_GL_CXXALIASWARN (_Exit); +#elif defined GNULIB_POSIXCHECK +# undef _Exit +# if HAVE_RAW_DECL__EXIT +_GL_WARN_ON_USE (_Exit, "_Exit is unportable - " + "use gnulib module _Exit for portability"); +# endif +#endif + + #if @GNULIB_ATOLL@ /* Parse a signed decimal integer. Returns the value of the integer. Errors are not detected. */
new file mode 100644 --- /dev/null +++ b/m4/_Exit.m4 @@ -0,0 +1,21 @@ +# _Exit.m4 serial 1 +dnl Copyright (C) 2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC__EXIT], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_CHECK_FUNCS([_Exit]) + if test $ac_cv_func__Exit = no; then + HAVE__EXIT=0 + AC_LIBOBJ([_Exit]) + gl_PREREQ__EXIT + fi +]) + +# Prerequisites of lib/_Exit.c. +AC_DEFUN([gl_PREREQ__EXIT], [ + : +])
--- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 29 +# stdlib_h.m4 serial 30 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -33,7 +33,7 @@ #if HAVE_RANDOM_H # include <random.h> #endif - ]], [atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp + ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt unsetenv]) @@ -50,6 +50,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], [ + GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT]) GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) @@ -75,6 +76,7 @@ GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
new file mode 100644 --- /dev/null +++ b/modules/_Exit @@ -0,0 +1,24 @@ +Description: +_Exit() function: terminate current process. + +Files: +lib/_Exit.c +m4/_Exit.m4 + +Depends-on: +stdlib + +configure.ac: +gl_FUNC__EXIT +gl_STDLIB_MODULE_INDICATOR([_Exit]) + +Makefile.am: + +Include: +<stdlib.h> + +License: +LGPL + +Maintainer: +all
--- a/modules/stdlib +++ b/modules/stdlib @@ -28,6 +28,7 @@ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ + -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \ -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \ @@ -52,6 +53,7 @@ -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ + -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \