This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/testsuite] cvexpr.c: data pointers vs function pointers
- From: mec dot gnu at mindspring dot com (Michael Elizabeth Chastain)
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 7 Jan 2004 03:30:51 -0500 (EST)
- Subject: [patch/testsuite] cvexpr.c: data pointers vs function pointers
This match fixes cvexpr.c so that it respects the difference
between function pointers and data pointers. I need this
for hp-ux 11 ansi c.
The problem:
void use (void *) { ; }
int (*fp)(int);
use (fp);
The solution:
void use (void *) { ; }
int (*fp)(int);
use (&fp);
This is simpler than writing a bunch of "void use_fpii_(int(*)(int))"
functions.
Tested on:
native i686-pc-linux-gnu, gcc 2.95.3 3.3.2 HEAD, dwarf-2 stabs+
native hppa2.0w-hp-hpux11.11, hp ansi c
I am committing this as obvious.
Michael C
2004-01-06 Michael Chastain <mec.gnu@mindspring.com>
* gdb.base/cvexpr.c: Be type-safe with function pointers and
data pointers.
Index: gdb.base/cvexpr.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/cvexpr.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 cvexpr.c
*** gdb.base/cvexpr.c 18 Apr 2002 13:21:03 -0000 1.2
--- gdb.base/cvexpr.c 7 Jan 2004 02:13:53 -0000
***************
*** 1,4 ****
! /* Copyright (C) 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 1,4 ----
! /* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*************** int main ()
*** 409,434 ****
use (&v_boolean2);
use (&v_misordered);
! use (v_char_func);
! use (v_signed_char_func);
! use (v_unsigned_char_func);
!
! use (v_short_func);
! use (v_signed_short_func);
! use (v_unsigned_short_func);
!
! use (v_int_func);
! use (v_signed_int_func);
! use (v_unsigned_int_func);
!
! use (v_long_func);
! use (v_signed_long_func);
! use (v_unsigned_long_func);
!
! use (v_long_long_func);
! use (v_signed_long_long_func);
! use (v_unsigned_long_long_func);
! use (v_float_func);
! use (v_double_func);
}
--- 409,434 ----
use (&v_boolean2);
use (&v_misordered);
! use (&v_char_func);
! use (&v_signed_char_func);
! use (&v_unsigned_char_func);
!
! use (&v_short_func);
! use (&v_signed_short_func);
! use (&v_unsigned_short_func);
!
! use (&v_int_func);
! use (&v_signed_int_func);
! use (&v_unsigned_int_func);
!
! use (&v_long_func);
! use (&v_signed_long_func);
! use (&v_unsigned_long_func);
!
! use (&v_long_long_func);
! use (&v_signed_long_long_func);
! use (&v_unsigned_long_long_func);
! use (&v_float_func);
! use (&v_double_func);
}