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]

Unbreak building cp-name-parser.y if using gnulib's memcmp


If configure comes to the conclusion that memcmp should be replaced 
by gnulib's version, the build would fail with:

> cc1: warnings being treated as errors
> cp-name-parser.y: In function 'cpname_lex':
> cp-name-parser.y:1608: error: implicit declaration of function 'rpl_memcmp'
> make[2]: *** [cp-name-parser.o] Error 1

The issue here is that gnulib doesn't declare memcmp, but instead, this is 
placed on config.h:

 /* Define to rpl_memcmp if the replacement function should be used. */
 #define memcmp rpl_memcmp

The fix is to include config.h before string.h, as attached.

Daniel approved this offline, so I checked it in.

-- 
Pedro Alves
2008-08-25  Pedro Alves  <pedro@codesourcery.com>

	* cp-name-parser.y: Include config.h before system headers.

---
 gdb/cp-name-parser.y |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: src/gdb/cp-name-parser.y
===================================================================
--- src.orig/gdb/cp-name-parser.y	2008-08-10 19:45:08.000000000 +0100
+++ src/gdb/cp-name-parser.y	2008-08-25 22:48:25.000000000 +0100
@@ -31,12 +31,13 @@ Boston, MA 02110-1301, USA.  */
 
 %{
 
+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
 
-#include "config.h"
 #include "safe-ctype.h"
 #include "libiberty.h"
 #include "demangle.h"

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