Subject: Re: subr_disk.c error on kernel compile
To: leam <leam@reuel.net>
From: Andrey Petrov <petrov@netbsd.org>
List: port-sparc64
Date: 05/15/2003 03:51:36
On Wed, May 14, 2003 at 08:47:39PM -0400, leam wrote:
> And for my next trick......
> 
> /usr/pkg/gcc-3.2.2/bin/cc  -mcmodel=medlow -mno-fpu -ffreestanding  -O2 
> -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith 
> -Wmissing-prototypes -Wstrict-prototypes -Wno-sign-compare 
> -Wno-uninitialized  -Dsparc64 -D__sparc64__ -D_LP64 -Wa,-Av9a -I. 
> -I../../../../arch -I../../../.. -nostdinc -DLKM -DMAXUSERS=64 -D_KERNEL 
> -D_KERNEL_OPT   -c ../../../../kern/subr_disk.c
> 
> cc1: warnings being treated as errors
> ../../../../kern/subr_disk.c: In function `diskerr':
> ../../../../kern/subr_disk.c:151: warning: zero-length format string
> *** Error code 1
> 
> Stop.
> make: stopped in /usr/src/sys/arch/sparc64/compile/leamBSD
> 
> 
> leamBSD is just a copy of GENERIC, to see if I can compile on gcc3.2.2. 
> My existing kernel was compiled 7 May (though with src from a few days 
> prior), and the files that have later timestamps (in that directory), are:
> 
> -rw-r--r--   1 root  wheel  33840 Apr 28 23:10 subr_autoconf.c
> -rw-r--r--   1 root  wheel  17500 May  2 23:09 kern_ktrace.c
> -rw-r--r--   1 root  wheel  12449 May 14 17:06 core_elf32.c
> -rw-r--r--   1 root  wheel  25650 May 14 17:06 kern_ksyms.c
> -rw-r--r--   1 root  wheel  22103 May 14 17:06 kern_malloc.c
> -rw-r--r--   1 root  wheel  32083 May 14 17:06 kern_synch.c
> -rw-r--r--   1 root  wheel  12998 May 14 17:06 kgdb_stub.c
> -rw-r--r--   1 root  wheel  22955 May 14 17:06 sys_generic.c
> -rw-r--r--   1 root  wheel  40515 May 14 17:06 uipc_socket.c
> -rw-r--r--   1 root  wheel  21520 May 14 17:06 vfs_lockf.c
> 
> 
> Since subr_disk.c has a timestamp of 13 Apr 03, I'm fairly confident it 
> was used the last time I compiled. My guess is that gcc 3.2.2 is the 
> main difference, but I don't know enough to say for sure.
> 
> OTOH, the function diskerr does have a note a few lines above saying:
> 
>  /* Compiler will error this is the format is wrong... */
> 
> That might be on the line that says:
> 
>  printf("%" PRIdaddr, bp->b_blkno);
> 
> Which is about 4 prior to the one marked offending. Suggestions on 
> things to read or try to find the error?
> 
> ciao!
> 
> leam
> 

That's not an error that's warning, which you can not avoid for
that code in gcc 3.2.2. You can ignore that warning removing
-Werror from Makefile or manually compile that file without that
flag, or set kernel compiler flags in /etc/mk.conf.

	Andrey