From: Bruce Korb Date: Fri, 31 Dec 2010 00:54:34 +0000 (-0800) Subject: remove error module stuff in openat-die.c when GNULIB_LIBPOSIX X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=9a995cb7ad9733f63d4fcc7e62e0ec83042b19bb;p=gnulib.git remove error module stuff in openat-die.c when GNULIB_LIBPOSIX --- diff --git a/ChangeLog b/ChangeLog index c809bc0753..afac8d8d33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ 2010-12-30 Bruce Korb * libposix/bootstrap (posix_list): remove unnecessary temp file + (modules): install all modules to tmp/modules that reference + the 'error' module. + * libposix/configure.ac (GNULIB_LIBPOSIX): define this in + config.h so that openat-die.c can omit calls to error(). + * lib/openat-die.c: remove error module stuff when GNULIB_LIBPOSIX + is defined. 2010-12-29 Eric Blake diff --git a/lib/openat-die.c b/lib/openat-die.c index a8639e11de..ad2476ffba 100644 --- a/lib/openat-die.c +++ b/lib/openat-die.c @@ -21,7 +21,9 @@ #include +#ifndef GNULIB_LIBPOSIX #include "error.h" +#endif GNULIB_LIBPOSIX #include "exitfail.h" #include "gettext.h" @@ -30,9 +32,10 @@ void openat_save_fail (int errnum) { +#ifndef GNULIB_LIBPOSIX error (exit_failure, errnum, _("unable to record current working directory")); - +#endif GNULIB_LIBPOSIX /* The `noreturn' attribute cannot be applied to error, since it returns when its first argument is 0. To help compilers understand that this function does not return, call abort. Also, the abort is a @@ -48,8 +51,10 @@ openat_save_fail (int errnum) void openat_restore_fail (int errnum) { +#ifndef GNULIB_LIBPOSIX error (exit_failure, errnum, _("failed to return to initial working directory")); +#endif GNULIB_LIBPOSIX /* As above. */ abort (); diff --git a/libposix/bootstrap b/libposix/bootstrap index bfb80ec8a8..d96524073d 100755 --- a/libposix/bootstrap +++ b/libposix/bootstrap @@ -14,7 +14,7 @@ fi posix_list=` { echo alloca - posix-modules + posix-modules | sed '/^error$/d' } | tr -d ' \t' | sed '/^$/d' | sort -u` cat > tmp/modules/libposix <<- _EOF_ @@ -41,6 +41,21 @@ cat > tmp/modules/libposix <<- _EOF_ Gary V. Vaughan _EOF_ +# We cannot tell which modules will get pulled in via dependencies +# when gnulib-tool gets run. Therefore, strip out "error" from all +# modules that mention it. Either we won't use the module, or the +# module will have to be tweaked to remove the dependency for libposix. +# "GNULIB_LIBPOSIX" is a CPP symbol for libposix. +# +set -- `egrep -l '^error$' ../modules/[a-z]*` + +for mod +do + test "X$mod" = Xerror && continue + echo 'NOTE: removing "error" dependency from' ${mod} + d=`basename $mod` + sed '/^error$/d' ${mod} > tmp/modules/$d +done >&2 opts='--local-dir=tmp --import @@ -55,10 +70,13 @@ opts='--local-dir=tmp --with-longrunning-tests' # Bootstrap for autotools. +# gnulib-tool ${opts} git-version-gen libposix # No need to maintain a Makefile.am just to include gnulib.mk. +# mv tests/gnulib.mk tests/Makefile.am # Run autotools. +# autoreconf --force --install --verbose --symlink diff --git a/libposix/configure.ac b/libposix/configure.ac index b1bd652810..db49a02b98 100644 --- a/libposix/configure.ac +++ b/libposix/configure.ac @@ -28,6 +28,7 @@ LT_INIT AC_SUBST([LTV_CURRENT], 0) AC_SUBST([LTV_REVISION], 0) AC_SUBST([LTV_AGE], 0) +AC_DEFINE_UNQUOTED(GNULIB_LIBPOSIX,1,[we are libposix]) AC_PROG_CC LIBPOSIX_EARLY