[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libltdl & 64-bit lint
From: |
Gary V. Vaughan |
Subject: |
Re: libltdl & 64-bit lint |
Date: |
Sun, 28 Oct 2001 02:32:01 +0000 |
User-agent: |
Mutt/1.3.16i |
On Sun, Sep 30, 2001 at 11:05:52PM -0500, address@hidden wrote:
> 2001-09-30 Albert Chin-A-Young <address@hidden>
>
> * ltdl.c: change some types to size_t from int because
> strlen() returns size_t. argz_len changed to size_t in
> foreach_dirinpath() because argzize_path() takes 3rd
> argument as size_t, not int. Based on lint run from
> Bob Friesenhahn <address@hidden>.
>
> On Sun, Sep 30, 2001 at 11:04:35AM -0500, Bob Friesenhahn wrote:
> > Here is the output from Sun's 64-bit lint tool when run on libltdl
> > current as of September 29. You will notice that there are a number of
> > type down-conversions going on when the code is 64-bit. In order to
> > be safe, these types should jive for both the ILP32 and LP64 data type
> > models.
> >
> > (390) warning: suspicious comparison of unsigned with 0: op "<="
>
> static lt_ptr
> realloc (ptr, size)
> lt_ptr ptr;
> size_t size;
> {
> if (size <= 0)
>
> Is size_t always unsigned?
Yup. This must be a result of careless code tweaking on my part. I've
made this into `==' in addition to the changes in your patch.
I wonder, should we also test for a system definition of size_t at
configure time? And presumably substitute for `unsigned long' if the
system definition is missing?
> > (1994) warning: cast from 64-bit integer to 32-bit integer
>
> sprintf (filename, "%.*s/%s", (int) dirname_len, dirname, dlname);
>
> According to sprintf(3) on a Linux box, when using %*, the field width
> must be of type int.
Agreed.
> > (2643) warning: comparing 32-bit integer with 64-bit integer
>
> for (i = 0; i < ext - base_name; ++i)
>
> ext and base_name are char *. Should we make i a size_t?
Seems like the right thing to do from here. I'm also adding this change
to your patch.
> > (2718) warning: passing 64-bit integer arg, expecting 32-bit integer:
> > fgets(arg 2)
>
> if (!fgets (line, line_len, file))
>
> line_len is size_t. fgets expects second argument to be int.
Hmmm. That sucks. I'll cast it down to an int for now. But if someone
has the time to implement an rpl_fgets in the spirit of the other
replacement functions near the top of ltdl.c, I'd be very grateful...
Appying to HEAD and branch-1-4.
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__/