#522152 libtool: fix ltdl gcc warnings

Package:
libtool
Source:
libtool
Submitter:
Török Edwin
Date:
2021-05-12 17:03:03 UTC
Severity:
minor
Tags:
#522152#5
Date:
2009-04-01 08:41:17 UTC
From:
To:
When compiling ltdl gcc gives warnings, causing -Werror compiles to fail:

I have attached a patch that fixes most of these warnings, with only 2 cast
warnings remaining.
The patch is against latest libtool git (v2.2.6-108-ga007ecc).

Currently:
cc1: warning: libltdl: No such file or directory
In file included from ../../../clamav-devel/libltdl/loaders/dlopen.c:32:
../../../clamav-devel/libltdl/libltdl/lt__private.h:77:63: warning: "__STRICT_ANSI__" is not defined
cc1: warning: libltdl: No such file or directory
In file included from ../../../clamav-devel/libltdl/loaders/preopen.c:32:
../../../clamav-devel/libltdl/libltdl/lt__private.h:77:63: warning: "__STRICT_ANSI__" is not defined
../../../clamav-devel/libltdl/loaders/preopen.c: In function ‘vm_open’:
../../../clamav-devel/libltdl/loaders/preopen.c:181: warning: cast discards qualifiers from pointer target type [-Wcast-qual]
cc1: warning: libltdl: No such file or directory
In file included from ../../../clamav-devel/libltdl/lt__alloc.c:31:
../../../clamav-devel/libltdl/libltdl/lt__private.h:77:63: warning: "__STRICT_ANSI__" is not defined
cc1: warning: libltdl: No such file or directory
In file included from ../../../clamav-devel/libltdl/lt_dlloader.c:31:
../../../clamav-devel/libltdl/libltdl/lt__private.h:77:63: warning: "__STRICT_ANSI__" is not defined
cc1: warning: libltdl: No such file or directory
In file included from ../../../clamav-devel/libltdl/lt_error.c:31:
../../../clamav-devel/libltdl/libltdl/lt__private.h:77:63: warning: "__STRICT_ANSI__" is not defined
cc1: warning: libltdl: No such file or directory
In file included from ../../../clamav-devel/libltdl/ltdl.c:32:
../../../clamav-devel/libltdl/libltdl/lt__private.h:77:63: warning: "__STRICT_ANSI__" is not defined
../../../clamav-devel/libltdl/ltdl.c: In function ‘lt_dlexit’:
../../../clamav-devel/libltdl/ltdl.c:328: warning: cast discards qualifiers from pointer target type [-Wcast-qual]
../../../clamav-devel/libltdl/ltdl.c:330: warning: cast discards qualifiers from pointer target type [-Wcast-qual]
../../../clamav-devel/libltdl/ltdl.c: In function ‘try_dlopen’:
../../../clamav-devel/libltdl/ltdl.c:1262: warning: passing argument 1 of ‘lt_dlloader_find’ discards qualifiers from pointer target type
../../../clamav-devel/libltdl/ltdl.c:1267: warning: the address of ‘libext’ will always evaluate as ‘true’ [-Waddress]
../../../clamav-devel/libltdl/ltdl.c: In function ‘lt_dlinsertsearchdir’:
../../../clamav-devel/libltdl/ltdl.c:2168: warning: cast discards qualifiers from pointer target type [-Wcast-qual]
../../../clamav-devel/libltdl/ltdl.c: In function ‘lt_dlinterface_free’:
../../../clamav-devel/libltdl/ltdl.c:2266: warning: cast discards qualifiers from pointer target type [-Wcast-qual]
cc1: warning: libltdl: No such file or directory
../../../clamav-devel/libltdl/slist.c: In function ‘lt__slist_unbox’:
../../../clamav-devel/libltdl/slist.c:370: warning: cast discards qualifiers from pointer target type [-Wcast-qual]
cc1: warning: libltdl: No such file or directory
libltdlcS.c:9: warning: function declaration isn't a prototype [-Wstrict-prototypes]

