Re: [all pushed] Re: [PATCH 00/36] Support building GDB as a C++ program

Pedro Alves
2015-03-16T11:55:03Z

On 03/16/2015 08:26 AM, asmwarrior wrote:
> OK, I now successfully build gdb.exe and gdbserver.exe!
> To handle the INT32_MAX and INT32_MIN macro definition issue, I just have:
>
> #ifndef INT32_MIN
> #define INT32_MIN INT_MIN
> #endif
>
> #ifndef INT32_MAX
> #define INT32_MAX INT_MAX
> #endif
>
> Before
>
> #if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
> # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
> #endif
>
> In either:
> mybuildcpp\gdb\gdbserver\build-gnulib-gdbserver\import\inttypes.h
> and
> mybuildcpp\gdb\build-gnulib\import\inttypes.h

Putting the hack in common-defs.h instead worked for me. It has
the advantage of being in the sources, so won't get lost by
a clean rebuild, which regenerates that file.

However, we should instead do what the error says, and report the
issue to bug-gnulib@gnu.org, fix the issue there, and then
pull in a newer gnulib. Maybe the issue is already fixed there
even. That last time we tried pulling in a newer gnulib we
stumbled on a windows.h conflict that will be to resolved
first though. :-/

Thanks,
Pedro Alves

From 9f4ccd018230538d043eaa08858a6df2eae3cabd Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Mon, 16 Mar 2015 11:09:43 +0000
Subject: [PATCH] hack for missing INT32_MIN/INT32_MAX

---
gdb/common/common-defs.h | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 62d9de5..72a65dd 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -27,6 +27,14 @@
#include "build-gnulib/config.h"
#endif

+#ifndef INT32_MIN
+#define INT32_MIN INT_MIN
+#endif
+
+#ifndef INT32_MAX
+#define INT32_MAX INT_MAX
+#endif
+
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
--
1.9.3