This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

Re: Patch: Include platform.h in gnu/gcj/runtime/natStackTrace.cc


Ranjit Mathew wrote:
What I can perhaps do is to have configure define HAVE_BACKTRACE
for Win32 (does Cygwin use win32.h as well or is it only MinGW?),
and then have natStackTrace.cc provide a conditional prototype for
backtrace( ) on Win32.
How about this: we define HAVE_BACKTRACE for MinGW as well
as NEED_BACKTRACE_PROTOTYPE in configure - the latter
is then used by natStackTrace.cc to conditionally define
an explicit function prototype for backtrace( ).

The following patch takes this approach:
------------------------------- 8< -------------------------------
2003-01-26  Ranjit Mathew  <rmathew@hotmail.com>

        * configure.in: Explicitly define HAVE_BACKTRACE and
        NEED_BACKTRACE_PROTOTYPE if building for MinGW.
        * include/config.h.in: Add definition template for
        NEED_BACKTRACE_PROTOTYPE.
        Correct minor typo in definition template for HAVE_SOCKLEN_T.
        * include/win32.h: Remove definition of HAVE_BACKTRACE.
        Remove function prototype for backtrace( ).
        * gnu/gcj/runtime/natStackTrace.cc: Declare function
        prototype for backtrace( ) if both HAVE_BACKTRACE and
        NEED_BACKTRACE_PROTOTYPE are defined.
        * configure: Rebuilt.


--- configure.in	2003-01-26 23:18:05.000000000 +0530
+++ configure.in	2003-01-26 23:20:54.000000000 +0530
@@ -523,4 +523,12 @@
 	 ;;
      esac
+   ], [
+     case "$host" in
+       *mingw*)
+         # Has backtrace() defined in libgcj itself
+         AC_DEFINE(HAVE_BACKTRACE)
+         AC_DEFINE(NEED_BACKTRACE_PROTOTYPE)
+         ;;
+     esac
    ])

--- include/win32.h	2003-01-26 23:27:34.000000000 +0530
+++ include/win32.h	2003-01-26 23:28:03.000000000 +0530
@@ -116,9 +116,3 @@
 #endif /* DISABLE_JAVA_NET */

-#define HAVE_BACKTRACE
-
-/* Store up to SIZE return address of the current program state in
-   ARRAY and return the exact number of values stored.  */
-extern int backtrace (void **__array, int __size);
-
 #endif /* __JV_WIN32_H__ */
--- include/config.h.in	2003-01-27 00:06:43.000000000 +0530
+++ include/config.h.in	2003-01-27 00:06:43.000000000 +0530
@@ -97,5 +97,5 @@
 #undef HAVE_STRUCT_IPV6_MREQ

-/* Define it socklen_t typedef is in sys/socket.h.  */
+/* Define if socklen_t typedef is in sys/socket.h.  */
 #undef HAVE_SOCKLEN_T

@@ -179,4 +179,7 @@
 #undef HAVE_BACKTRACE

+/* Define if you need to declare an explicit prototype for backtrace().  */
+#undef NEED_BACKTRACE_PROTOTYPE
+
 /* Define if your platform has the global _timezone variable.  */
 #undef HAVE_UNDERSCORE_TIMEZONE
--- gnu/gcj/runtime/natStackTrace.cc	2003-01-26 23:36:46.000000000 +0530
+++ gnu/gcj/runtime/natStackTrace.cc	2003-01-26 23:41:48.000000000 +0530
@@ -44,4 +44,8 @@
 #include <unwind.h>

+#if defined (HAVE_BACKTRACE) && defined (NEED_BACKTRACE_PROTOTYPE)
+extern int backtrace (void **, int);
+#endif
+

 // Fill in this stack trace with MAXLEN elements starting at offset.
------------------------------- 8< -------------------------------

Sincerely Yours,
Ranjit.

--
Ranjit Mathew        Email: rmathew AT hotmail DOT com
Bangalore,
INDIA.               Web: http://ranjitmathew.tripod.com/



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