[svn:parrot] r36438 - in trunk: include/parrot src

NotFound at svn.parrot.org NotFound at svn.parrot.org
Sun Feb 8 11:53:20 UTC 2009


Author: NotFound
Date: Sun Feb  8 11:53:20 2009
New Revision: 36438
URL: https://trac.parrot.org/parrot/changeset/36438

Log:
[cage] avoid some gcc warnings and add more protection to some casting macros

Modified:
   trunk/include/parrot/parrot.h
   trunk/src/dynext.c
   trunk/src/sub.c

Modified: trunk/include/parrot/parrot.h
==============================================================================
--- trunk/include/parrot/parrot.h	Sun Feb  8 11:47:14 2009	(r36437)
+++ trunk/include/parrot/parrot.h	Sun Feb  8 11:53:20 2009	(r36438)
@@ -144,11 +144,11 @@
 #  define UINTVAL2PTR(any, d)    (any)(d)
 #else
 #  if PTR_SIZE == LONG_SIZE
-#    define INTVAL2PTR(any, d)    (any)(unsigned long)(d)
-#    define UINTVAL2PTR(any, d)    (any)(unsigned long)(d)
+#    define INTVAL2PTR(any, d)    ((any)(unsigned long)(d))
+#    define UINTVAL2PTR(any, d)    ((any)(unsigned long)(d))
 #  else
-#    define INTVAL2PTR(any, d)    (any)(unsigned int)(d)
-#    define UINTVAL2PTR(any, d)    (any)(unsigned int)(d)
+#    define INTVAL2PTR(any, d)    ((any)(unsigned int)(d))
+#    define UINTVAL2PTR(any, d)    ((any)(unsigned int)(d))
 #  endif /* PTR_SIZE == LONG_SIZE */
 #endif /* PTR_SIZE == INTVAL_SIZE */
 #define PTR2INTVAL(p)    INTVAL2PTR(INTVAL, (p))

Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c	Sun Feb  8 11:47:14 2009	(r36437)
+++ trunk/src/dynext.c	Sun Feb  8 11:53:20 2009	(r36438)
@@ -397,13 +397,13 @@
         char   * const cinit_func_name = Parrot_str_to_cstring(interp, init_func_name);
 
         /* get load_func */
-        load_func       = (PMC * (*)(PARROT_INTERP))
-            D2FPTR(Parrot_dlsym(handle, cload_func_name));
+	void * dlsymfunc = Parrot_dlsym(handle, cload_func_name);
+        load_func = (PMC * (*)(PARROT_INTERP)) D2FPTR(dlsymfunc);
         Parrot_str_free_cstring(cload_func_name);
 
         /* get init_func */
-        init_func       = (void (*)(PARROT_INTERP, PMC *))
-            D2FPTR(Parrot_dlsym(handle, cinit_func_name));
+        dlsymfunc = Parrot_dlsym(handle, cinit_func_name);
+        init_func = (void (*)(PARROT_INTERP, PMC *)) D2FPTR(dlsymfunc);
         Parrot_str_free_cstring(cinit_func_name);
     }
     else {

Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c	Sun Feb  8 11:47:14 2009	(r36437)
+++ trunk/src/sub.c	Sun Feb  8 11:53:20 2009	(r36438)
@@ -670,7 +670,7 @@
     if (Interp_debug_TEST(interp, PARROT_CTX_DESTROY_DEBUG_FLAG))
         fprintf(stderr,
                 "[invoke cont    %p, to_ctx %p, from_ctx %p (refs %d)]\n",
-                (void *)pmc, (void *)to_ctx, (void *)from_ctx, (int)from_ctx->ref_count);
+                (const void *)pmc, (void *)to_ctx, (void *)from_ctx, (int)from_ctx->ref_count);
 #endif
     if (!to_ctx)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,


More information about the parrot-commits mailing list