After applying my patch only these 2 remain, which are OK because I build with -Wno-error=cast-qual:
../../../clamav-devel/libltdl/ltdl.c: In function ‘lt_dlinsertsearchdir’:
../../../clamav-devel/libltdl/ltdl.c:2173: warning: cast discards qualifiers from pointer target type [-Wcast-qual]
../../../clamav-devel/libltdl/slist.c: In function ‘lt__slist_unbox’:
../../../clamav-devel/libltdl/slist.c:370: warning: cast discards qualifiers from pointer target type [-Wcast-qual]

Currently I filter -Werror in libltdl in ClamAV, but it would be nice if my
patch would be accepted, so that I no longer have to do that.

#522152#10
Date:
2009-04-01 18:20:29 UTC
From:
To:
Hello Török,

* Török Edwin wrote on Wed, Apr 01, 2009 at 10:41:17AM CEST:

The patch changes the ABI between ltmain and libltdl (and also forgets
to update ltmain):

Changes to this ABI are *not* acceptable.

Please just don't use -Werror.  That fails with lots of other
portability-minded software, and it can subtly change the results of
configure tests.

If you're concerned about visibility of compilation warnings, use a
postprocessor for output from 'make' (most editors have such things
built in); or you can also try the silent-rules mode from the next
Automake (1.10b, will become 1.11).

Cheers,
Ralf

#522152#15
Date:
2009-04-01 18:42:26 UTC
From:
To:
Ok, I'll try to provide a patch that doesn't touch the ABI, and only
makes minimal changes.
(and that will fix only the warnings that I have set with -Werror)

I currently filter (via sed) -Werror from CFLAGS in the Makefile.


Best regards,
--Edwin

#522152#20
Date:
2009-04-01 18:52:01 UTC
From:
To:
* Török Edwin wrote on Wed, Apr 01, 2009 at 08:42:26PM CEST:
every few months someone comes and wants his favorite -W flags silenced
because he uses -Werror.  But the point is: libltdl *cannot* be made
warning free without breaking the ABI.  dlopen returns void *, and that
simply isn't compatible with a pointer to some function, and given the
right flags, GCC will rightly warn about it.

Really, you are making our lives harder.

  ./configure CFLAGS='-Werror -Wfoo -Wbar'

then that might cause some of the tests run by the configure script to
have different answers than if you had not used -Werror in that line.
This can do damage to your build.  There are configure tests which,
again, due to portability requirement, *cannot* be made warning-free.
We try, but it's an uphill battle, because it tends to break Autoconf
tests on exotic, little-known systems.

Cheers,
Ralf

#522152#25
Date:
2009-04-01 19:07:29 UTC
From:
To:
I understand your point.
It is up to you if you accept the changes or not.
I think that if a patch that "fixes warnings" can break something, then
not accepting the patch is a good choice.

If the patch is minimal, and not intrusive, then I think accepting it is
the right choice.
Warnings tend to grow over time, up to the point where you are missing
important warnings because there is so much
noise (not the case with libtool).
This is what we've done with ClamAV, we tried to reduce the amount of
warnings,  by fixing those warnings that were easy/simple enough.
I've seen elsewhere in libltdl already:
- use defined(__STRICT_ANSI__) instead of just || __STRICT_ANSI__
- cast the argument to char*
- use strlen instead of LT_STRLEN when argument is a global variable

With this 3-lines fix my -Werror build doesn't fail anymore. Is it
acceptable?

I am aware of that. I use -Werror, and then
-Wno-error=<some-useless-warning-I-dontcare-about>
I am not using this to do real builds, just for 'make distcheck'.

Best regards,
--Edwin

#522152#30
Date:
2021-05-12 17:01:20 UTC
From:
To:
Kérem, szeretném tudni, hogy megkapta-e az előző üzeneteimet.