From patchwork Thu Aug 25 15:07:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 14932 Received: (qmail 36939 invoked by alias); 25 Aug 2016 15:07:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 36929 invoked by uid 89); 25 Aug 2016 15:07:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=readers, Hx-languages-length:3375 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Aug 2016 15:07:30 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7PF4KtY133195 for ; Thu, 25 Aug 2016 11:07:29 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 250w84a3da-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 25 Aug 2016 11:07:28 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Aug 2016 16:07:26 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 25 Aug 2016 16:07:25 +0100 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: uweigand@de.ibm.com X-IBM-RcptTo: gdb-patches@sourceware.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id EA6222190023 for ; Thu, 25 Aug 2016 16:06:47 +0100 (BST) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7PF7OSh25231768 for ; Thu, 25 Aug 2016 15:07:24 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u7PE7Qu6000910 for ; Thu, 25 Aug 2016 08:07:26 -0600 Received: from oc7340732750.ibm.com (icon-9-164-148-136.megacenter.de.ibm.com [9.164.148.136]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u7PE7QDq000897 for ; Thu, 25 Aug 2016 08:07:26 -0600 Received: by oc7340732750.ibm.com (Postfix, from userid 500) id 3D7F6C9FB; Thu, 25 Aug 2016 17:07:23 +0200 (CEST) Subject: [6/9] Remove TYPE_NOSIGN "char" hack To: gdb-patches@sourceware.org Date: Thu, 25 Aug 2016 17:07:23 +0200 (CEST) From: "Ulrich Weigand" MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16082515-0040-0000-0000-000002C5C1BC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16082515-0041-0000-0000-00001CB4F514 Message-Id: <20160825150723.3D7F6C9FB@oc7340732750.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-25_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608250181 Hello, init_type (and arch_integer_type) currently use a special hack to set the TYPE_NOSIGN flag if the type name is exactly "char". This patch moves the hack up to the callers of those routines. The special case currently can hit only for types created from dwarf2read, but read_base_type actually implements the "char" check itself, so it is redundant to do it in init_type as well. (Note that stabsread.c and the other type readers always pass NULL as name to init_type, so the special case can never hit for those.) A few other cases create pre-definded types with a hard-coded name of "char"; the patch simply moves setting the TYPE_NOSIGN flag to those places. No functional change intended. Bye, Ulrich ChangeLog: * gdbtypes.c (init_type): Remove "char" special case. (arch_integer_type): Likewise. (gdbtypes_post_init): Set TYPE_NOSIGN for "char" type. (objfile_type): Likewise. * mdebugread.c (basic_type): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. Index: binutils-gdb/gdb/gdbtypes.c =================================================================== --- binutils-gdb.orig/gdb/gdbtypes.c 2016-08-25 13:11:50.006839555 +0200 +++ binutils-gdb/gdb/gdbtypes.c 2016-08-25 13:11:50.766842886 +0200 @@ -2748,11 +2748,6 @@ init_type (struct objfile *objfile, enum TYPE_LENGTH (type) = length; TYPE_NAME (type) = name; - /* C++ fancies. */ - - if (name && strcmp (name, "char") == 0) - TYPE_NOSIGN (type) = 1; - return type; } @@ -4780,8 +4775,6 @@ arch_integer_type (struct gdbarch *gdbar t = arch_type (gdbarch, TYPE_CODE_INT, bit / TARGET_CHAR_BIT, name); if (unsigned_p) TYPE_UNSIGNED (t) = 1; - if (name && strcmp (name, "char") == 0) - TYPE_NOSIGN (t) = 1; return t; } @@ -5046,6 +5039,7 @@ gdbtypes_post_init (struct gdbarch *gdba builtin_type->builtin_char = arch_integer_type (gdbarch, TARGET_CHAR_BIT, !gdbarch_char_signed (gdbarch), "char"); + TYPE_NOSIGN (builtin_type->builtin_char) = 1; builtin_type->builtin_signed_char = arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0, "signed char"); @@ -5193,6 +5187,7 @@ objfile_type (struct objfile *objfile) objfile_type->builtin_char = init_integer_type (objfile, TARGET_CHAR_BIT, !gdbarch_char_signed (gdbarch), "char"); + TYPE_NOSIGN (objfile_type->builtin_char) = 1; objfile_type->builtin_signed_char = init_integer_type (objfile, TARGET_CHAR_BIT, 0, "signed char"); Index: binutils-gdb/gdb/mdebugread.c =================================================================== --- binutils-gdb.orig/gdb/mdebugread.c 2016-08-25 13:11:49.274836346 +0200 +++ binutils-gdb/gdb/mdebugread.c 2016-08-25 13:11:50.768842894 +0200 @@ -1408,6 +1408,7 @@ basic_type (int bt, struct objfile *objf case btChar: tp = init_integer_type (objfile, 8, 0, "char"); + TYPE_NOSIGN (tp) = 1; break; case btUChar: Index: binutils-gdb/gdb/stabsread.c =================================================================== --- binutils-gdb.orig/gdb/stabsread.c 2016-08-25 13:11:49.280836372 +0200 +++ binutils-gdb/gdb/stabsread.c 2016-08-25 13:11:50.770842904 +0200 @@ -2102,6 +2102,7 @@ rs6000_builtin_type (int typenum, struct break; case 2: rettype = init_integer_type (objfile, 8, 0, "char"); + TYPE_NOSIGN (rettype) = 1; break; case 3: rettype = init_integer_type (objfile, 16, 0, "short");