public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] fix HPUX-PA build on posix.cc
@ 2006-06-30 20:29 Andreas Tobler
  2006-06-30 21:04 ` Bryce McKinlay
  2006-07-01  1:12 ` Ranjit Mathew
  0 siblings, 2 replies; 6+ messages in thread
From: Andreas Tobler @ 2006-06-30 20:29 UTC (permalink / raw)
  To: Java Patches

Hello all,

this one fixes a build error on HPUX-PA.

Ok for trunk?

Andreas


2006-06-30  Andreas Tobler  <a.tobler@schweiz.ch>

	* posix.cc (_Jv_platform_dladdr): Cast away const when calling dladdr().

Index: posix.cc
===================================================================
--- posix.cc    (revision 115104)
+++ posix.cc    (working copy)
@@ -219,7 +219,7 @@

  #if defined (HAVE_DLFCN_H) && defined (HAVE_DLADDR)
    Dl_info addr_info;
-  ret_val = dladdr (addr, &addr_info);
+  ret_val = dladdr (const_cast<void *>(addr), &addr_info);
    if (ret_val != 0)
      {
        info->file_name = addr_info.dli_fname;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] fix HPUX-PA build on posix.cc
  2006-06-30 20:29 [patch] fix HPUX-PA build on posix.cc Andreas Tobler
@ 2006-06-30 21:04 ` Bryce McKinlay
  2006-06-30 21:11   ` Andreas Tobler
  2006-07-04 19:47   ` Andreas Tobler
  2006-07-01  1:12 ` Ranjit Mathew
  1 sibling, 2 replies; 6+ messages in thread
From: Bryce McKinlay @ 2006-06-30 21:04 UTC (permalink / raw)
  To: Andreas Tobler; +Cc: Java Patches

Its probably cleaner just to drop the "const" in the 
_Jv_platform_dladdr() declaration. I can't see any reason for that.

Bryce

Andreas Tobler wrote:
> Hello all,
>
> this one fixes a build error on HPUX-PA.
>
> Ok for trunk?
>
> Andreas
>
>
> 2006-06-30  Andreas Tobler  <a.tobler@schweiz.ch>
>
>     * posix.cc (_Jv_platform_dladdr): Cast away const when calling 
> dladdr().
>
> Index: posix.cc
> ===================================================================
> --- posix.cc    (revision 115104)
> +++ posix.cc    (working copy)
> @@ -219,7 +219,7 @@
>
>  #if defined (HAVE_DLFCN_H) && defined (HAVE_DLADDR)
>    Dl_info addr_info;
> -  ret_val = dladdr (addr, &addr_info);
> +  ret_val = dladdr (const_cast<void *>(addr), &addr_info);
>    if (ret_val != 0)
>      {
>        info->file_name = addr_info.dli_fname;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] fix HPUX-PA build on posix.cc
  2006-06-30 21:04 ` Bryce McKinlay
@ 2006-06-30 21:11   ` Andreas Tobler
  2006-07-04 19:47   ` Andreas Tobler
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Tobler @ 2006-06-30 21:11 UTC (permalink / raw)
  To: Bryce McKinlay; +Cc: Java Patches

Hi Bryce,

Bryce McKinlay wrote:
> Its probably cleaner just to drop the "const" in the 
> _Jv_platform_dladdr() declaration. I can't see any reason for that.

I did it the same way as we have it in boehm.cc.
It's an api buglet in the dladdr port from HPUX-PA.

And in the man page of linux the api is also wrong (FC4, at least), it 
should be dladdr(const void* addr, Dl_info* info) have a look into the 
header tells you more:
extern int dladdr (__const void *__address, Dl_info *__info)


Keep it consistent as in boehm.cc?

Andreas

P.S, APH knows the story.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] fix HPUX-PA build on posix.cc
  2006-06-30 20:29 [patch] fix HPUX-PA build on posix.cc Andreas Tobler
  2006-06-30 21:04 ` Bryce McKinlay
