Re: [RFA-v3] Allow explicit 16 or 32 char in 'x /s'

Tom Tromey
2010-07-02T19:09:11Z

>>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:

Ulrich> This test required that malloc is present in the inferior; if target
Ulrich> code is statically linked, we need to make sure the routine gets
Ulrich> pulled in (just like other testcases already do).

Ulrich> * gdb.base/charset.c (main): Make sure malloc gets linked in.

With this patch I now get:

Running ../../../src/gdb/testsuite/gdb.base/charset.exp ...
gdb compile failed, ../../../src/gdb/testsuite/gdb.base/charset.c: In function ‘main’:
../../../src/gdb/testsuite/gdb.base/charset.c:126: warning: incompatible implicit declaration of built-in function ‘malloc’

It isn't safe here to include <stdlib.h>, since this test intentionally
defines its own "wchar_t".

Adding:

extern void *malloc (int);

works for me, but it seems possibly problematic.

Maybe adding -fno-builtin for gcc is the thing to do?

I am not really sure what is best. Any other ideas?

Tom