This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/3] include/dis-asm.h: Fix warning: Include "string.h" for strchr


I got this warning when building the OpenRISC sim target.

Warning:

In file included from ../../../binutils-gdb/sim/or1k/../common/cgen-trace.c:26:
../../../binutils-gdb/sim/or1k/../../include/dis-asm.h: In function ‘next_disassembler_option’:
../../../binutils-gdb/sim/or1k/../../include/dis-asm.h:343:21: warning: implicit declaration of function ‘strchr’ [-Wimplicit-function-declaration]
   const char *opt = strchr (options, ',');
                     ^~~~~~
../../../binutils-gdb/sim/or1k/../../include/dis-asm.h:343:21: warning: incompatible implicit declaration of built-in function ‘strchr’
../../../binutils-gdb/sim/or1k/../../include/dis-asm.h:343:21: note: include ‘<string.h>’ or provide a declaration of ‘strchr’
../../../binutils-gdb/sim/or1k/../../include/dis-asm.h:40:1:
+#include <string.h>

../../../binutils-gdb/sim/or1k/../../include/dis-asm.h:343:21:
   const char *opt = strchr (options, ',');
                     ^~~~~~

include/ChangeLog:

	dis-asm.h: Include "string.h"
---
 include/dis-asm.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/dis-asm.h b/include/dis-asm.h
index 84627950c0..823bba5b45 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -32,6 +32,10 @@ extern "C" {
 #endif
 
 #include <stdio.h>
+/* For strchr.  */
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
 #include "bfd.h"
 
   typedef int (*fprintf_ftype) (void *, const char*, ...) ATTRIBUTE_FPTR_PRINTF_2;
-- 
2.19.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]