From b6061d4d383b08966d16a0b0f72c69f35fc4beb9 Mon Sep 17 00:00:00 2001 From: Stafford Horne Date: Thu, 28 Mar 2019 06:40:30 +0900 Subject: sim/common: Fix warnings: "warning: implicit declaration of function..." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During building of several cgen simulator's I notices the below warnings. Adding includes fixes these. Including config.h allows stdio.h to properly configure itself to expose asprintf(). The other warnings for abort, free, memset, strlen are trivial. Warnings: ../../../binutils-gdb/sim/or1k/../common/sim-watch.c: In function ‘sim_watchpoint_install’: ../../../binutils-gdb/sim/or1k/../common/sim-watch.c:415:10: warning: implicit declaration of function ‘asprintf’; did you mean ‘vasprintf’? [-Wimplicit-function-declaration] if (asprintf (&name, "watch-%s-%s", ^~~~~~~~ vasprintf ../../../binutils-gdb/sim/lm32/../common/hw-device.c: In function ‘hw_strdup’: ../../../binutils-gdb/sim/lm32/../common/hw-device.c:59:34: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration] char *dup = hw_zalloc (me, strlen (str) + 1); ^~~~~~ ../../../binutils-gdb/sim/lm32/../common/hw-events.c: In function ‘hw_event_queue_schedule’: ../../../binutils-gdb/sim/lm32/../common/hw-events.c:92:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration] memset (&dummy, 0, sizeof dummy); ^~~~~~ ../../../binutils-gdb/sim/lm32/../common/hw-handles.c: In function ‘hw_handle_remove_ihandle’: ../../../binutils-gdb/sim/lm32/../common/hw-handles.c:211:4: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration] free (delete); ^~~~ ../../../binutils-gdb/sim/lm32/../common/sim-fpu.c: In function ‘pack_fpu’: ../../../binutils-gdb/sim/lm32/../common/sim-fpu.c:292:7: warning: implicit declaration of function ‘abort’ [-Wimplicit-function-declaration] abort (); ^~~~~ sim/common/ChangeLog: * sim-options.c: Include "config.h". Include . * sim-watch.c: Include "config.h". Include . * hw-device.c: Include . * hw-events.c: Include . * hw-handles.c: Include . * sim-fpu.c: Include . --- sim/common/hw-device.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sim/common/hw-device.c') diff --git a/sim/common/hw-device.c b/sim/common/hw-device.c index ee1bfad..458ee22 100644 --- a/sim/common/hw-device.c +++ b/sim/common/hw-device.c @@ -27,6 +27,10 @@ #include #endif +#if HAVE_STRING_H +#include +#endif + /* Address methods */ const hw_unit * -- cgit v1.1