This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Will C++ proponents spend 20 minutes to try what they're proposing?
- From: John Gilmore <gnu at toad dot com>
- To: gdb at sourceware dot org, Jan Kratochvil <jan dot kratochvil at redhat dot com>, gnu at toad dot com
- Date: Wed, 18 Apr 2012 12:18:21 -0700
- Subject: Will C++ proponents spend 20 minutes to try what they're proposing?
Jan Kratochvil said:
> I can't believe we do not agree on such basic way forward.
Changing the implementation language of a huge program, more than
twenty years after its creation, is not "basic".
Has any of the proponents even *tried* to compile and run today's GDB
using a C++ compiler, to see what C constructs that it currently uses
will be rejected by the C++ compiler? "./configure CC=g++; make check", or
something similar, should do most of that for you.
Recompiling the C code in C++ is the approach you're proposing to
take, right? Or do you propose that we compile some source files with
a C compiler and others with a C++ compiler?
If it will compile easily with a C++ compiler, then you could start
migrating small bits of it here and there to C++. If it won't compile
easily, then there's a more substantial hurdle to cross before even a
line of new C++ code could be written. Ideally if we were going to
switch to C++, we'd migrate the current code base so that it would
compile with either C or C++. Then and only then would we commit
ourselves by writing new C++ code, knowing that we still have a
working debugger.
When I configure gdb-7.4 with C++ and make it, it fails pretty early
here in libiberty:
./cplus-dem.c: In function â??void demangle_arm_hp_template(work_stuff*, const char**, int, string*)â??:
./cplus-dem.c:2351:46: error: invalid conversion from â??const char*â?? to â??char*â??
(I'm amused that the C++ demangler is the first C function to fail.)
I've appended a bunch of other errors that turn up from "make -i".
There are MANY more, and I didn't scan beyond the "f"s in BFD. (The
GDB source files themselves also get a ton of errors). Yes, I realize
many of these are simple fixes. Perhaps a proponent should make these
fixes. Some of them bother me, e.g. "deprecated string constant
conversion to char *". C code regularly uses strings with char *'s.
Is this a foolish hobgoblin of const-correctness?
PS: When did g++ start outputting non-ascii (Unicode) backquotes
and forward-quotes in its error messages? That's truly ugly. Look
at the compiler output in Emacs, for example.
John
./md5.c: In function â??void* md5_finish_ctx(md5_ctx*, void*)â??:
./md5.c:117:43: warning: dereferencing type-punned pointer will break strict-aliasing rules
./md5.c:118:47: warning: dereferencing type-punned pointer will break strict-aliasing rules
./alloca.c: In function â??void* C_alloca(size_t)â??:
./alloca.c:164:3: warning: â??autoâ?? will change meaning in C++0x; please remove it
./floatformat.c:22:0: warning: "_GNU_SOURCE" redefined
<command-line>:0:0: note: this is the location of the previous definition
./stack-limit.c:52:27: warning: use of C++0x long long integer constant
./stack-limit.c:54:28: warning: use of C++0x long long integer constant
./stack-limit.c:57:28: warning: use of C++0x long long integer constant
In file included from archive.c:131:0:
bfd.h:6246:31: error: â??bfd_boolean bfd_section_already_linked(bfd*, asection*, bfd_link_info*)â?? hides constructor for â??struct bfd_section_already_linkedâ??
In file included from archive.c:132:0:
./../include/libiberty.h:110:36: error: new declaration â??char* basename(const char*)â??
/usr/include/string.h:603:28: error: ambiguates old declaration â??const char* basename(const char*)â??
archive.c: In function â??bfd_boolean _bfd_write_archive_contents(bfd*)â??:
archive.c:2115:11: error: deprecated conversion from string constant to â??char*â??
archive.c:2117:13: error: deprecated conversion from string constant to â??char*â??
In file included from bfd.c:319:0:
cache.c: In function â??void* cache_bmmap(bfd*, void*, bfd_size_type, int, int, file_ptr, void**, bfd_size_type*)â??:
cache.c:440:27: error: pointer of type â??void *â?? used in arithmetic
srec.c:1324:1: error: deprecated conversion from string constant to â??char*â??
srec.c:1380:1: error: deprecated conversion from string constant to â??char*â??
binary.c: In function â??char* mangle_name(bfd*, char*)â??:
binary.c:135:12: error: deprecated conversion from string constant to â??char*â??
binary.c: In function â??long int binary_canonicalize_symtab(bfd*, asymbol**)â??:
binary.c:163:44: error: deprecated conversion from string constant to â??char*â??
binary.c:171:42: error: deprecated conversion from string constant to â??char*â??
binary.c:179:43: error: deprecated conversion from string constant to â??char*â??
binary.c: At global scope:
binary.c:369:1: error: deprecated conversion from string constant to â??char*â??
tekhex.c:1016:1: error: deprecated conversion from string constant to â??char*â??
./dwarf2.c: In function â??int compare_sequences(const void*, const void*)â??:
./dwarf2.c:1299:38: error: invalid conversion from â??const void*â?? to â??const line_sequence*â??
./dwarf2.c:1300:38: error: invalid conversion from â??const void*â?? to â??const line_sequence*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c:185:1: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c: In function â??bfd_boolean elf_i386_grok_prstatus(bfd*, Elf_Internal_Note*)â??:
elf32-i386.c:454:36: error: deprecated conversion from string constant to â??char*â??
elf32-i386.c: In function â??bfd_boolean elf_i386_create_dynamic_sections(bfd*, bfd_link_info*)â??:
elf32-i386.c:1030:47: error: invalid conversion from â??void*â?? to â??unsigned char*â??
In file included from elf32-i386.c:4989:0:
elf32-target.h: At global scope:
elf32-target.h:987:1: error: deprecated conversion from string constant to â??char*â??
In file included from elf32-i386.c:5022:0:
elf32-target.h:987:1: error: deprecated conversion from string constant to â??char*â??
In file included from elf32-i386.c:5050:0:
elf32-target.h:987:1: error: deprecated conversion from string constant to â??char*â??
In file included from elf32-i386.c:5214:0:
elf32-target.h:987:1: error: deprecated conversion from string constant to â??char*â??
In file included from elf32-i386.c:5259:0:
elf32-target.h:987:1: error: deprecated conversion from string constant to â??char*â??