Re: WARNING: FOO.c: enum pmc_event has too many values: 1930 > 1023

From: Rui Paulo <rpaulo_at_me.com>
Date: Sat, 11 Apr 2015 09:41:47 -0700
On Saturday 11 April 2015 15:53:41 Oliver Pinter wrote:
> Hi all!
> 
> I just found the line in the subject in our jenkinsbuild  log in both
> amd64 and i386 case (we don't modified these files):
> 
> http://nyi-01.build.hardenedbsd.org:8180/jenkins/job/HardenedBSD-master-i386
> /56/console
> http://nyi-01.build.hardenedbsd.org:8180/jenkins/job/HardenedBSD-master-amd
> 64/58/consoleFull
> 
> And more similar lines:
> 
> WARNING: kern_pmc.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: kern_rwlock.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: kern_sx.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: kern_clock.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: kern_mutex.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: trap.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: hwpmc_soft.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: hwpmc_intel.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: hwpmc_amd.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: hwpmc_tsc.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: hwpmc_x86.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: hwpmc_logging.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: hwpmc_piv.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: hwpmc_uncore.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: hwpmc_core.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: hwpmc_mod.c: enum pmc_event has too many values: 1930 > 1023
> WARNING: kern_lock.c: enum pmc_event has too many values: 1930 > 1023

This is a known problem.  PMC abuses enums and CTF can't cope with it.

> and some other hwpmc related warnings too:
> --- kern_pmc.o ---
> /jenkins/workspace/HardenedBSD-master-amd64/sys/kern/kern_pmc.c:290:32:
> warning: comparison of constant 131072 with expression of type 'enum
> pmc_event' is always false
> [-Wtautological-constant-out-of-range-compare]
>                 KASSERT(ps->ps_ev.pm_ev_code >= PMC_EV_SOFT_FIRST &&
>                         ~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~
> /jenkins/workspace/HardenedBSD-master-amd64/sys/sys/systm.h:84:24:
> note: expanded from macro 'KASSERT'
>         if (__predict_false(!(exp)))                                    \
>                               ^
> /jenkins/workspace/HardenedBSD-master-amd64/sys/sys/cdefs.h:453:51:
> note: expanded from macro '__predict_false'
> #define __predict_false(exp)    __builtin_expect((exp), 0)
>                                                   ^
> /jenkins/workspace/HardenedBSD-master-amd64/sys/kern/kern_pmc.c:291:28:
> warning: comparison of constant 135167 with expression of type 'enum
> pmc_event' is always true
> [-Wtautological-constant-out-of-range-compare]
>                     ps->ps_ev.pm_ev_code <= PMC_EV_SOFT_LAST,
>                     ~~~~~~~~~~~~~~~~~~~~ ^
> /jenkins/workspace/HardenedBSD-master-amd64/sys/sys/systm.h:84:24:
> note: expanded from macro 'KASSERT'
>         if (__predict_false(!(exp)))                                    \
>                               ^
> /jenkins/workspace/HardenedBSD-master-amd64/sys/sys/cdefs.h:453:51:
> note: expanded from macro '__predict_false'
> #define __predict_false(exp)    __builtin_expect((exp), 0)
>                                                   ^
> --- kern_prot.o ---
> --- kern_pmc.o ---
> /jenkins/workspace/HardenedBSD-master-amd64/sys/kern/kern_pmc.c:307:13:
> warning: comparison of constant 131072 with expression of type 'enum
> pmc_event' is always false
> [-Wtautological-constant-out-of-range-compare]
>         KASSERT(ev >= PMC_EV_SOFT_FIRST &&
>                 ~~ ^  ~~~~~~~~~~~~~~~~~
> /jenkins/workspace/HardenedBSD-master-amd64/sys/sys/systm.h:84:24:
> note: expanded from macro 'KASSERT'
>         if (__predict_false(!(exp)))                                    \
>                               ^
> /jenkins/workspace/HardenedBSD-master-amd64/sys/sys/cdefs.h:453:51:
> note: expanded from macro '__predict_false'
> #define __predict_false(exp)    __builtin_expect((exp), 0)
>                                                   ^
> /jenkins/workspace/HardenedBSD-master-amd64/sys/kern/kern_pmc.c:308:9:
> warning: comparison of constant 135167 with expression of type 'enum
> pmc_event' is always true
> [-Wtautological-constant-out-of-range-compare]
>             ev <= PMC_EV_SOFT_LAST,
>             ~~ ^
> /jenkins/workspace/HardenedBSD-master-amd64/sys/sys/systm.h:84:24:
> note: expanded from macro 'KASSERT'
>         if (__predict_false(!(exp)))                                    \
>                               ^
> /jenkins/workspace/HardenedBSD-master-amd64/sys/sys/cdefs.h:453:51:
> note: expanded from macro '__predict_false'
> #define __predict_false(exp)    __builtin_expect((exp), 0)

We kept these checks for safety.

-- 
Rui Paulo
Received on Sat Apr 11 2015 - 14:41:58 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:56 UTC