From: Thiago Jung Bauermann <bauerman@br.ibm.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 1/2] Recognize DFP types in casts.
Date: Thu, 20 Dec 2007 16:48:00 -0000 [thread overview]
Message-ID: <1198168849.28757.4.camel@localhost.localdomain> (raw)
In-Reply-To: <20071220140840.GC7244@caradoc.them.org>
[-- Attachment #1: Type: text/plain, Size: 808 bytes --]
On Thu, 2007-12-20 at 09:08 -0500, Daniel Jacobowitz wrote:
> On Thu, Dec 20, 2007 at 03:49:27AM -0200, Thiago Jung Bauermann wrote:
> > This should logically be part of the next patch, but the C parser is
> > scary code and I don't feel very confident that this is indeed the
> > right way to do it. It works, though, and introduces no regressions.
>
> Do you need parser changes for this? "unsigned" is a C keyword, and a
> bit special (e.g. in combinations with "int"); but doesn't _Decimal32
> act syntactically like a TYPENAME?
>
> Try following language_lookup_primitive_type_by_name around to
> c_language_arch_info (and cplus_language_arch_info).
Thanks for the tip. The below implements this approach and works well.
--
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center
[-- Attachment #2: decimal-cast-support-alt.diff --]
[-- Type: text/x-patch, Size: 3573 bytes --]
2007-12-20 Thiago Jung Bauermann <bauerman@br.ibm.com>
* c-exp.y: Add DECFLOAT_KEYWORD, DECDOUBLE_KEYWORD and DECLONG_KEYWORD
for Decimal Floating Point types.
Add typebase rule for DECFLOAT_KEYWORD, DECDOUBLE_KEYWORD and
DECLONG_KEYWORD.
(yylex): Recognize _Decimal32, _Decimal64 and _Decimal128 keywords.
* gdbtypes.c (gdbtypes_post_init): Change names of decimal float types
to conform to C extension for decimal float.
* c-lang.c (enum c_primitive_types): Add entries for Decimal Floating
Point types.
(enum cplus_primitive_types): Likewise.
(c_language_arch_info): Add Decimal Floating Point builtin types to
the primitive_type_vector.
(cplus_language_arch_info): Likewise.
Index: src-git/gdb/gdbtypes.c
===================================================================
--- src-git.orig/gdb/gdbtypes.c 2007-12-19 16:23:29.000000000 -0200
+++ src-git/gdb/gdbtypes.c 2007-12-19 16:24:01.000000000 -0200
@@ -3122,15 +3122,15 @@ gdbtypes_post_init (struct gdbarch *gdba
builtin_type->builtin_decfloat
= init_type (TYPE_CODE_DECFLOAT, 32 / 8,
0,
- "decimal float", (struct objfile *) NULL);
+ "_Decimal32", (struct objfile *) NULL);
builtin_type->builtin_decdouble
= init_type (TYPE_CODE_DECFLOAT, 64 / 8,
0,
- "decimal double", (struct objfile *) NULL);
+ "_Decimal64", (struct objfile *) NULL);
builtin_type->builtin_declong
= init_type (TYPE_CODE_DECFLOAT, 128 / 8,
0,
- "decimal long double", (struct objfile *) NULL);
+ "_Decimal128", (struct objfile *) NULL);
/* Pointer/Address types. */
Index: src-git/gdb/c-lang.c
===================================================================
--- src-git.orig/gdb/c-lang.c 2007-12-20 14:14:49.000000000 -0200
+++ src-git/gdb/c-lang.c 2007-12-20 14:18:28.000000000 -0200
@@ -358,6 +358,9 @@ enum c_primitive_types {
c_primitive_type_long_double,
c_primitive_type_complex,
c_primitive_type_double_complex,
+ c_primitive_type_decfloat,
+ c_primitive_type_decdouble,
+ c_primitive_type_declong,
nr_c_primitive_types
};
@@ -387,6 +390,9 @@ c_language_arch_info (struct gdbarch *gd
lai->primitive_type_vector [c_primitive_type_long_double] = builtin->builtin_long_double;
lai->primitive_type_vector [c_primitive_type_complex] = builtin->builtin_complex;
lai->primitive_type_vector [c_primitive_type_double_complex] = builtin->builtin_double_complex;
+ lai->primitive_type_vector [c_primitive_type_decfloat] = builtin->builtin_decfloat;
+ lai->primitive_type_vector [c_primitive_type_decdouble] = builtin->builtin_decdouble;
+ lai->primitive_type_vector [c_primitive_type_declong] = builtin->builtin_declong;
}
const struct language_defn c_language_defn =
@@ -442,6 +448,9 @@ enum cplus_primitive_types {
cplus_primitive_type_complex,
cplus_primitive_type_double_complex,
cplus_primitive_type_bool,
+ cplus_primitive_type_decfloat,
+ cplus_primitive_type_decdouble,
+ cplus_primitive_type_declong,
nr_cplus_primitive_types
};
@@ -490,6 +499,12 @@ cplus_language_arch_info (struct gdbarch
= builtin->builtin_double_complex;
lai->primitive_type_vector [cplus_primitive_type_bool]
= builtin->builtin_bool;
+ lai->primitive_type_vector [cplus_primitive_type_decfloat]
+ = builtin->builtin_decfloat;
+ lai->primitive_type_vector [cplus_primitive_type_decdouble]
+ = builtin->builtin_decdouble;
+ lai->primitive_type_vector [cplus_primitive_type_declong]
+ = builtin->builtin_declong;
}
const struct language_defn cplus_language_defn =
next prev parent reply other threads:[~2007-12-20 16:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-20 5:55 [patch 0/2] Complete expression support for Decimal Floating Point Thiago Jung Bauermann
2007-12-20 5:55 ` [patch 1/2] Recognize DFP types in casts Thiago Jung Bauermann
2007-12-20 15:24 ` Daniel Jacobowitz
2007-12-20 16:48 ` Thiago Jung Bauermann [this message]
2007-12-20 16:54 ` Thiago Jung Bauermann
2007-12-20 16:57 ` Daniel Jacobowitz
2007-12-20 17:21 ` Thiago Jung Bauermann
2007-12-20 8:03 ` [patch 2/2] Wrap-up expression support for DFP Thiago Jung Bauermann
2007-12-21 16:12 ` Eli Zaretskii
2007-12-21 16:30 ` Andreas Schwab
2007-12-21 16:38 ` Eli Zaretskii
2007-12-27 7:40 ` Thiago Jung Bauermann
2007-12-29 11:21 ` Eli Zaretskii
2008-01-02 20:07 ` Thiago Jung Bauermann
2008-01-05 11:30 ` Eli Zaretskii
2008-01-07 16:20 ` Thiago Jung Bauermann
2008-01-07 17:09 ` Thiago Jung Bauermann
2008-01-07 21:09 ` Eli Zaretskii
2008-01-07 22:39 ` Thiago Jung Bauermann
2007-12-28 6:16 ` Thiago Jung Bauermann
2007-12-29 12:53 ` Eli Zaretskii
2008-01-02 16:42 ` Thiago Jung Bauermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1198168849.28757.4.camel@localhost.localdomain \
--to=bauerman@br.ibm.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox