Will C++ proponents spend 20 minutes to try what they're proposing?
John Gilmore
gnu@toad.com
Wed Apr 18 19:18:00 GMT 2012
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*âÂÂ
More information about the Gdb
mailing list