From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22645 invoked by alias); 3 Oct 2007 20:41:18 -0000 Received: (qmail 22637 invoked by uid 22791); 3 Oct 2007 20:41:17 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 03 Oct 2007 20:41:14 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 1917F98152 for ; Wed, 3 Oct 2007 20:41:12 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id ECA0B98100 for ; Wed, 3 Oct 2007 20:41:11 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1IdB1q-0007mr-S2 for gdb-patches@sourceware.org; Wed, 03 Oct 2007 16:41:10 -0400 Date: Wed, 03 Oct 2007 20:41:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: [commit] Avoid builtin_type_int during type construction Message-ID: <20071003204110.GA29601@caradoc.them.org> Mail-Followup-To: gdb-patches@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes 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: 2007-10/txt/msg00036.txt.bz2 I wanted to construct a new type during gdbarch initialization and ran into two problems caused by the use of builtin_type_int, which is now a macro referencing current_gdbarch. Every range type created uses builtin_type_int as the type of its fields (which hold the range's endpoints). There's an unclear FIXME here. The use of int isn't necessary; nothing ever looks at the types of these fields, and the comments in gdbtypes.h suggest that their types are unused. And every vector type is an array using int as its index type. Since vectors are small arrays of constant size, there's no worry about this type; int32 works just as well. Tested on x86_64-linux and committed. -- Daniel Jacobowitz CodeSourcery 2007-10-03 Daniel Jacobowitz * gdbtypes.c (create_range_type): Do not set TYPE_FIELD_TYPE for the bounds. (init_vector_type): Use builtin_type_int32. Index: gdbtypes.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtypes.c,v retrieving revision 1.134 diff -u -p -r1.134 gdbtypes.c --- gdbtypes.c 5 Sep 2007 00:51:48 -0000 1.134 +++ gdbtypes.c 3 Oct 2007 20:36:41 -0000 @@ -705,8 +705,6 @@ create_range_type (struct type *result_t memset (TYPE_FIELDS (result_type), 0, 2 * sizeof (struct field)); TYPE_FIELD_BITPOS (result_type, 0) = low_bound; TYPE_FIELD_BITPOS (result_type, 1) = high_bound; - TYPE_FIELD_TYPE (result_type, 0) = builtin_type_int; /* FIXME */ - TYPE_FIELD_TYPE (result_type, 1) = builtin_type_int; /* FIXME */ if (low_bound >= 0) TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED; @@ -950,7 +948,7 @@ init_vector_type (struct type *elt_type, array_type = create_array_type (0, elt_type, create_range_type (0, - builtin_type_int, + builtin_type_int32, 0, n-1)); make_vector_type (array_type); return array_type;