This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch 2/4] decimal floating point types


On Thu, Sep 20, 2007 at 06:54:12PM -0300, Thiago Jung Bauermann wrote:
> +    case DW_ATE_decimal_float:
> +      if (size == 16)
> +	{
> +	  type = dwarf2_fundamental_type (objfile, FT_DBL_PREC_DECFLOAT, cu);
> +	}
> +      else if (size == 8)
> +	{
> +	  type = dwarf2_fundamental_type (objfile, FT_EXT_PREC_DECFLOAT, cu);
> +	}
> +      else
> +	type = dwarf2_fundamental_type (objfile, FT_DECFLOAT, cu);
> +      return type;

You don't need a bunch of those extra braces.

> +  /* The following three are about decimal floating point types, which
> +     are 32-bits, 64-bits and 128-bits respectively.  */
> +  builtin_type->builtin_decfloat =
> +    init_type (TYPE_CODE_DECFLOAT, 32 / 8,
> +	        0,
> +	       "decimal float", (struct objfile *) NULL);

I think our convention is to put the equals sign after the line break.

>  void
> +print_decimal_floating (const gdb_byte *valaddr, struct type *type,
> +			struct ui_file *stream)
> +{
> +  char decstr[128];
> +  unsigned len = TYPE_LENGTH (type);
> +
> +  decimal_to_string (valaddr, len, decstr);
> +  fputs_filtered (decstr, stream);
> +  return;
> +}

Does the libdecnumber API specify that 128 bytes is enough?  If so
this should be a constant in dfp.h.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]