From patchwork Fri Nov 15 14:57:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 291594 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C241B2C00CC for ; Sat, 16 Nov 2013 01:59:17 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=c50qrJh4nG/hsk8w FhO6N9XbUG6lz06Bqv/gxMsr0A0e5nyN5/WYrLMf0qDHlEFIwJghDdWwvIpVbes1 VE9vi6n3A1b7f/6UHndumSvmA/x737rs7qScR3jn7JDqcb6oHjdORBnmeLlIsact 6PsnYlkofENycgkOD9iMBVzNFwI= 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:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=JRboQr4qYiOEehv4EFvk7F uH+38=; b=M85ZZsv/o4YJVmmuZVLk7rV8g0vCxV19FhmfMKclWlr37+0pUst0iZ 73Q16UGHU3gZLpq/Uzdr5nh73yqYUsOb0+c2wpu74kAspbawchcrd79d4l5i+Za/ xU4rC9opUt+ZBS92nLQjnyxRfoV+zoZ+PWHRevuBcaWY8aYS3RBvg= Received: (qmail 19484 invoked by alias); 15 Nov 2013 14:59:07 -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 19470 invoked by uid 89); 15 Nov 2013 14:59:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.3 required=5.0 tests=BAYES_50, FREEMAIL_FROM, RDNS_NONE, SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: e06smtp13.uk.ibm.com Received: from Unknown (HELO e06smtp13.uk.ibm.com) (195.75.94.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 15 Nov 2013 14:59:05 +0000 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 15 Nov 2013 14:58:56 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 15 Nov 2013 14:58:54 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8AE1017D8057 for ; Fri, 15 Nov 2013 14:58:35 +0000 (GMT) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rAFEvQMO64618600 for ; Fri, 15 Nov 2013 14:57:26 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rAFEvceS007864 for ; Fri, 15 Nov 2013 07:57:38 -0700 Received: from sandifor-thinkpad.stglab.manchester.uk.ibm.com (sig-9-145-171-28.de.ibm.com [9.145.171.28]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id rAFEvaJa007799 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 15 Nov 2013 07:57:37 -0700 From: Richard Sandiford To: Jeff Law Mail-Followup-To: Jeff Law , gcc-patches@gcc.gnu.org, rsandifo@linux.vnet.ibm.com Cc: gcc-patches@gcc.gnu.org Subject: Re: [c] Remove unnecessary host_integerp check References: <874n7er9sq.fsf@sandifor-thinkpad.stglab.manchester.uk.ibm.com> <528542A7.8010102@redhat.com> Date: Fri, 15 Nov 2013 14:57:35 +0000 In-Reply-To: <528542A7.8010102@redhat.com> (Jeff Law's message of "Thu, 14 Nov 2013 14:37:43 -0700") Message-ID: <87li0ppva8.fsf@sandifor-thinkpad.stglab.manchester.uk.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13111514-2966-0000-0000-00000960878F Jeff Law writes: > On 11/14/13 13:46, Richard Sandiford wrote: >> pp_c_character_constant only calls pp_p_char for values that fit into >> a HWI of the constant's signedness (i.e. an unsigned HWI if TYPE_UNSIGNED >> and a signed HWI otherwise). But pp_c_character_constant is only called by: >> >> case INTEGER_CST: >> { >> tree type = TREE_TYPE (e); >> ... >> else if (type == char_type_node) >> pp_c_character_constant (this, e); >> >> and in practice a character constant is always going to fit into a HWI. >> The current !host_integerp case simply truncates the constant to an >> unsigned int anyway. >> >> Maybe the type == wchar_type_node test is dead too, I'm not sure. >> I'm happy to remove it at the same time if that seems like the right >> thing to do. >> >> Tested on x86_64-linux-gnu. OK to install? >> >> Thanks, >> Richard >> >> >> gcc/c-family/ >> * c-pretty-print.c (pp_c_character_constant): Remove unnecessary >> host_integerp check. > Fine by me. Your call on the type == wchar_type_code. Thanks. In the end I decided to get rid of it too. Retested on x86_64-linux-gnu and committed. Richard gcc/c-family/ * c-pretty-print.c (pp_c_character_constant): Remove unnecessary wchar_type and host_integerp checks. Index: gcc/c-family/c-pretty-print.c =================================================================== --- gcc/c-family/c-pretty-print.c 2013-11-14 20:26:04.079815938 +0000 +++ gcc/c-family/c-pretty-print.c 2013-11-15 14:47:41.739324275 +0000 @@ -950,14 +950,8 @@ pp_c_integer_constant (c_pretty_printer static void pp_c_character_constant (c_pretty_printer *pp, tree c) { - tree type = TREE_TYPE (c); - if (type == wchar_type_node) - pp_character (pp, 'L'); pp_quote (pp); - if (host_integerp (c, TYPE_UNSIGNED (type))) - pp_c_char (pp, tree_low_cst (c, TYPE_UNSIGNED (type))); - else - pp_scalar (pp, "\\x%x", (unsigned) TREE_INT_CST_LOW (c)); + pp_c_char (pp, (unsigned) TREE_INT_CST_LOW (c)); pp_quote (pp); }