This is the mail archive of the gdb-patches@sources.redhat.com 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]

[RFA] Fix broken test in callfuncs.c



Hello, 

I just noticed that this test was broken by a change in mid-1999.
This test has always contained two versions of the function
't_float_values': one that is prototyped (ANSI-style) and one
that is not (K&R style).  This is because the K&R version involves
promotion of floats to doubles, and the ANSI version does not, 
and GDB sometimes has problems determining what to do.

The change in 1999 ANSI-fied all of the functions which 
defeated the purpose of having this specific function non-ANSIfied.
I want to revert just that part of the change.

Michael

2001-11-07  Michael Snyder  <msnyder@redhat.com>

	* gdb.base/callfuncs.c (t_float_values): This function must
	_not_ be prototyped, and the following function (t_float_values2)
	must be prototyped (if the compiler supports it), so that GDB
        can be tested against both cases.  Usually one case involves
        promotion of float to double, while the other does not.

Index: gdb.base/callfuncs.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfuncs.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 callfuncs.c
*** callfuncs.c	2000/11/06 20:38:02	1.2
--- callfuncs.c	2001/11/07 22:11:00
*************** long long_arg1, long_arg2;
*** 237,248 ****
    return ((long_arg1 == long_val1) && (long_arg2 == long_val2));
  }
  
! #ifdef PROTOTYPES
! int t_float_values (float float_arg1, float float_arg2)
! #else
  int t_float_values (float_arg1, float_arg2)
  float float_arg1, float_arg2;
- #endif
  {
    return ((float_arg1 - float_val1) < DELTA
  	  && (float_arg1 - float_val1) > -DELTA
--- 237,249 ----
    return ((long_arg1 == long_val1) && (long_arg2 == long_val2));
  }
  
! /* NOTE: THIS FUNCTION MUST NOT BE PROTOTYPED!!!!!
!    There must be one version of "t_float_values" (this one)
!    that is not prototyped, and one (if supported) that is (following).
!    That way GDB can be tested against both cases.  */
!    
  int t_float_values (float_arg1, float_arg2)
  float float_arg1, float_arg2;
  {
    return ((float_arg1 - float_val1) < DELTA
  	  && (float_arg1 - float_val1) > -DELTA
*************** float float_arg1, float_arg2;
*** 251,263 ****
  }
  
  int
! #ifdef PROTOTYPES
! t_float_values2 (float float_arg1, float float_arg2)
! #else
  /* In this case we are just duplicating t_float_values, but that is the
     easiest way to deal with either ANSI or non-ANSI.  */
  t_float_values2 (float_arg1, float_arg2)
       float float_arg1, float_arg2;
  #endif
  {
    return ((float_arg1 - float_val1) < DELTA
--- 252,264 ----
  }
  
  int
! #ifdef NO_PROTOTYPES
  /* In this case we are just duplicating t_float_values, but that is the
     easiest way to deal with either ANSI or non-ANSI.  */
  t_float_values2 (float_arg1, float_arg2)
       float float_arg1, float_arg2;
+ #else
+ t_float_values2 (float float_arg1, float float_arg2)
  #endif
  {
    return ((float_arg1 - float_val1) < DELTA


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