From patchwork Sun Sep 9 23:09:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 182734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 769A32C0087 for ; Mon, 10 Sep 2012 09:09:32 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1347836973; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=kBv+XTtERQbwVCN62Pkr1z7G5Nk=; b=gAv8ljnmLpnmtrY n87JUwsQBtDVhySr7ajRO+JX3eTyzvYJqMxMJLWYwe1pNrGCU3BuVNnn8cjZtXnQ cl6YKRR3MIbEgO9GMdNXnFyoXN/3B4G+o4/bQQ2J5fi2wMcXtEmC8Po923ecNIw5 dS02FzUOt/rOJgzdb2kD8GO5jZb4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=xTmp5RKiE+CeivtlYqQKVN4SqDMbvp2DgEVWBYRWofT+qTIV3kstmJKLEf2B68 TxKpjfdYXfVDiz72x83UwODNcCmGgWE91yNON3IHIqd7dCWM6jXSPV8bddBoYkwB u2EfFF/Z47x1cqOASn8WnHNy3yYrcCcLm52lFwz5n96Qg=; Received: (qmail 6064 invoked by alias); 9 Sep 2012 23:09:25 -0000 Received: (qmail 6040 invoked by uid 22791); 9 Sep 2012 23:09:23 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_CX, TW_DC X-Spam-Check-By: sourceware.org Received: from mail-ie0-f175.google.com (HELO mail-ie0-f175.google.com) (209.85.223.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 09 Sep 2012 23:09:06 +0000 Received: by iebc11 with SMTP id c11so2201300ieb.20 for ; Sun, 09 Sep 2012 16:09:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.191.165 with SMTP id gz5mr8545872igc.50.1347232146142; Sun, 09 Sep 2012 16:09:06 -0700 (PDT) Received: by 10.42.49.81 with HTTP; Sun, 9 Sep 2012 16:09:06 -0700 (PDT) In-Reply-To: References: Date: Mon, 10 Sep 2012 00:09:06 +0100 Message-ID: Subject: Re: PR 43852: new configure option --disable-libstdcxx-verbose From: Jonathan Wakely To: "libstdc++" , gcc-patches Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 27 August 2012 18:15, Jonathan Wakely wrote: > Unless anyone has objections I'm going to commit this to trunk, > implementing Sebastian's idea to disable the verbose terminate handler > and the "pure virtual function called" message, which write to stderr > when a process terminates. This allows embedded systems to avoid > pulling in the demangler and I/O code, reducing the footprint of > libstdc++. > > 2012-08-27 Sebastian Huber > Jonathan Wakely > > * acinclude.m4 (GLIBCXX_ENABLE_VERBOSE): Define. > * configure.ac (GLIBCXX_ENABLE_VERBOSE): Use it. > * config.h.in: Regenerate. > * configure: Likewise. > * libsupc++/eh_term_handler.cc (_GLIBCXX_VERBOSE): Check new macro. > * libsupc++/pure.cc (_GLIBCXX_VERBOSE): Likewise. > * doc/xml/manual/configure.xml (--disable-libstdcxx-verbose): Document. > * doc/html/manual/configure.html: Regenerate. > > Tested on x86_64-linux. I've committed this to trunk now. commit 80c2524507ac793cf601934345a6183baf63a5d6 Author: Jonathan Wakely Date: Sun Aug 26 15:45:08 2012 +0100 2012-08-27 Sebastian Huber Jonathan Wakely * acinclude.m4 (GLIBCXX_ENABLE_VERBOSE): Define. * configure.ac (GLIBCXX_ENABLE_VERBOSE): Use it. * config.h.in: Regenerate. * configure: Likewise. * libsupc++/eh_term_handler.cc (_GLIBCXX_VERBOSE): Check new macro. * libsupc++/pure.cc (_GLIBCXX_VERBOSE): Likewise. * doc/xml/manual/configure.xml (--disable-libstdcxx-verbose): Document. * doc/html/manual/configure.html: Regenerate. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 1179407..48d932c 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -2317,6 +2317,31 @@ AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [ dnl +dnl Check if the user wants a non-verbose library implementation. +dnl +dnl --disable-libstdcxx-verbose will turn off descriptive messages to +dnl standard error on termination. +dnl +dnl Defines: +dnl _GLIBCXX_VERBOSE (always defined, either to 1 or 0) +dnl +AC_DEFUN([GLIBCXX_ENABLE_VERBOSE], [ + AC_ARG_ENABLE([libstdcxx-verbose], + AC_HELP_STRING([--disable-libstdcxx-verbose], + [disable termination messages to standard error]),, + [enable_libstdcxx_verbose=yes]) + if test x"$enable_libstdcxx_verbose" = xyes; then + verbose_define=1 + else + AC_MSG_NOTICE([verbose termination messages are disabled]) + verbose_define=0 + fi + AC_DEFINE_UNQUOTED(_GLIBCXX_VERBOSE, $verbose_define, + [Define to 1 if a verbose library is built, or 0 otherwise.]) +]) + + +dnl dnl Check for template specializations for the 'long long' type. dnl The result determines only whether 'long long' I/O is enabled; things dnl like numeric_limits<> specializations are always available. diff --git a/libstdc++-v3/libsupc++/eh_term_handler.cc b/libstdc++-v3/libsupc++/eh_term_handler.cc index 52a0745..f4bf2a3 100644 --- a/libstdc++-v3/libsupc++/eh_term_handler.cc +++ b/libstdc++-v3/libsupc++/eh_term_handler.cc @@ -1,5 +1,5 @@ // -*- C++ -*- std::terminate handler -// Copyright (C) 2002, 2003, 2009 Free Software Foundation +// Copyright (C) 2002-2012 Free Software Foundation // // This file is part of GCC. // @@ -28,19 +28,17 @@ /* We default to the talkative, informative handler in a normal hosted library. This pulls in the demangler, the dyn-string utilities, and elements of the I/O library. For a low-memory environment, you can return - to the earlier "silent death" handler by including , initializing - to "std::abort", and rebuilding the library. In a freestanding mode, we - default to this latter approach. */ - -#if ! _GLIBCXX_HOSTED -# include -#endif + to the earlier "silent death" handler by configuring GCC with + --disable-libstdcxx-verbose and rebuilding the library. + In a freestanding environment, we default to this latter approach. */ +#if _GLIBCXX_HOSTED && _GLIBCXX_VERBOSE /* The current installed user handler. */ std::terminate_handler __cxxabiv1::__terminate_handler = -#if _GLIBCXX_HOSTED __gnu_cxx::__verbose_terminate_handler; #else - std::abort; +# include +/* The current installed user handler. */ +std::terminate_handler __cxxabiv1::__terminate_handler = std::abort; #endif diff --git a/libstdc++-v3/libsupc++/pure.cc b/libstdc++-v3/libsupc++/pure.cc index 4879e59..a774597 100644 --- a/libstdc++-v3/libsupc++/pure.cc +++ b/libstdc++-v3/libsupc++/pure.cc @@ -1,5 +1,5 @@ // -*- C++ -*- -// Copyright (C) 2000, 2001, 2009, 2011 Free Software Foundation +// Copyright (C) 2000-2012 Free Software Foundation // // This file is part of GCC. // @@ -26,7 +26,7 @@ #include #include "unwind-cxx.h" -#if _GLIBCXX_HOSTED +#if _GLIBCXX_HOSTED && _GLIBCXX_VERBOSE #ifdef _GLIBCXX_HAVE_UNISTD_H # include # define writestr(str) write(2, str, sizeof(str) - 1) diff --git a/libstdc++-v3/doc/xml/manual/configure.xml b/libstdc++-v3/doc/xml/manual/configure.xml index 83443ef..bc98d7a 100644 --- a/libstdc++-v3/doc/xml/manual/configure.xml +++ b/libstdc++-v3/doc/xml/manual/configure.xml @@ -370,6 +370,19 @@ +--disable-libstdcxx-verbose + + + By default, the library is configured to write descriptive messages + to standard error for certain events such as calling a pure virtual + function or the invocation of the standard terminate handler. Those + messages cause the library to depend on the demangler and standard I/O + facilites, which might be undesirable in a low-memory environment or + when standard error is not available. This option disables those + messages. This option does not change the library ABI. + + +