Bug#522152: libtool: fix ltdl gcc warnings

2009-04-01 Thread Török Edwin
Package: libtool
Version: 2.2.6a-1
Severity: minor
Tags: patch


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.

-- System Information:
Debian Release: 5.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.28.7 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libtool depends on:
ii  autotools-dev 20080123.2 Update infrastructure for config.{
ii  bcc [c-compiler]  0.16.17-3  16-bit x86 C compiler
ii  cpp   4:4.3.3-2  The GNU C preprocessor (cpp)
ii  file  5.00-1 Determines file type using magic
ii  gcc [c-compiler]  4:4.3.3-2  The GNU C compiler
ii  gcc-3.4 [c-compiler]  3.4.6-9The GNU C compiler
ii  gcc-4.1 [c-compiler]  4.1.2-25   The GNU C compiler
ii  gcc-4.2 [c-compiler]  4.2.4-6The GNU C compiler
ii  gcc-4.3 [c-compiler]  4.3.3-5The GNU C compiler
ii  libc6-dev [libc-dev]  2.9-4  GNU C Library: Development Librari

Versions of packages libtool recommends:
ii  libltdl7-dev  2.2.6a-1   A system independent dlopen wrappe

Versions 

Bug#522152: libtool: fix ltdl gcc warnings

2009-04-01 Thread Ralf Wildenhues
Hello Török,

* Török Edwin wrote on Wed, Apr 01, 2009 at 10:41:17AM CEST:
 
 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).

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

 --- a/libltdl/loaders/preopen.c
 +++ b/libltdl/loaders/preopen.c
 @@ -97,7 +97,10 @@ get_vtable (lt_user_data loader_data)
  typedef struct symlist_chain
  {
struct symlist_chain *next;
 -  const lt_dlsymlist   *symlist;
 +  union {
 +  const lt_dlsymlist   *symlist;
 +  lt_module  module;
 +  } un;
  } symlist_chain;

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



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#522152: libtool: fix ltdl gcc warnings

2009-04-01 Thread Török Edwin
On 2009-04-01 21:20, Ralf Wildenhues wrote:
 Hello Török,

 * Török Edwin wrote on Wed, Apr 01, 2009 at 10:41:17AM CEST:
   
 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).
 

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

   
 --- a/libltdl/loaders/preopen.c
 +++ b/libltdl/loaders/preopen.c
 @@ -97,7 +97,10 @@ get_vtable (lt_user_data loader_data)
  typedef struct symlist_chain
  {
struct symlist_chain *next;
 -  const lt_dlsymlist   *symlist;
 +  union {
 +  const lt_dlsymlist   *symlist;
 +  lt_module module;
 +  } un;
  } symlist_chain;
 

 Changes to this ABI are *not* acceptable.
   

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)

 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.
   

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

 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
   


Best regards,
--Edwin



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#522152: libtool: fix ltdl gcc warnings

2009-04-01 Thread Ralf Wildenhues
* Török Edwin wrote on Wed, Apr 01, 2009 at 08:42:26PM CEST:
 On 2009-04-01 21:20, Ralf Wildenhues wrote:
  Changes to this ABI are *not* acceptable.
 
 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)

What do you think we should do with it?  This is an honest question:
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.

  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.
 
 I currently filter (via sed) -Werror from CFLAGS in the Makefile.

I'm not sure you've understood.  What I meant was:  if you do

  ./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



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#522152: libtool: fix ltdl gcc warnings

2009-04-01 Thread Török Edwin
On 2009-04-01 21:52, Ralf Wildenhues wrote:
 * Török Edwin wrote on Wed, Apr 01, 2009 at 08:42:26PM CEST:
   
 On 2009-04-01 21:20, Ralf Wildenhues wrote:
 
 Changes to this ABI are *not* acceptable.
   
 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)
 

 What do you think we should do with it?  This is an honest question:
   

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.

 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.
   

Please look at the attached patch, it only makes minimal changes that
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?

 Really, you are making our lives harder.

   
 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.
   
 I currently filter (via sed) -Werror from CFLAGS in the Makefile.
 

 I'm not sure you've understood.  What I meant was:  if you do

   ./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.  

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
diff --git a/libltdl/libltdl/lt__private.h b/libltdl/libltdl/lt__private.h
index f4c4a3d..035e5be 100644
--- a/libltdl/libltdl/lt__private.h
+++ b/libltdl/libltdl/lt__private.h
@@ -74,7 +74,7 @@ or obtained by writing to the Free Software Foundation, Inc.,
 #endif
 
 #ifndef __attribute__
-# if __GNUC__  2 || (__GNUC__ == 2  __GNUC_MINOR__  8) || __STRICT_ANSI__
+# if __GNUC__  2 || (__GNUC__ == 2  __GNUC_MINOR__  8) || defined(__STRICT_ANSI__)
 #  define __attribute__(x)
 # endif
 #endif
diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c
index 6e19599..3d4ff22 100644
--- a/libltdl/ltdl.c
+++ b/libltdl/ltdl.c
@@ -1259,12 +1259,12 @@ try_dlopen (lt_dlhandle *phandle, const char *filename, const char *ext,
  check whether we are opening a preloaded module.  */
   if (!dir)
 {
-  const lt_dlvtable *vtable	= lt_dlloader_find (lt_preopen);
+  const lt_dlvtable *vtable	= lt_dlloader_find ((char*)lt_preopen);
 
   if (vtable)
 	{
 	  /* name + . + libext + NULL */
-	  archive_name = MALLOC (char, LT_STRLEN (name) + LT_STRLEN (libext) + 2);
+	  archive_name = MALLOC (char, LT_STRLEN (name) + strlen (libext) + 2);
 	  *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle));
 
 	  if ((*phandle == NULL) || (archive_name == NULL))