[sane-devel] Compilation warnings

Peter Kirchgessner peter at kirchgessner.net
Sun Nov 17 08:52:11 GMT 2002


Hi,

I fear the top-leader of the warnings (hp-option.c) will stay on the 
list. Most of the warnings are "unused parameters". This is because the 
functions are called through a single function pointer. And some of the 
functions really don't use the parameter. A solution could be to add 
global variables to which the unused parameters are assigned. This is 
what I dont't want to do.
Any other solution without adding dummy code just to satisfy the compiler ?

--Peter

Henning Meier-Geinitz schrieb:
> Hi,
> 
> This is a summary of the compilation warnings caused by gcc-3.0.4 on
> Linux. Some of them are rather harmless (e.g. unused parameter), but
> could be avoided nevertheless. Others (like comparison
> unsigned/signed) may be an implementation bug. Please check.
> 
> The following two tables list the numbers of warnings per file:
> 
> ./configure --disable-warnings:
>       2	sanei_scsi.c
>       2	sanei_usb.c
>       4	agfafocus.c
>       5	as6e.c
>       2	avision.c
>       8	canon-sane.c
>      23	coolscan.c
>       1	coolscan2.c
>       1	dc25.c
>      10	djpeg.c
>      12	dmc.c
>       2	epson_scsi.c
>       2	hp-accessor.c
>      53	hp-option.c
>       2	hp-scl.c
>       2	hp.c
>       6	microtek.c
>      25	mustek_pp.c
>      12	nec.c
>       3	net.c
>       4	pie.c
>       4	qcam.c
>       1	ricoh-scsi.c
>      12	s9036.c
>       8	sharp.c
>      14	sp15c.c
>       1	sp15c-scsi.h
>       1	sp15c.c
>      11	st400.c
>       4	tamarack.c
>      13	umax_pp_low.c
>       6	umax_pp.c
>       2	dll-preload.c
>       1	dll.c
> 
> Full log at:
> http://www.meier-geinitz.de/sane/tmp/warnings-2002-11-16-gcc3.0-nowarn.log
> 
> With all warnings enabled, there are some more "false alerts". E.g.
> the compiler complains about printf ("%p", pointer), where pointer
> points to something other that void. Can this really make trouble?
> Anyway, for completeness:
> 
>       2	../include/getopt.h
>      22	sanei_wire.c
>      22	sanei_scsi.c
>       4	sanei_usb.c
>       2	abaton.c
>       4	agfafocus.c
>       2	apple.c
>       3	artec.c
>       5	as6e.c
>       2	avision.c
>      10	canon-sane.c
>       2	canon630u-common.c
>       1	canon630u.c
>       1	canon_pp-dev.c
>      27	canon_pp.c
>      18	coolscan-scsidef.h
>      64	coolscan.c
>       2	coolscan2.c
>       1	dc25.c
>      10	djpeg.c
>       1	dc210.c
>      17	dmc.c
>       2	epson_scsi.c
>       2	epson.c
>      55	gt68xx_low.c
>       2	gt68xx_gt6801.c
>       2	gt68xx_gt6816.c
>       4	hp-accessor.c
>       4	hp-device.c
>      55	hp-option.c
>       2	hp-scl.c
>       2	hp.c
>       1	leo.c
>       2	matsushita.c
>      11	microtek.c
>      65	microtek2.c
>      33	mustek_pp.c
>       3	mustek_usb_low.c
>       4	mustek_usb_mid.c
>      14	mustek_usb_high.c
>      18	nec.c
>      20	net.c
>       4	pie.c
>       2	plustek.c
>       5	qcam.c
>       1	ricoh-scsi.c
>       2	ricoh.c
>      12	s9036.c
>       1	sceptre.c
>      13	sharp.c
>       4	snapscan-usb.c
>      18	sp15c-scsi.h
>      23	sp15c.c
>       1	sp15c-scsi.h
>       1	sp15c.c
>      33	st400.c
>       8	tamarack.c
>       3	test-picture.c
>      11	test.c
>       1	teco1.c
>       1	teco2.c
>       1	teco3.c
>       3	umax-usb.c
>       1	umax.c
>      14	umax_pp_low.c
>       6	umax_pp.c
>       1	umax1220u.c
>       1	v4l.c
>       1	dll.c
>       2	dll-preload.c
>       9	dll.c
>       3	scanimage.c
>       4	saned.c
> 
> Full log at:
> http://www.meier-geinitz.de/sane/tmp/warnings-2002-11-16-gcc3.0-warn.log
> 
> Sorted by type of warning (gcc-3.0, warnings enabled):
>     230	 warning: void format, [foo] type
>     170	 warning: unused parameter `[foo]'
>     115	 warning: cast discards qualifiers from pointer target type
>      54	 warning: pointer targets in passing arg [foo] of `[bar]' differ in signedness
>      37	 warning: pointer targets in initialization differ in signedness
>      32	 warning: comparison between signed and unsigned
>      19	 warning: passing arg [foo] of `[bar]' discards qualifiers from pointer target type
>      11	 warning: unused variable `[foo]'
>       5	 warning: signed and unsigned type in conditional expression
>       5	 warning: function declaration isn't a prototype
>       5	 warning: `[foo]' defined but not used
>       4	 warning: ISO C forbids use of cast expressions as lvalues
>       3	 warning: string length `[foo]' is greater than the length `509' ISO C89 compilers are required to support
>       3	 warning: overflow in implicit constant conversion
>       3	 warning: implicit declaration of function [foo]
>       3	 warning: assignment discards qualifiers from pointer target type
>       2	 warning: pointer targets in assignment differ in signedness
>       2	 warning: passing arg [foo] of `[bar]' from incompatible pointer type
>       2	 warning: missing initializer
>       2	 warning: [foo] format, [bar] arg (arg [baz])
>       1	 warning: too many arguments for format
>       1	 warning: suggest explicit braces to avoid ambiguous `else'
>       1	 warning: operation on `p' may be undefined
>       1	 warning: assignment from incompatible pointer type
> 
> Bye,
>   Henning
> _______________________________________________
> Sane-devel mailing list
> Sane-devel at www.mostang.com
> http://www.mostang.com/mailman/listinfo/sane-devel
> 


-- 
Peter Kirchgessner
http://www.kirchgessner.net
mailto:peter at kirchgessner.net





More information about the sane-devel mailing list