@ 2006-07-01  1:12 ` Ranjit Mathew
  1 sibling, 0 replies; 6+ messages in thread
From: Ranjit Mathew @ 2006-07-01  1:12 UTC (permalink / raw)
  To: Andreas Tobler; +Cc: GCJ Patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Tobler wrote:
> 
> this one fixes a build error on HPUX-PA.
[...]
>     Dl_info addr_info;
> -  ret_val = dladdr (addr, &addr_info);
> +  ret_val = dladdr (const_cast<void *>(addr), &addr_info);

I am sorry for causing this build error. The reason I used
const was that the address parameter was not supposed to
to be modified by the callee. Looking at /usr/include/dlfcn.h
on my Linux box it also seemed palatable to the dladdr()
function so I went ahead with it.

By the way, we've had discussions on the utility of using
const qualifiers in C on the GCC list recently:

  http://gcc.gnu.org/ml/gcc/2006-06/msg00870.html

Thanks,
Ranjit.

- --
Ranjit Mathew       Email: rmathew AT gmail DOT com

Bangalore, INDIA.     Web: http://rmathew.com/




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEpcwwYb1hx2wRS48RAqIEAJwPuongckFipHNSTU0bqL6tXUXlIACgl/fm
voZxoycjiX2Mt+ZP8aSeApQ=
=l8ZL
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] fix HPUX-PA build on posix.cc
  2006-06-30 21:04 ` Bryce McKinlay
  2006-06-30 21:11   ` Andreas Tobler
@ 2006-07-04 19:47   ` Andreas Tobler
  2006-07-04 19:58     ` Bryce McKinlay
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Tobler @ 2006-07-04 19:47 UTC (permalink / raw)
  To: Bryce McKinlay; +Cc: Java Patches

[-- Attachment #1: Type: text/plain, Size: 587 bytes --]

Bryce McKinlay wrote:
> Its probably cleaner just to drop the "const" in the 
> _Jv_platform_dladdr() declaration. I can't see any reason for that.

Ok, after short discussion on irc I see the point now and changed the 
patch. Building right now.

If testing is ok can I commit to trunk?

Thanks,
Andreas


2006-07-04  Andreas Tobler  <a.tobler@schweiz.ch>

	PR libgcj/28226:
	* include/posix.h (_Jv_platform_dladdr): Remove const qualifier.
	* include/win32.h (_Jv_platform_dladdr): Likewise.
	* posix.cc (_Jv_platform_dladdr): Likewise.
	* win32.cc (_Jv_platform_dladdr): Likewise.




[-- Attachment #2: pr28226.diff --]
[-- Type: text/plain, Size: 1850 bytes --]

Index: include/posix.h
===================================================================
--- include/posix.h	(revision 115180)
+++ include/posix.h	(working copy)
@@ -199,6 +199,6 @@
 
 // Given an address, determine the executable or shared object that defines
 // it and the nearest named symbol.
-extern int _Jv_platform_dladdr (const void *addr, _Jv_AddrInfo *info);
+extern int _Jv_platform_dladdr (void *addr, _Jv_AddrInfo *info);
 
 #endif /* __JV_POSIX_H__ */
Index: include/win32.h
===================================================================
--- include/win32.h	(revision 115180)
+++ include/win32.h	(working copy)
@@ -180,6 +180,6 @@
 
 // Given an address, determine the executable or shared object that defines
 // it and the nearest named symbol.
-extern int _Jv_platform_dladdr (const void *addr, _Jv_AddrInfo *info);
+extern int _Jv_platform_dladdr (void *addr, _Jv_AddrInfo *info);
 
 #endif /* __JV_WIN32_H__ */
Index: posix.cc
===================================================================
--- posix.cc	(revision 115180)
+++ posix.cc	(working copy)
@@ -213,7 +213,7 @@
 // defined symbol to that address.  Returns 0 if no object defines this
 // address.
 int
-_Jv_platform_dladdr (const void *addr, _Jv_AddrInfo *info)
+_Jv_platform_dladdr (void *addr, _Jv_AddrInfo *info)
 {
   int ret_val = 0;
 
Index: win32.cc
===================================================================
--- win32.cc	(revision 115180)
+++ win32.cc	(working copy)
@@ -463,7 +463,7 @@
 // defined symbol to that address.  Returns 0 if no object defines this
 // address.
 int
-_Jv_platform_dladdr (const void *addr, _Jv_AddrInfo *info)
+_Jv_platform_dladdr (void *addr, _Jv_AddrInfo *info)
 {
   // Since we do not have dladdr() on Windows, we use a trick involving
   // VirtualQuery() to find the module (EXE or DLL) that contains a given

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] fix HPUX-PA build on posix.cc
  2006-07-04 19:47   ` Andreas Tobler
@ 2006-07-04 19:58     ` Bryce McKinlay
  0 siblings, 0 replies; 6+ messages in thread
From: Bryce McKinlay @ 2006-07-04 19:58 UTC (permalink / raw)
  To: Andreas Tobler; +Cc: Java Patches

Andreas Tobler wrote:
> Bryce McKinlay wrote:
>> Its probably cleaner just to drop the "const" in the 
>> _Jv_platform_dladdr() declaration. I can't see any reason for that.
>
> Ok, after short discussion on irc I see the point now and changed the 
> patch. Building right now.
>
> If testing is ok can I commit to trunk?
>
> Thanks,
> Andreas
>
>
> 2006-07-04  Andreas Tobler  <a.tobler@schweiz.ch>
>
>     PR libgcj/28226:
>     * include/posix.h (_Jv_platform_dladdr): Remove const qualifier.
>     * include/win32.h (_Jv_platform_dladdr): Likewise.
>     * posix.cc (_Jv_platform_dladdr): Likewise.
>     * win32.cc (_Jv_platform_dladdr): Likewise.

OK, thanks.

Bryce

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-07-04 19:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-30 20:29 [patch] fix HPUX-PA build on posix.cc Andreas Tobler
2006-06-30 21:04 ` Bryce McKinlay
2006-06-30 21:11   ` Andreas Tobler
2006-07-04 19:47   ` Andreas Tobler
2006-07-04 19:58     ` Bryce McKinlay
2006-07-01  1:12 ` Ranjit Mathew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).