Commit ad414290 by Phil Edwards

configure.in: Test for libintl.h.

2003-04-28  Phil Edwards  <pme@gcc.gnu.org>

	* configure.in:  Test for libintl.h.
	* include/bits/c++config:  Define __N for everybody.
	* include/bits/basic_string.h, include/bits/stl_bvector.h,
	include/bits/stl_deque.h, include/bits/stl_vector.h,
	include/std/std_bitset.h:  Wrap all __throw* text with __N.
	* po/Makefile.am (pot):  New rule, mostly working.
	* src/functexcept.cc:  Call gettext on all __throw* arguments when
	-fexceptions is in effect.
	* po/Makefile.in, config.h.in, configure:  Regenerate.

From-SVN: r66185
parent e83a44d2
2003-04-28 Phil Edwards <pme@gcc.gnu.org>
* configure.in: Test for libintl.h.
* include/bits/c++config: Define __N for everybody.
* include/bits/basic_string.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_vector.h,
include/std/std_bitset.h: Wrap all __throw* text with __N.
* po/Makefile.am (pot): New rule, mostly working.
* src/functexcept.cc: Call gettext on all __throw* arguments when
-fexceptions is in effect.
* po/Makefile.in, config.h.in, configure: Regenerate.
2003-04-28 Petur Runolfsson <peturr02@ru.is>
PR libstdc++/9523
......
......@@ -731,6 +731,9 @@
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
......
......@@ -401,7 +401,7 @@ else
# Check for available headers.
AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h \
sys/types.h])
sys/types.h libintl.h])
GLIBCPP_CHECK_COMPILER_FEATURES
GLIBCPP_CHECK_LINKER_FEATURES
......
......@@ -275,7 +275,7 @@ namespace std
_M_check(size_type __pos) const
{
if (__pos > this->size())
__throw_out_of_range("basic_string::_M_check");
__throw_out_of_range(__N("basic_string::_M_check"));
return _M_ibegin() + __pos;
}
......@@ -447,7 +447,7 @@ namespace std
at(size_type __n) const
{
if (__n >= this->size())
__throw_out_of_range("basic_string::at");
__throw_out_of_range(__N("basic_string::at"));
return _M_data()[__n];
}
......@@ -455,7 +455,7 @@ namespace std
at(size_type __n)
{
if (__n >= size())
__throw_out_of_range("basic_string::at");
__throw_out_of_range(__N("basic_string::at"));
_M_leak();
return _M_data()[__n];
}
......@@ -818,7 +818,7 @@ namespace std
substr(size_type __pos = 0, size_type __n = npos) const
{
if (__pos > this->size())
__throw_out_of_range("basic_string::substr");
__throw_out_of_range(__N("basic_string::substr"));
return basic_string(*this, __pos, __n);
}
......
......@@ -97,4 +97,10 @@
# define _GLIBCPP_FAST_MATH 0
#endif
// This marks string literals in header files to be extracted for eventual
// translation. It is primarily used for messages in thrown exceptions; see
// src/functexcept.cc. We use __N because the more traditional _N is used
// for something else under certain OSes (see BADNAMES).
#define __N(msgid) (msgid)
// End of prewritten config; the discovered settings follow.
......@@ -480,7 +480,7 @@ template <typename _Alloc>
void _M_range_check(size_type __n) const {
if (__n >= this->size())
__throw_out_of_range("vector<bool>");
__throw_out_of_range(__N("vector<bool>"));
}
reference at(size_type __n)
......@@ -607,7 +607,7 @@ template <typename _Alloc>
void reserve(size_type __n) {
if (__n > this->max_size())
__throw_length_error("vector::reserve");
__throw_length_error(__N("vector::reserve"));
if (this->capacity() < __n) {
_Bit_type * __q = _M_bit_alloc(__n);
this->_M_finish = copy(begin(), end(), iterator(__q, 0));
......
......@@ -940,7 +940,7 @@ namespace std
_M_range_check(size_type __n) const
{
if (__n >= this->size())
__throw_out_of_range("deque [] access out of range");
__throw_out_of_range(__N("std::deque [] access out of range"));
}
public:
......
......@@ -524,7 +524,7 @@ namespace std
_M_range_check(size_type __n) const
{
if (__n >= this->size())
__throw_out_of_range("vector [] access out of range");
__throw_out_of_range(__N("std::vector [] access out of range"));
}
public:
......
......@@ -264,7 +264,7 @@ namespace std
{
for (size_t __i = 1; __i < _Nw; ++__i)
if (_M_w[__i])
__throw_overflow_error("bitset -- too large to fit in unsigned long");
__throw_overflow_error(__N("bitset value is too large to fit in unsigned long"));
return _M_w[0];
}
......@@ -466,7 +466,7 @@ namespace std
// localized to this single should-never-get-this-far function.
_WordT&
_M_getword(size_t) const
{ __throw_out_of_range("bitset -- zero-length"); return *new _WordT; }
{ __throw_out_of_range(__N("bitset is zero-length")); return *new _WordT; }
_WordT
_M_hiword() const { return 0; }
......@@ -862,7 +862,7 @@ namespace std
set(size_t __pos, bool __val = true)
{
if (__pos >= _Nb)
__throw_out_of_range("bitset -- set() argument too large");
__throw_out_of_range(__N("bitset::set() argument too large"));
return _Unchecked_set(__pos, __val);
}
......@@ -887,7 +887,7 @@ namespace std
reset(size_t __pos)
{
if (__pos >= _Nb)
__throw_out_of_range("bitset -- reset() argument too large");
__throw_out_of_range(__N("bitset::reset() argument too large"));
return _Unchecked_reset(__pos);
}
......@@ -911,7 +911,7 @@ namespace std
flip(size_t __pos)
{
if (__pos >= _Nb)
__throw_out_of_range("bitset -- flip() argument too large");
__throw_out_of_range(__N("bitset::flip() argument too large"));
return _Unchecked_flip(__pos);
}
......@@ -1014,7 +1014,7 @@ namespace std
test(size_t __pos) const
{
if (__pos >= _Nb)
__throw_out_of_range("bitset -- test() argument too large");
__throw_out_of_range(__N("bitset::test() argument too large"));
return _Unchecked_test(__pos);
}
......
......@@ -22,6 +22,7 @@
## USA.
PACKAGE = @PACKAGE@
glibcpp_srcdir = @glibcpp_srcdir@
# Location of installation directories.
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
......@@ -77,5 +78,13 @@ install-data-local-yes: all-local-yes
$(INSTALL_DATA) $$cat $$install_dir/$(PACKAGE).mo; \
done
# Maintainence of the .po template file. This rule is never run automatically,
# and updates the source directory.
pot:
cd $(glibcpp_srcdir); \
xgettext --default-domain=$(PACKAGE) --add-comments --c++ --debug \
--join-existing -o po/$(PACKAGE).pot --keyword=__N \
`grep -r -l '__N(".*")' .`
# Specify what gets cleaned up on a 'make clean'
CLEANFILES = $(LOCALE_OUT)
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
......@@ -133,7 +133,6 @@ glibcpp_basedir = @glibcpp_basedir@
glibcpp_builddir = @glibcpp_builddir@
glibcpp_localedir = @glibcpp_localedir@
glibcpp_prefixdir = @glibcpp_prefixdir@
glibcpp_srcdir = @glibcpp_srcdir@
glibcpp_thread_h = @glibcpp_thread_h@
glibcpp_toolexecdir = @glibcpp_toolexecdir@
glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
......@@ -144,6 +143,7 @@ libtool_VERSION = @libtool_VERSION@
toplevel_srcdir = @toplevel_srcdir@
PACKAGE = @PACKAGE@
glibcpp_srcdir = @glibcpp_srcdir@
# Location of installation directories.
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
......@@ -159,9 +159,7 @@ LOCALE_OUT = @glibcpp_MOFILES@
MSGFMT = msgfmt
# Necessary files.
DISTFILES = \
Makefile.am Makefile.in string_literals.cc POTFILES.in $(PACKAGE).pot \
$(LOCALE_IN)
DISTFILES = Makefile.am Makefile.in string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
# Specify what gets cleaned up on a 'make clean'
......@@ -176,15 +174,15 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
TAR = gtar
TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
.SUFFIXES: .mo .po
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --cygnus po/Makefile
cd $(top_srcdir) && $(AUTOMAKE) --gnu po/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
......@@ -197,8 +195,13 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = po
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu po/Makefile
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
......@@ -211,12 +214,10 @@ info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am:
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-info-am:
install-info: install-info-am
install-exec-am:
install-exec: install-exec-am
......@@ -265,12 +266,11 @@ maintainer-clean-am: maintainer-clean-generic distclean-am
maintainer-clean: maintainer-clean-am
.PHONY: tags distdir info-am info dvi-am dvi check check-am \
installcheck-am installcheck install-info-am install-info \
install-exec-am install-exec install-data-local install-data-am \
install-data install-am install uninstall-am uninstall all-local \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
installcheck-am installcheck install-exec-am install-exec \
install-data-local install-data-am install-data install-am install \
uninstall-am uninstall all-local all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
.po.mo:
......@@ -309,6 +309,14 @@ install-data-local-yes: all-local-yes
$(INSTALL_DATA) $$cat $$install_dir/$(PACKAGE).mo; \
done
# Maintainence of the .po template file. This rule is never run automatically,
# and updates the source directory.
pot:
cd $(glibcpp_srcdir); \
xgettext --default-domain=$(PACKAGE) --add-comments --c++ --debug \
--join-existing -o po/$(PACKAGE).pot --keyword=__N \
`grep -r -l '__N(".*")' .`
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -32,6 +32,12 @@
#include <new>
#include <typeinfo>
#include <ios>
#ifdef _GLIBCPP_HAVE_LIBINTL_H
# include <libintl.h>
# define _(msgid) gettext (msgid)
#else
# define _(msgid) (msgid)
#endif
namespace std
{
......@@ -54,43 +60,43 @@ namespace std
void
__throw_logic_error(const char* __s)
{ throw logic_error(__s); }
{ throw logic_error(_(__s)); }
void
__throw_domain_error(const char* __s)
{ throw domain_error(__s); }
{ throw domain_error(_(__s)); }
void
__throw_invalid_argument(const char* __s)
{ throw invalid_argument(__s); }
{ throw invalid_argument(_(__s)); }
void
__throw_length_error(const char* __s)
{ throw length_error(__s); }
{ throw length_error(_(__s)); }
void
__throw_out_of_range(const char* __s)
{ throw out_of_range(__s); }
{ throw out_of_range(_(__s)); }
void
__throw_runtime_error(const char* __s)
{ throw runtime_error(__s); }
{ throw runtime_error(_(__s)); }
void
__throw_range_error(const char* __s)
{ throw range_error(__s); }
{ throw range_error(_(__s)); }
void
__throw_overflow_error(const char* __s)
{ throw overflow_error(__s); }
{ throw overflow_error(_(__s)); }
void
__throw_underflow_error(const char* __s)
{ throw underflow_error(__s); }
{ throw underflow_error(_(__s)); }
void
__throw_ios_failure(const char* __s)
{ throw ios_base::failure(__s); }
{ throw ios_base::failure(_(__s)); }
#else
void
__throw_bad_exception(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment