aboutsummaryrefslogtreecommitdiff
path: root/sim/common/hw-handles.c
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2019-03-28 06:40:30 +0900
committerStafford Horne <shorne@gmail.com>2019-03-28 06:40:30 +0900
commitb6061d4d383b08966d16a0b0f72c69f35fc4beb9 (patch)
treebbd1767c1d65b7702ae7f2ac5cf1a28437890749 /sim/common/hw-handles.c
parentef9866970ce6683d40465fb7c3168f87a1dcd1b7 (diff)
downloadbinutils-b6061d4d383b08966d16a0b0f72c69f35fc4beb9.zip
binutils-b6061d4d383b08966d16a0b0f72c69f35fc4beb9.tar.gz
binutils-b6061d4d383b08966d16a0b0f72c69f35fc4beb9.tar.bz2
sim/common: Fix warnings: "warning: implicit declaration of function..."
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 <stdio.h>. * sim-watch.c: Include "config.h". Include <stdio.h>. * hw-device.c: Include <string.h>. * hw-events.c: Include <string.h>. * hw-handles.c: Include <stdlib.h>. * sim-fpu.c: Include <stdlib.h>.
Diffstat (limited to 'sim/common/hw-handles.c')
-rw-r--r--sim/common/hw-handles.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sim/common/hw-handles.c b/sim/common/hw-handles.c
index 2848b9b..d056562 100644
--- a/sim/common/hw-handles.c
+++ b/sim/common/hw-handles.c
@@ -23,6 +23,9 @@
#include "hw-main.h"
#include "hw-base.h"
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
struct hw_handle_mapping
{