From patchwork Mon Dec 21 13:40:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1419037 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=GuuPFjvo; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D00wZ0JxPz9sVS for ; Tue, 22 Dec 2020 00:40:44 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EC517384A40A; Mon, 21 Dec 2020 13:40:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by sourceware.org (Postfix) with ESMTPS id 55C6D3857815 for ; Mon, 21 Dec 2020 13:40:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 55C6D3857815 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qk1-x733.google.com with SMTP id c7so8744181qke.1 for ; Mon, 21 Dec 2020 05:40:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=081WqPaGAbRLVzqRv7du+jxmsYP8OFfQwCo2i7ophs4=; b=GuuPFjvoo1fQ6DvWLelnIcNZVve3DhFvVaVs+4KlvCKB/2nezLkyV7YD4cddSb5pqU 0/raP758POlIbhWv7MjjWU8EHJNjJCXX3o2GwnoBowcigyZpMgQjR9fpwgduLpjgVabT btETfs2ZaFpE8PgxIoijx5wmgSz9Ha85rtvehPP9G2IJEJIvk8RYng/i211EJzMMSB+8 OnJrndir6U2GXHL9esfSVmAi9KB75oK7Ze9gOeSalJHeEtqPYZ0imMhqyMROay1x2ICl wDRIJY9+LhOLiEhX+BUPULsnEkfDx9jKRqhgxtTfQ8HSwq1b0kQ8O8P4iE2KYU9FPjVs zMZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=081WqPaGAbRLVzqRv7du+jxmsYP8OFfQwCo2i7ophs4=; b=gVb19b4OgXREmCAUBuzImYxr+kqxv3+DlVtsn/evnFjwbMv0iOxlniAVjpTH8fwPtb khn3qdwk4Y3hFoAsz1N2qXY+Ic387r9UcFSapHC3yF2qhESlRHZVk0oxh5c4itnwXzhB 5Cc9qGs4bjcPtHGt1dk2c/KaW9h7uc6hnZ3AixPJ0jpyMFzNeZZojHY2dZHiqY9Qooy3 0hkWWodBh3nDHISTjwzlGCPTWV9qrnFBYnpcdZYEHDrhrFv7kgAYlUSbkk+GsSacesKC o49LhZqCz8SeUpbbrh2QDUctwHjGNjj2GvroPvI+NKb4NLqLT7uIbDHm4Bc/h5B1U1qG vlvQ== X-Gm-Message-State: AOAM532kR/rhEtJ0SeypztaB2lyihtBS5REQkTWoH3pg7V6jXmKaP3Hi 7ZZHDoOmd0MOfnhZiUU1K6s= X-Google-Smtp-Source: ABdhPJxYHub3GYqVOFjLdfJMnH9WXOXxgDG+2lVhdi4YNFn7G3+CoC1fbKQU4oMel1wOiw0FWQBb7g== X-Received: by 2002:a05:620a:22ab:: with SMTP id p11mr17135049qkh.237.1608558031716; Mon, 21 Dec 2020 05:40:31 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:1102:a009:4dd8:8bc:293? ([2620:10d:c091:480::1:35c6]) by smtp.googlemail.com with ESMTPSA id z26sm10355926qki.40.2020.12.21.05.40.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Dec 2020 05:40:30 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: libcody: to_string is not always available [PR 98412] Message-ID: <8f141e32-62eb-4c06-9d43-9882db4757ee@acm.org> Date: Mon, 21 Dec 2020 08:40:29 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" to_string is not always available, so don't use it. libcody/ * buffer.cc (MessageBuffer::AppendInteger): Workaround to_string's non-ubiquity. diff --git i/libcody/buffer.cc w/libcody/buffer.cc index 3256c37399b..85c066fef71 100644 --- i/libcody/buffer.cc +++ w/libcody/buffer.cc @@ -146,7 +146,13 @@ void MessageBuffer::Append (char c) void MessageBuffer::AppendInteger (unsigned u) { - std::string v (std::to_string (u)); + // Sigh, even though std::to_string is C++11, we support building on + // gcc 4.8, which is a C++11 compiler lacking std::to_string. so + // have something horrible. + std::string v (20, 0); + size_t len = snprintf (const_cast (v.data ()), v.size (), "%u", u); + v.erase (len); + AppendWord (v); }