From patchwork Wed May 20 17:28:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 474589 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id F401014029E for ; Thu, 21 May 2015 03:28:32 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=qMAk2V+p; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=default; b=IpAVeKwxNFTXMoUr9We79V+3imslEZ seKOzvAqSZwLjpCkYe8DfJC0U2+ae1H2FtbeGJghrbqB1X4ZS6TFOi7G/9pWpTCf e8T1mMu1DeQsdKRAd9gom+KuVswDynpH4sxZOejhMtfy/kU4APiqK+lmaWAfZmU6 ldID7oHvYfDVE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=K4sWvGAkUuI3OwrMAsGO/gTGBoc=; b=qMAk 2V+peV/j3Z9wPrwPjnmYkYdvfWhuEBhBcY912PF1gnXibjiHN+ULVuqR2P08pLPE OpfshAUmx3SDSaUZOs6g/ab1rHbZStB7ChERghxK/WPiYOnupRy1qUFzwlBhLv42 qjLp9riibCkiJHnOiy22+HoKE85KySxny62jXj4= Received: (qmail 43799 invoked by alias); 20 May 2015 17:28:12 -0000 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 Received: (qmail 43767 invoked by uid 89); 20 May 2015 17:28:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 20 May 2015 17:28:11 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id EE8B82BB38A; Wed, 20 May 2015 17:28:09 +0000 (UTC) Received: from localhost (ovpn-116-129.ams2.redhat.com [10.36.116.129]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4KHS8Yv004078; Wed, 20 May 2015 13:28:09 -0400 Date: Wed, 20 May 2015 18:28:08 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [v3 patch] Fix some Filesystem TS operations Message-ID: <20150520172808.GL30202@redhat.com> References: <20150515183734.GU30202@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150515183734.GU30202@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) On 15/05/15 19:37 +0100, Jonathan Wakely wrote: >Testing revealed a few bugs in how I handled paths that don't exist. >The new __gnu_test::nonexistent_path() function is a bit hacky but >should be good enough for the testsuite. This makes it even hackier but avoids linker warnings for using the evil tempnam() function. I know it should use snprintf not sprintf, but that depends on _GLIBCXX_USE_C99 which may not be defined (because we incorrectly test for a C99 lib using -std=gnu++98, which I'm going to fix). commit fc7f3808e940243362d29acde4a09ae90aa0df81 Author: Jonathan Wakely Date: Wed May 20 18:17:56 2015 +0100 * testsuite/util/testsuite_fs.h (nonexistent_path): Don't use tempnam. diff --git a/libstdc++-v3/testsuite/util/testsuite_fs.h b/libstdc++-v3/testsuite/util/testsuite_fs.h index f404a7a..3873a60 100644 --- a/libstdc++-v3/testsuite/util/testsuite_fs.h +++ b/libstdc++-v3/testsuite/util/testsuite_fs.h @@ -26,10 +26,8 @@ #include #include #include -#if defined(_GNU_SOURCE) || _XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200112L -# include -# include -#endif +#include +#include namespace __gnu_test { @@ -84,12 +82,9 @@ namespace __gnu_test ::close(fd); p = tmp; #else - char* tmp = tempnam(".", "test."); - if (!tmp) - throw std::experimental::filesystem::filesystem_error("tempnam failed", - std::error_code(errno, std::generic_category())); - p = tmp; - ::free(tmp); + char buf[64]; + std::sprintf(buf, "test.%lu", (unsigned long)::getpid()); + p = buf; #endif return p; }