i386/98932: [ PATCH ] Kernel compilation failed on specific PERFMON configuration

Dan Lukes dan at obluda.cz
Wed Jun 14 08:40:15 UTC 2006


>Number:         98932
>Category:       i386
>Synopsis:       [ PATCH ] Kernel compilation failed on specific PERFMON configuration
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 14 08:40:13 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Dan Lukes
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
Obludarium
>Environment:
System: FreeBSD 6.1-STABLE #4: Mon May 29 15:29:58 CEST 2006 i386
sys/i386/isa/prof_machdep.c,v 1.25 2005/05/20 17:16:24 njl

>Description:
	In the sys/i386/isa/prof_machdep.c

	The variables cputime_clock_pmc_conf,cputime_clock_pmc_init,saved_gmp are declared when I586_PMC_GUPROF defined, but in the actual code, they are used when I586_PMC_GUPROF AND PERFMON defined only.

	It cause ...
/usr/src/sys/i386/isa/prof_machdep.c:66 warning: 'cputime_clock_pmc_conf' defined but not used
/usr/src/sys/i386/isa/prof_machdep.c:67 warning: 'cputime_clock_pmc_init' defined but not used
/usr/src/sys/i386/isa/prof_machdep.c:67 warning: 'saved_gmp' defined but not used

	... warning during compilation.

	As "count warning as error" is in efect for compilation (unless NO_WERROR defined) the compilation will fail.

>How-To-Repeat:
	Add I586_PMC_GUPROF but no PERFMON to kernel configuration file. Try to compile kernel.
>Fix:

	There are several possible ways to fix it.

1. We can declare there has no reason to use I586_PMC_GUPROF without PERFMON, so it's administrator's error.

2. We can add __unused to variable declaration

3. We can declare variables only when used later.

	Althought [1] seems to be true, I recommend [3]:

--- sys/i386/isa/prof_machdep.c.ORIG	Wed Jun 14 10:15:18 2006
+++ sys/i386/isa/prof_machdep.c	Wed Jun 14 10:20:34 2006
@@ -62,7 +62,7 @@
 int	cputime_bias = 1;	/* initialize for locality of reference */
 
 static int	cputime_clock = CPUTIME_CLOCK_UNINITIALIZED;
-#ifdef I586_PMC_GUPROF
+#if defined(PERFMON) && defined(I586_PMC_GUPROF)
 static u_int	cputime_clock_pmc_conf = I586_PMC_GUPROF;
 static int	cputime_clock_pmc_init;
 static struct gmonparam saved_gmp;


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-i386 mailing list