libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: foreach_dirinpath on Solaris 10


From: Ralf Wildenhues
Subject: Re: foreach_dirinpath on Solaris 10
Date: Thu, 15 Nov 2007 20:36:49 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Maciej,

* Maciej Bliziński wrote on Thu, Nov 15, 2007 at 01:49:02AM CET:
> 
> I'm trying to compile you (version 1.5.24) on Solaris 10, using Sun C 
> compiler.
[...]
> "ltdl.c", line 3783: warning: argument #4 is incompatible with prototype:
>         prototype: pointer to void : "ltdl.c", line 2684
>         argument : pointer to function(pointer to const char, pointer
> to void) returning int

Ah yes, we fixed that in HEAD on 2006-08-31, but did not backport.
I'm applying this to branch-1-5.  Thanks for the report.  Please check
that this eliminates the type warnings for you.

Cheers,
Ralf

2007-11-15  Ralf Wildenhues  <address@hidden>

        Avoid mixing functions and data pointers in callback functions.
        * libltdl/ltdl.c (file_worker_func): New type.
        (lt_dlforeachfile): Instead of passing a function pointer as a
        data pointer, pass a pointer to a file_worker_func pointer.
        (foreach_callback_func): Adjust.
        Backport from 2006-08-31 fix in HEAD.
        Report by Maciej Bliziński <address@hidden>.

Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.174.2.32
diff -u -r1.174.2.32 ltdl.c
--- libltdl/ltdl.c      5 Sep 2007 19:23:37 -0000       1.174.2.32
+++ libltdl/ltdl.c      15 Nov 2007 19:31:21 -0000
@@ -2150,6 +2150,8 @@
 /* The type of a function used at each iteration of  foreach_dirinpath().  */
 typedef int    foreach_callback_func LT_PARAMS((char *filename, lt_ptr data1,
                                                 lt_ptr data2));
+/* foreachfile_callback itself calls a function of this type: */
+typedef int    file_worker_func      LT_PARAMS((const char *filename, void 
*data));
 
 static int     foreach_dirinpath     LT_PARAMS((const char *search_path,
                                                 const char *base_name,
@@ -3734,8 +3736,7 @@
      lt_ptr data1;
      lt_ptr data2;
 {
-  int (*func) LT_PARAMS((const char *filename, lt_ptr data))
-       = (int (*) LT_PARAMS((const char *filename, lt_ptr data))) data1;
+  file_worker_func *func = *(file_worker_func **) data1;
 
   int    is_done  = 0;
   char   *argz     = 0;
@@ -3773,37 +3774,38 @@
      lt_ptr data;
 {
   int is_done = 0;
+  file_worker_func **fpptr = &func;
 
   if (search_path)
     {
       /* If a specific path was passed, search only the directories
         listed in it.  */
       is_done = foreach_dirinpath (search_path, 0,
-                                  foreachfile_callback, func, data);
+                                  foreachfile_callback, fpptr, data);
     }
   else
     {
       /* Otherwise search the default paths.  */
       is_done = foreach_dirinpath (user_search_path, 0,
-                                  foreachfile_callback, func, data);
+                                  foreachfile_callback, fpptr, data);
       if (!is_done)
        {
          is_done = foreach_dirinpath (getenv("LTDL_LIBRARY_PATH"), 0,
-                                      foreachfile_callback, func, data);
+                                      foreachfile_callback, fpptr, data);
        }
 
 #ifdef LTDL_SHLIBPATH_VAR
       if (!is_done)
        {
          is_done = foreach_dirinpath (getenv(LTDL_SHLIBPATH_VAR), 0,
-                                      foreachfile_callback, func, data);
+                                      foreachfile_callback, fpptr, data);
        }
 #endif
 #ifdef LTDL_SYSSEARCHPATH
       if (!is_done)
        {
          is_done = foreach_dirinpath (getenv(LTDL_SYSSEARCHPATH), 0,
-                                      foreachfile_callback, func, data);
+                                      foreachfile_callback, fpptr, data);
        }
 #endif
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]