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] Remove C/C++ relevant code in Fortran specific file.


>>>>> "Christoph" == Christoph Weinmann <christoph.t.weinmann@intel.com> writes:

Christoph> Remove code relevant for printing C/C++ Integer values in a
Christoph> Fortran specific file to unify printing of Fortran values.

Looks good.  A question below, and a minor nit.

Christoph> --- a/gdb/f-valprint.c
Christoph> +++ b/gdb/f-valprint.c
Christoph> @@ -354,21 +354,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
Christoph>  				      original_value, options, 0, stream);
Christoph>  	}
Christoph>        else
Christoph> -	{
Christoph> -	  val_print_type_code_int (type, valaddr + embedded_offset, stream);
Christoph> -	  /* C and C++ has no single byte int type, char is used instead.
Christoph> -	     Since we don't know whether the value is really intended to
Christoph> -	     be used as an integer or a character, print the character
Christoph> -	     equivalent as well.  */
Christoph> -	  if (TYPE_LENGTH (type) == 1)
Christoph> -	    {
Christoph> -	      LONGEST c;
Christoph> -
Christoph> -	      fputs_filtered (" ", stream);
Christoph> -	      c = unpack_long (type, valaddr + embedded_offset);
Christoph> -	      LA_PRINT_CHAR ((unsigned char) c, type, stream);
Christoph> -	    }
Christoph> -	}
Christoph> +	val_print_type_code_int (type, valaddr + embedded_offset, stream);
Christoph>        break;
 
I wonder whether the whole "if" can be removed and simply call
val_print_scalar_formatted.

It's not that important, though.  This part is fine as-is.

Christoph> +# Check the printed output of small data types.
Christoph> +gdb_test "print oneByte" ".* = 1.*" "Print the value of a one byte sized Integer type."
Christoph> +
Christoph> +gdb_test "print twobytes" ".*2 = 2.*" "Print the value of a two bytes sized Integer type."
Christoph> +
Christoph> +gdb_test "print chvalue" ".*3 = \'a\'.*" "Print the value of a Character type."
Christoph> +
Christoph> +gdb_test "print logvalue" ".*4 = \.TRUE\..*" "Print the value of a Logical type."

These lines go over the line length limit and should be split.

The patch is ok with this fixed.

Tom


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