ltlfilt: use error() to report errors.

* lib/error.c, lib/error.h, lib/msvc-inval.c, lib/msvc-inval.h,
lib/msvc-nothrow.c, lib/msvc-nothrow.h, m4/error.m4, m4/msvc-inval.m4,
m4/msvc-nothrow.m4: New files from gnulib
1af55d85d9762a679b4302d5995f05ccd883e956.
* lib/Makefile.am, m4/gnulib-cache.m4, m4/gnulib-comp.m4: Adjust.
* src/bin/ltlfilt.cc: Use error() and error_at_line().
This commit is contained in:
Alexandre Duret-Lutz 2012-08-31 15:28:58 +02:00
parent 8132f91867
commit 90279bd40c
13 changed files with 1043 additions and 25 deletions

28
m4/error.m4 Normal file
View file

@ -0,0 +1,28 @@
#serial 14
# Copyright (C) 1996-1998, 2001-2004, 2009-2012 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.
AC_DEFUN([gl_ERROR],
[
dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer
dnl maintained in Autoconf and because it invokes AC_LIBOBJ.
AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <error.h>]],
[[error_at_line (0, 0, "", 0, "an error occurred");]])],
[ac_cv_lib_error_at_line=yes],
[ac_cv_lib_error_at_line=no])])
])
# Prerequisites of lib/error.c.
AC_DEFUN([gl_PREREQ_ERROR],
[
AC_REQUIRE([AC_FUNC_STRERROR_R])
AC_REQUIRE([AC_C_INLINE])
:
])

View file

@ -27,12 +27,13 @@
# Specification in the form of a command-line invocation:
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=tools --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp progname
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=tools --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argp error progname
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
gl_MODULES([
argp
error
progname
])
gl_AVOID([])

View file

@ -45,6 +45,7 @@ AC_DEFUN([gl_EARLY],
# Code from module dosname:
# Code from module double-slash-root:
# Code from module errno:
# Code from module error:
# Code from module extensions:
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
# Code from module float:
@ -57,6 +58,8 @@ AC_DEFUN([gl_EARLY],
# Code from module malloc-posix:
# Code from module memchr:
# Code from module mempcpy:
# Code from module msvc-inval:
# Code from module msvc-nothrow:
# Code from module multiarch:
# Code from module nocrash:
# Code from module progname:
@ -116,6 +119,14 @@ AC_DEFUN([gl_INIT],
gl_DIRNAME_LGPL
gl_DOUBLE_SLASH_ROOT
gl_HEADER_ERRNO_H
gl_ERROR
if test $ac_cv_lib_error_at_line = no; then
AC_LIBOBJ([error])
gl_PREREQ_ERROR
fi
m4_ifdef([AM_XGETTEXT_OPTION],
[AM_][XGETTEXT_OPTION([--flag=error:3:c-format])
AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
gl_FLOAT_H
if test $REPLACE_FLOAT_LDBL = 1; then
AC_LIBOBJ([float])
@ -166,6 +177,14 @@ AC_DEFUN([gl_INIT],
gl_PREREQ_MEMPCPY
fi
gl_STRING_MODULE_INDICATOR([mempcpy])
gl_MSVC_INVAL
if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
AC_LIBOBJ([msvc-inval])
fi
gl_MSVC_NOTHROW
if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
AC_LIBOBJ([msvc-nothrow])
fi
gl_MULTIARCH
AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>])
AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
@ -402,6 +421,8 @@ AC_DEFUN([gl_FILE_LIST], [
lib/dirname.h
lib/dosname.h
lib/errno.in.h
lib/error.c
lib/error.h
lib/float+.h
lib/float.c
lib/float.in.h
@ -416,6 +437,10 @@ AC_DEFUN([gl_FILE_LIST], [
lib/memchr.c
lib/memchr.valgrind
lib/mempcpy.c
lib/msvc-inval.c
lib/msvc-inval.h
lib/msvc-nothrow.c
lib/msvc-nothrow.h
lib/printf-args.c
lib/printf-args.h
lib/printf-parse.c
@ -459,6 +484,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/dirname.m4
m4/double-slash-root.m4
m4/errno_h.m4
m4/error.m4
m4/exponentd.m4
m4/extensions.m4
m4/float_h.m4
@ -473,6 +499,8 @@ AC_DEFUN([gl_FILE_LIST], [
m4/memchr.m4
m4/mempcpy.m4
m4/mmap-anon.m4
m4/msvc-inval.m4
m4/msvc-nothrow.m4
m4/multiarch.m4
m4/nocrash.m4
m4/off_t.m4

19
m4/msvc-inval.m4 Normal file
View file

@ -0,0 +1,19 @@
# msvc-inval.m4 serial 1
dnl Copyright (C) 2011-2012 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_MSVC_INVAL],
[
AC_CHECK_FUNCS_ONCE([_set_invalid_parameter_handler])
if test $ac_cv_func__set_invalid_parameter_handler = yes; then
HAVE_MSVC_INVALID_PARAMETER_HANDLER=1
AC_DEFINE([HAVE_MSVC_INVALID_PARAMETER_HANDLER], [1],
[Define to 1 on MSVC platforms that have the "invalid parameter handler"
concept.])
else
HAVE_MSVC_INVALID_PARAMETER_HANDLER=0
fi
AC_SUBST([HAVE_MSVC_INVALID_PARAMETER_HANDLER])
])

10
m4/msvc-nothrow.m4 Normal file
View file

@ -0,0 +1,10 @@
# msvc-nothrow.m4 serial 1
dnl Copyright (C) 2011-2012 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_MSVC_NOTHROW],
[
AC_REQUIRE([gl_MSVC_INVAL])
])