From patchwork Thu Aug 25 15:07:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 14933 Received: (qmail 39472 invoked by alias); 25 Aug 2016 15:07:58 -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 39408 invoked by uid 89); 25 Aug 2016 15:07:58 -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=categories, cardinal 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:55 +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 u7PF4JCx133026 for ; Thu, 25 Aug 2016 11:07:53 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 250w84a4t9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 25 Aug 2016 11:07:53 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Aug 2016 16:07:48 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 25 Aug 2016 16:07:46 +0100 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: uweigand@de.ibm.com X-IBM-RcptTo: gdb-patches@sourceware.org Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id D64DD1B0806E for ; Thu, 25 Aug 2016 16:09:25 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7PF7jPY30539960 for ; Thu, 25 Aug 2016 15:07:45 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 u7PF7j9e023334 for ; Thu, 25 Aug 2016 09:07:45 -0600 Received: from oc7340732750.ibm.com (icon-9-164-148-136.megacenter.de.ibm.com [9.164.148.136]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u7PF7jmS023323 for ; Thu, 25 Aug 2016 09:07:45 -0600 Received: by oc7340732750.ibm.com (Postfix, from userid 500) id 93A05C9FB; Thu, 25 Aug 2016 17:07:44 +0200 (CEST) Subject: [7/9] Add missing format for built-in floating-point types To: gdb-patches@sourceware.org Date: Thu, 25 Aug 2016 17:07:44 +0200 (CEST) From: "Ulrich Weigand" MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16082515-0016-0000-0000-0000022538FD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16082515-0017-0000-0000-000022BF5ED3 Message-Id: <20160825150744.93A05C9FB@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, many callers of init_float_type and arch_float_type still pass a NULL floatformat. This patch changes those callers where the floatformat that is supposed to be use is obvious. There are two categories where this is the case: - A number of built-in types are intended to match the platform ABI floating-point types (i.e. types that use gdbarch_float_bit etc.). Those places should use the platform ABI floating-point formats defined via gdbarch_float_format etc. - A number of language built-in types should simply use IEEE floating- point formats, since the language actually defines that this is the format that must be used to implement floating-point types for this language. (This affects Java, Go, and Rust.) The same applies for to the predefined "RS/6000" stabs floating-point built-in types. Bye, Ulrich ChangeLog: * ada-lang.c (ada_language_arch_info): Use gdbarch-provided platform ABI floating-point formats for built-in types. * d-lang.c (build_d_types): Likewise. * f-lang.c (build_fortran_types): Likewise. * m2-lang.c (build_m2_types): Likewise. * mdebugread.c (basic_type): Likewise. * go-lang.c (build_go_types): Use IEEE floating-point formats for language built-in types as mandanted by the language. * jv-lang.c (build_java_types): Likewise. * rust-lang.c (rust_language_arch_info): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. Index: binutils-gdb/gdb/ada-lang.c =================================================================== --- binutils-gdb.orig/gdb/ada-lang.c 2016-08-25 13:11:47.068826679 +0200 +++ binutils-gdb/gdb/ada-lang.c 2016-08-25 13:11:51.591846503 +0200 @@ -14004,16 +14004,16 @@ ada_language_arch_info (struct gdbarch * = arch_character_type (gdbarch, TARGET_CHAR_BIT, 0, "character"); lai->primitive_type_vector [ada_primitive_type_float] = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), - "float", NULL); + "float", gdbarch_float_format (gdbarch)); lai->primitive_type_vector [ada_primitive_type_double] = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), - "long_float", NULL); + "long_float", gdbarch_double_format (gdbarch)); lai->primitive_type_vector [ada_primitive_type_long_long] = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), 0, "long_long_integer"); lai->primitive_type_vector [ada_primitive_type_long_double] = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), - "long_long_float", NULL); + "long_long_float", gdbarch_long_double_format (gdbarch)); lai->primitive_type_vector [ada_primitive_type_natural] = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "natural"); Index: binutils-gdb/gdb/d-lang.c =================================================================== --- binutils-gdb.orig/gdb/d-lang.c 2016-08-25 13:11:36.961782431 +0200 +++ binutils-gdb/gdb/d-lang.c 2016-08-25 13:11:51.595846522 +0200 @@ -287,13 +287,13 @@ build_d_types (struct gdbarch *gdbarch) = arch_integer_type (gdbarch, 128, 1, "ucent"); builtin_d_type->builtin_float = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), - "float", NULL); + "float", gdbarch_float_format (gdbarch)); builtin_d_type->builtin_double = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), - "double", NULL); + "double", gdbarch_double_format (gdbarch)); builtin_d_type->builtin_real = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), - "real", NULL); + "real", gdbarch_long_double_format (gdbarch)); TYPE_INSTANCE_FLAGS (builtin_d_type->builtin_byte) |= TYPE_INSTANCE_FLAG_NOTTEXT; @@ -303,13 +303,13 @@ build_d_types (struct gdbarch *gdbarch) /* Imaginary and complex types. */ builtin_d_type->builtin_ifloat = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), - "ifloat", NULL); + "ifloat", gdbarch_float_format (gdbarch)); builtin_d_type->builtin_idouble = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), - "idouble", NULL); + "idouble", gdbarch_double_format (gdbarch)); builtin_d_type->builtin_ireal = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), - "ireal", NULL); + "ireal", gdbarch_long_double_format (gdbarch)); builtin_d_type->builtin_cfloat = arch_complex_type (gdbarch, "cfloat", builtin_d_type->builtin_float); Index: binutils-gdb/gdb/f-lang.c =================================================================== --- binutils-gdb.orig/gdb/f-lang.c 2016-08-25 13:11:36.962782435 +0200 +++ binutils-gdb/gdb/f-lang.c 2016-08-25 13:11:51.598846534 +0200 @@ -332,13 +332,13 @@ build_fortran_types (struct gdbarch *gdb builtin_f_type->builtin_real = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), - "real", NULL); + "real", gdbarch_float_format (gdbarch)); builtin_f_type->builtin_real_s8 = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), - "real*8", NULL); + "real*8", gdbarch_double_format (gdbarch)); builtin_f_type->builtin_real_s16 = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), - "real*16", NULL); + "real*16", gdbarch_long_double_format (gdbarch)); builtin_f_type->builtin_complex_s8 = arch_complex_type (gdbarch, "complex*8", Index: binutils-gdb/gdb/go-lang.c =================================================================== --- binutils-gdb.orig/gdb/go-lang.c 2016-08-25 13:11:36.962782435 +0200 +++ binutils-gdb/gdb/go-lang.c 2016-08-25 13:11:51.602846551 +0200 @@ -648,9 +648,9 @@ build_go_types (struct gdbarch *gdbarch) builtin_go_type->builtin_uint64 = arch_integer_type (gdbarch, 64, 1, "uint64"); builtin_go_type->builtin_float32 - = arch_float_type (gdbarch, 32, "float32", NULL); + = arch_float_type (gdbarch, 32, "float32", floatformats_ieee_single); builtin_go_type->builtin_float64 - = arch_float_type (gdbarch, 64, "float64", NULL); + = arch_float_type (gdbarch, 64, "float64", floatformats_ieee_double); builtin_go_type->builtin_complex64 = arch_complex_type (gdbarch, "complex64", builtin_go_type->builtin_float32); Index: binutils-gdb/gdb/jv-lang.c =================================================================== --- binutils-gdb.orig/gdb/jv-lang.c 2016-08-25 13:11:36.962782435 +0200 +++ binutils-gdb/gdb/jv-lang.c 2016-08-25 13:11:51.606846569 +0200 @@ -1241,9 +1241,9 @@ build_java_types (struct gdbarch *gdbarc builtin_java_type->builtin_char = arch_character_type (gdbarch, 16, 1, "char"); builtin_java_type->builtin_float - = arch_float_type (gdbarch, 32, "float", NULL); + = arch_float_type (gdbarch, 32, "float", floatformats_ieee_single); builtin_java_type->builtin_double - = arch_float_type (gdbarch, 64, "double", NULL); + = arch_float_type (gdbarch, 64, "double", floatformats_ieee_double); builtin_java_type->builtin_void = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); Index: binutils-gdb/gdb/m2-lang.c =================================================================== --- binutils-gdb.orig/gdb/m2-lang.c 2016-08-25 13:11:36.962782435 +0200 +++ binutils-gdb/gdb/m2-lang.c 2016-08-25 13:11:51.610846587 +0200 @@ -413,7 +413,8 @@ build_m2_types (struct gdbarch *gdbarch) builtin_m2_type->builtin_card = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "CARDINAL"); builtin_m2_type->builtin_real - = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "REAL", NULL); + = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "REAL", + gdbarch_float_format (gdbarch)); builtin_m2_type->builtin_char = arch_character_type (gdbarch, TARGET_CHAR_BIT, 1, "CHAR"); builtin_m2_type->builtin_bool Index: binutils-gdb/gdb/rust-lang.c =================================================================== --- binutils-gdb.orig/gdb/rust-lang.c 2016-08-25 13:11:36.961782431 +0200 +++ binutils-gdb/gdb/rust-lang.c 2016-08-25 13:11:51.614846604 +0200 @@ -1128,8 +1128,10 @@ rust_language_arch_info (struct gdbarch types[rust_primitive_isize] = arch_integer_type (gdbarch, length, 0, "isize"); types[rust_primitive_usize] = arch_integer_type (gdbarch, length, 1, "usize"); - types[rust_primitive_f32] = arch_float_type (gdbarch, 32, "f32", NULL); - types[rust_primitive_f64] = arch_float_type (gdbarch, 64, "f64", NULL); + types[rust_primitive_f32] = arch_float_type (gdbarch, 32, "f32", + floatformats_ieee_single); + types[rust_primitive_f64] = arch_float_type (gdbarch, 64, "f64", + floatformats_ieee_double); types[rust_primitive_unit] = arch_integer_type (gdbarch, 0, 1, "()"); Index: binutils-gdb/gdb/mdebugread.c =================================================================== --- binutils-gdb.orig/gdb/mdebugread.c 2016-08-25 13:11:50.768842894 +0200 +++ binutils-gdb/gdb/mdebugread.c 2016-08-25 13:11:51.619846627 +0200 @@ -1441,12 +1441,12 @@ basic_type (int bt, struct objfile *objf case btFloat: tp = init_float_type (objfile, gdbarch_float_bit (gdbarch), - "float", NULL); + "float", gdbarch_float_format (gdbarch)); break; case btDouble: tp = init_float_type (objfile, gdbarch_double_bit (gdbarch), - "double", NULL); + "double", gdbarch_double_format (gdbarch)); break; case btComplex: Index: binutils-gdb/gdb/stabsread.c =================================================================== --- binutils-gdb.orig/gdb/stabsread.c 2016-08-25 13:11:50.770842904 +0200 +++ binutils-gdb/gdb/stabsread.c 2016-08-25 13:11:51.623846644 +0200 @@ -2133,17 +2133,20 @@ rs6000_builtin_type (int typenum, struct break; case 12: /* IEEE single precision (32 bit). */ - rettype = init_float_type (objfile, 32, "float", NULL); + rettype = init_float_type (objfile, 32, "float", + floatformats_ieee_single); break; case 13: /* IEEE double precision (64 bit). */ - rettype = init_float_type (objfile, 64, "double", NULL); + rettype = init_float_type (objfile, 64, "double", + floatformats_ieee_double); break; case 14: /* This is an IEEE double on the RS/6000, and different machines with different sizes for "long double" should use different negative type numbers. See stabs.texinfo. */ - rettype = init_float_type (objfile, 64, "long double", NULL); + rettype = init_float_type (objfile, 64, "long double", + floatformats_ieee_double); break; case 15: rettype = init_integer_type (objfile, 32, 0, "integer"); @@ -2152,10 +2155,12 @@ rs6000_builtin_type (int typenum, struct rettype = init_boolean_type (objfile, 32, 1, "boolean"); break; case 17: - rettype = init_float_type (objfile, 32, "short real", NULL); + rettype = init_float_type (objfile, 32, "short real", + floatformats_ieee_single); break; case 18: - rettype = init_float_type (objfile, 64, "real", NULL); + rettype = init_float_type (objfile, 64, "real", + floatformats_ieee_double); break; case 19: rettype = init_type (objfile, TYPE_CODE_ERROR, 0, "stringptr");