From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24096 invoked by alias); 31 Aug 2008 17:52:29 -0000 Received: (qmail 23498 invoked by uid 22791); 31 Aug 2008 17:52:23 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate7.de.ibm.com (HELO mtagate7.de.ibm.com) (195.212.29.156) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 31 Aug 2008 17:51:38 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate7.de.ibm.com (8.13.8/8.13.8) with ESMTP id m7VHpYwj230382 for ; Sun, 31 Aug 2008 17:51:34 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m7VHpZtl3100762 for ; Sun, 31 Aug 2008 19:51:35 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m7VHpVhW020183 for ; Sun, 31 Aug 2008 19:51:31 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m7VHpVGa020177 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 31 Aug 2008 19:51:31 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (localhost.localdomain [127.0.0.1]) by tuxmaker.boeblingen.de.ibm.com (8.13.8/8.13.8) with ESMTP id m7VHpVpX002852 for ; Sun, 31 Aug 2008 19:51:31 +0200 Received: (from uweigand@localhost) by tuxmaker.boeblingen.de.ibm.com (8.13.8/8.13.8/Submit) id m7VHpVQd002851 for gdb-patches@sourceware.org; Sun, 31 Aug 2008 19:51:31 +0200 Message-Id: <20080831175131.295615000@de.ibm.com> References: <20080831175045.128504000@de.ibm.com> User-Agent: quilt/0.46-1 Date: Sun, 31 Aug 2008 17:53:00 -0000 From: uweigand@de.ibm.com To: gdb-patches@sourceware.org Subject: [rfc][22/37] Eliminate builtin_type_ macros: Platform-neutral "true char" types Content-Disposition: inline; filename=diff-type-truechar Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-08/txt/msg00704.txt.bz2 Hello, similarly to the preceding builtin_type_void patch, this patch converts builtin_type_true_char and builtin_type_true_unsigned_char into global platform-neutral variables. These types are only used for GDB-internal platform-neutral purposes. Bye, Ulrich ChangeLog: * gdbtypes.h (struct builtin_type): Remove builtin_true_char and builtin_true_unsigned_char. (builtin_type_true_char): Remove macro, add extern declaration. (builtin_type_true_unsigned_char): Add extern declaration. * gdbtypes.c (builtin_type_true_char): New global variable. (builtin_type_true_unsigned_char): Likewise. (_initialize_gdbtypes): Initialize them. (gdbtypes_post_init): Do not initialize builtin_true_char and builtin_true_unsigned_char members of struct builtin_type. * printcmd.c (print_scalar_formatted): Do not use builtin_type; use builtin_type_true_unsigned_char instead. * ada-valprint.c (ada_val_print_1): Use builtin_type_true_char instead of builtin_type_char for internal string. Index: gdb-head/gdb/gdbtypes.c =================================================================== --- gdb-head.orig/gdb/gdbtypes.c +++ gdb-head/gdb/gdbtypes.c @@ -111,6 +111,10 @@ struct type *builtin_type_ia64_quad; /* Platform-neutral void type. */ struct type *builtin_type_void; +/* Platform-neutral character types. */ +struct type *builtin_type_true_char; +struct type *builtin_type_true_unsigned_char; + int opaque_type_resolution = 1; static void @@ -3109,14 +3113,6 @@ gdbtypes_post_init (struct gdbarch *gdba (TYPE_FLAG_NOSIGN | (gdbarch_char_signed (gdbarch) ? 0 : TYPE_FLAG_UNSIGNED)), "char", (struct objfile *) NULL); - builtin_type->builtin_true_char = - init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, - 0, - "true character", (struct objfile *) NULL); - builtin_type->builtin_true_unsigned_char = - init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "true character", (struct objfile *) NULL); builtin_type->builtin_signed_char = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, 0, @@ -3337,6 +3333,14 @@ _initialize_gdbtypes (void) init_type (TYPE_CODE_VOID, 1, 0, "void", (struct objfile *) NULL); + builtin_type_true_char = + init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, + 0, + "true character", (struct objfile *) NULL); + builtin_type_true_unsigned_char = + init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, + "true character", (struct objfile *) NULL); add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\ Set debugging of C++ overloading."), _("\ Index: gdb-head/gdb/gdbtypes.h =================================================================== --- gdb-head.orig/gdb/gdbtypes.h +++ gdb-head/gdb/gdbtypes.h @@ -977,12 +977,6 @@ struct builtin_type /* Integral types. */ - /* We use these for the '/c' print format, because c_char is just a - one-byte integral type, which languages less laid back than C - will print as ... well, a one-byte integral type. */ - struct type *builtin_true_char; - struct type *builtin_true_unsigned_char; - /* Implicit size/sign (based on the the architecture's ABI). */ struct type *builtin_void; struct type *builtin_char; @@ -1018,8 +1012,6 @@ extern const struct builtin_type *builti (builtin_type (current_gdbarch)->builtin_func_ptr) #define builtin_type_CORE_ADDR \ (builtin_type (current_gdbarch)->builtin_core_addr) -#define builtin_type_true_char \ - (builtin_type (current_gdbarch)->builtin_true_char) #define builtin_type_char \ (builtin_type (current_gdbarch)->builtin_char) #define builtin_type_short \ @@ -1099,6 +1091,14 @@ extern struct type *builtin_type_ia64_qu You must use builtin_type (...)->builtin_void in those cases. */ extern struct type *builtin_type_void; +/* Platform-neutral character types. + We use these for the '/c' print format, because c_char is just a + one-byte integral type, which languages less laid back than C + will print as ... well, a one-byte integral type. */ +extern struct type *builtin_type_true_char; +extern struct type *builtin_type_true_unsigned_char; + + /* This type represents a type that was unrecognized in symbol read-in. */ extern struct type *builtin_type_error; Index: gdb-head/gdb/printcmd.c =================================================================== --- gdb-head.orig/gdb/printcmd.c +++ gdb-head/gdb/printcmd.c @@ -425,13 +425,9 @@ print_scalar_formatted (const void *vala case 'c': if (TYPE_UNSIGNED (type)) - { - struct type *utype; - - utype = builtin_type (current_gdbarch)->builtin_true_unsigned_char; - value_print (value_from_longest (utype, val_long), - stream, 0, Val_pretty_default); - } + value_print (value_from_longest (builtin_type_true_unsigned_char, + val_long), + stream, 0, Val_pretty_default); else value_print (value_from_longest (builtin_type_true_char, val_long), stream, 0, Val_pretty_default); Index: gdb-head/gdb/ada-valprint.c =================================================================== --- gdb-head.orig/gdb/ada-valprint.c +++ gdb-head/gdb/ada-valprint.c @@ -752,7 +752,7 @@ ada_val_print_1 (struct type *type, cons parray_of_char = make_pointer_type (create_array_type - (NULL, builtin_type_char, + (NULL, builtin_type_true_char, create_range_type (NULL, builtin_type_int, 0, 32)), NULL); printable_val = -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com