libtool
[Top][All Lists]
Advanced

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

Re: ltdl.c and 1.4.1 (type conflicts)


From: Gary V. Vaughan
Subject: Re: ltdl.c and 1.4.1 (type conflicts)
Date: Fri, 7 Sep 2001 00:43:31 +0100
User-agent: Mutt/1.3.21i

On Wed, Sep 05, 2001 at 09:52:10PM -0500, address@hidden wrote:
> 
> Harder to fix is:
> "ltdl.c", line 3204.58: 1506-280 (E) Function argument assignment
> between types "void*" and "int(*)(const char*,void*)" is not allowed.
> "ltdl.c", line 3210.58: 1506-280 (E) Function argument assignment
> between types "void*" and "int(*)(const char*,void*)" is not allowed.
> "ltdl.c", line 3214.62: 1506-280 (E) Function argument assignment
> between types "void*" and "int(*)(const char*,void*)" is not allowed.
> "ltdl.c", line 3221.62: 1506-280 (E) Function argument assignment
> between types "void*" and "int(*)(const char*,void*)" is not allowed.
> "ltdl.c", line 3228.62: 1506-280 (E) Function argument assignment
> between types "void*" and "int(*)(const char*,void*)" is not allowed.
> 
> ltdl.c makes liberal use of pointers.
> 
> The above is on AIX 4.3.2 with xlc BTW.

Oh yuck!  Are there any mode switches to xlc to have it accept this
ideom?  Otherwise we need to come up with a workaround... presumably
it is an alignment issue?  Can I call this a `bug in the compiler', or
is it legitimate for it to reject this out of hand?

A few of ideas come to mind:

 i) what about removing a level of indirection? (I'd be surprised)

  int
  lt_dlforeachfile (search_path, func, data)
       const char *search_path;
       int func LT_PARAMS ((const char *filename, lt_ptr data));
       lt_ptr data;
   ...

  and adjust all callers.

 ii) does it work if we have a dummy void* variable? (also unlikely)
  
  void *dummy   = (void *) func;
  int   is_done = 0;
  
  if (search_path)
    is_done = foreach_dirinpath (search_path, 0,
                                 foreachfile_callback, dummy, data);

iii) how about if we use a union to force the alignment? (this seems
     to be the best option)
  
  union aligned_func
  {
    void *ptr;
    int (*func) LT_PARAMS ((const char *filename, lt_ptr data));
  };
  
  ...  
  union aligned_func dummy;
  int   is_done = 0;
  
  dummy.func = func;

  if (search_path)
    is_done = foreach_dirinpath (search_path, 0,
                                 foreachfile_callback, dummy.ptr, data);
                                 
Thoughts?  These can be combined in various permutations too if we can
strike upon a combination that xlc will accept.

Cheers,
        Gary.
-- 
  ())_. Gary V. Vaughan     gary@(oranda.demon.co.uk|gnu.org)
  ( '/  Research Scientist  http://www.oranda.demon.co.uk       ,_())____
  / )=  GNU Hacker          http://www.gnu.org/software/libtool  \'      `&
`(_~)_  Tech' Author        http://sources.redhat.com/autobook   =`---d__/



reply via email to

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