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 v2] C++: dlsym casts in gdb/linux-thread-db.c and gdb/gdbserver/thread-db.c


Pedro Alves wrote:

> gdb/ChangeLog:
> 2015-08-03  Pedro Alves  <palves@redhat.com>
> 
> 	* nat/gdb_thread_db.h (td_init_ftype, td_ta_new_ftype)
> 	(td_ta_map_lwp2thr_ftype, td_ta_thr_iter_ftype)
> 	(td_ta_event_addr_ftype, td_ta_set_event_ftype)
> 	(td_ta_clear_event_ftype, td_ta_event_getmsg_ftype)
> 	(td_thr_validate_ftype, td_thr_get_info_ftype)
> 	(td_thr_event_enable_ftype, td_thr_tls_get_addr_ftype)
> 	(td_thr_tlsbase_ftype, td_symbol_list_ftype, td_ta_delete_ftype):
> 	New typedefs.

This breaks the build for me with:

In file included from /home/uweigand/dailybuild/spu-tc-2015-08-04/binutils-gdb-head/binutils-gdb/gdb/gdbserver/thread-db.c:31:                         
/home/uweigand/dailybuild/spu-tc-2015-08-04/binutils-gdb-head/binutils-gdb/gdb/gdbserver/../nat/gdb_thread_db.h:20: error: redefinition of typedef â??td_init_ftypeâ??                                                                                                                                            
/home/uweigand/dailybuild/spu-tc-2015-08-04/binutils-gdb-head/binutils-gdb/gdb/gdbserver/../nat/gdb_thread_db.h:20: error: previous declaration of â??td_init_ftypeâ?? was here                                                                                                                                   
/home/uweigand/dailybuild/spu-tc-2015-08-04/binutils-gdb-head/binutils-gdb/gdb/gdbserver/../nat/gdb_thread_db.h:23: error: redefinition of typedef â??td_ta_new_ftypeâ??                                                                                                                                          
/home/uweigand/dailybuild/spu-tc-2015-08-04/binutils-gdb-head/binutils-gdb/gdb/gdbserver/../nat/gdb_thread_db.h:23: error: previous declaration of â??td_ta_new_ftypeâ?? was here                                                                                                                                 
[... etc for each of the typedefs ...]

It seems this is caused by the nat/gdb_thread_db.h header file
being included twice into gdbserver/thread-db.c:

1) via line 23:
#include "linux-low.h"
(which includes "nat/gdb_thread_db.h" at line 20)

2) directly in line 30:
#include "nat/gdb_thread_db.h"

and the file not being guarded against double inclusion.

(I'm not 100% sure whether an identical second typedef is supposed
to be valid C or not, but at least my GCC 4.1 host compiler rejects
it in this case.)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


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