From patchwork Mon Apr 22 15:04:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 238564 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 859B62C00F2 for ; Tue, 23 Apr 2013 01:04:38 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=uQ7fm9hyNkHs41SQoXNzVr90ZmPcTAWufkKyfvmsg64 DcyjC8pXizumfVnlZW+0JNJqP2oa+utMasorNpvdywRg2E6XizZfjxudX4jEizw+ NxsLmosVVUwYwJvOrSr+2ViAeC3JPjoQrUQIsrurZbq3a/IqkfNnFyInCqFuzZBU = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=jGvNOuq8Cvu/VVm+Zlz8fNamwiM=; b=vf+BT9++Z5kagmGS8 HHUrqxzdMVck/gKnJDYCL/jQUM9OGbXi4h0YV5GMPFhAzANuJiVogD6XCrP2KVL7 GuIcBuVHTD8yiyWnjOVkgg80HWoPDiooh7kYe/duSr8Js9ehKL9rzf0trMWcUsZK vkLtp7qzBRLCtuFQiCg0Xf6LVQ= Received: (qmail 2857 invoked by alias); 22 Apr 2013 15:04:27 -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 2843 invoked by uid 89); 22 Apr 2013 15:04:27 -0000 X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 22 Apr 2013 15:04:26 +0000 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r3MF4L2q012049 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 22 Apr 2013 15:04:24 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3MF4K2F005496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 22 Apr 2013 15:04:21 GMT Received: from abhmt119.oracle.com (abhmt119.oracle.com [141.146.116.71]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3MF4KnT029271; Mon, 22 Apr 2013 15:04:20 GMT Received: from poldo4.casa (/79.52.233.36) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2013 08:04:19 -0700 Message-ID: <5175516B.8030302@oracle.com> Date: Mon, 22 Apr 2013 17:04:11 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: libstdc++ CC: "gcc-patches@gcc.gnu.org" Subject: [v3] Tidy std::is_signed X-Virus-Found: No Hi, the other day, while Daniel was discussing a simply wording issue, I noticed that our implementation is unnecessarily complicated. Tested x86_64-linux. Thanks, Paolo. ////////////////////////// 2013-04-22 Paolo Carlini * include/std/type_traits (is_signed): Simplify. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust dg-error line numbers. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/declval/requirements/1_neg.cc: Likewise. Index: include/std/type_traits =================================================================== --- include/std/type_traits (revision 198097) +++ include/std/type_traits (working copy) @@ -538,18 +538,13 @@ { }; template::value, - bool = is_floating_point<_Tp>::value> + bool = is_arithmetic<_Tp>::value> struct __is_signed_helper : public false_type { }; template - struct __is_signed_helper<_Tp, false, true> - : public true_type { }; - - template - struct __is_signed_helper<_Tp, true, false> - : public integral_constant(_Tp(-1) < _Tp(0))> + struct __is_signed_helper<_Tp, true> + : public integral_constant { }; /// is_signed Index: testsuite/20_util/make_signed/requirements/typedefs_neg.cc =================================================================== --- testsuite/20_util/make_signed/requirements/typedefs_neg.cc (revision 198008) +++ testsuite/20_util/make_signed/requirements/typedefs_neg.cc (working copy) @@ -48,5 +48,5 @@ // { dg-error "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1599 } -// { dg-error "declaration of" "" { target *-*-* } 1563 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1594 } +// { dg-error "declaration of" "" { target *-*-* } 1558 } Index: testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc =================================================================== --- testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc (revision 198008) +++ testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc (working copy) @@ -48,5 +48,5 @@ // { dg-error "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1517 } -// { dg-error "declaration of" "" { target *-*-* } 1481 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1512 } +// { dg-error "declaration of" "" { target *-*-* } 1476 } Index: testsuite/20_util/declval/requirements/1_neg.cc =================================================================== --- testsuite/20_util/declval/requirements/1_neg.cc (revision 198008) +++ testsuite/20_util/declval/requirements/1_neg.cc (working copy) @@ -19,7 +19,7 @@ // with this library; see the file COPYING3. If not see // . -// { dg-error "static assertion failed" "" { target *-*-* } 1857 } +// { dg-error "static assertion failed" "" { target *-*-* } 1852 } #include