[PATCH] Add startswith function and use it instead of CONST_STRNEQ.

Martin Liška mliska@suse.cz
Mon Mar 22 16:42:50 GMT 2021


On 3/22/21 1:06 PM, Alan Modra wrote:
> On Sun, Mar 21, 2021 at 08:13:06PM -0600, Tom Tromey wrote:
>> Alan> Yes, the following compiles.  Fortunately all gdb files that include
>> Alan> gdbsupport/common-utils.h also include bfd.h by one means or another.
>>
>> Sorry, I misunderstood.  I thought the proposal was to put the
>> function in ansidecl.h.
>>
>> gdbserver can't generally include bfd.  Maybe it works sometimes, but I
>> imagine if you do a gdbserver-only build, bfd.h won't even be created.
>> (At least, it shouldn't be, because gdbserver doesn't require bfd.)
>>
>> So I think some other approach is needed.  Either ansidecl.h, or a new
>> header; or rename either the BFD or GDB function and go from there.
> 
> A new header would be best, I think.
> 
>> I'm happy to implement it if you like.
> 
> Yes, that way you'll get it done properly.  :)  Sorry for the breakage.
> 

Hello.

I feel also responsible for the current compilation problems, I pulled the trigger.

Anyway for the sim failures. What about directly including <string.h> in bfd-in.h?

diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index fda9fe0198e..d35e2ece516 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -38,6 +38,7 @@ extern "C" {
  #include "diagnostics.h"
  #include <stdarg.h>
  #include <sys/stat.h>
+#include <string.h>
  
  #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
  #ifndef SABER

Or do I miss something?
Thanks,
Martin


More information about the Gdb-patches mailing list