Subject: Re: kernel compilation using gcc 3.2.2 - supposed to work?
To: theo borm <theo4490@borm.org>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 04/22/2003 08:55:40
On Tuesday, April 22, 2003, at 08:42  AM, theo borm wrote:

> cc1: warnings being treated as errors
>
> /sys/dev/ic/ld_icp.c: In function `ld_icp_attach':
> /sys/dev/ic/ld_icp.c:128: warning: too many arguments for format
> if (!icp_cmd(icp, ICP_CACHESERVICE, ICP_IOCTL, ICP_CACHE_DRV_INFO,
> sc->sc_hwunit, sizeof(struct icp_cdevinfo))) {
> printf(": unable to retrieve device info\n",
> ld->sc_dv.dv_xname);

This is a legitimate bug.


> /sys/dev/ic/aac.c: In function `aac_describe_controller':
> /sys/dev/ic/aac.c:364: warning: too many arguments for format
> printf("%s: %s at %dMHz, %dMB cache, %s, kernel %d.%d-%d\n",
> sc->sc_dv.dv_xname,
> aac_describe_code(aac_cpu_variant, le32toh(info->CpuVariant)),
> le32toh(info->ClockSpeed),
> le32toh(info->BufferMem) / (1024 * 1024),
> aac_describe_code(aac_battery_platform,
> le32toh(info->batteryPlatform)),
> le32toh(info->batteryPlatform),
> info->KernelRevision.external.comp.major,
> info->KernelRevision.external.comp.minor,
> info->KernelRevision.external.comp.dash);

As is this.

> /sys/kern/subr_disk.c: In function `diskerr':
> /sys/kern/subr_disk.c:348: warning: zero-length format string
> if (pri != LOG_PRINTF) {
> static const char fmt[] = "";
> log(pri, fmt);
> pr = addlog;
> } else
> pr = printf;

This, however, is not.  A zero-length format string is a perfectly 
legitimate argument, and note that it has special significance with 
log() and addlog().

The change for GCC 3.3 was to add a switch that disables warnings for 
zero-length format strings.

GCC 3.3 also has changes to not warn about NULL format arguments to 
NetBSD's userlevel err(3), warn(3), etc. library functions (NULL is a 
legitimate format argument for those functions, yet when non-NULL is 
passed, we want normal printf format checking).

         -- Jason R. Thorpe <thorpej@wasabisystems.com>