Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jul 2022 11:02:19 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c7f584db172e - stable/12 - Fix unused variable warnings in hwpmc_mod.c
Message-ID:  <202207241102.26OB2JOl041385@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=c7f584db172e65d81ee59d9b36933799719f12bf

commit c7f584db172e65d81ee59d9b36933799719f12bf
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-21 18:35:41 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-24 11:01:19 +0000

    Fix unused variable warnings in hwpmc_mod.c
    
    With clang 15, the following -Werror warnings are produced:
    
        sys/dev/hwpmc/hwpmc_mod.c:4805:6: error: variable 'nfree' set but not used [-Werror,-Wunused-but-set-variable]
                int nfree;
                    ^
        sys/dev/hwpmc/hwpmc_mod.c:4804:6: error: variable 'ncallchains' set but not used [-Werror,-Wunused-but-set-variable]
                int ncallchains;
                    ^
    
    The 'nfree' and 'ncallchains' variables were used in KASSERTs, but these
    were removed due to refactoring in d9f1b8dbf29d. Remove the variables
    since they no longer serve any purpose.
    
    MFC after:      3 days
    
    (cherry picked from commit 38a9b8a00ce933e99b4a643cdcc3220be82e7d62)
---
 sys/dev/hwpmc/hwpmc_mod.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index 2f75745c70b1..43c8e96d23b1 100644
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -4787,8 +4787,6 @@ pmc_capture_user_callchain(int cpu, int ring, struct trapframe *tf)
 	uint64_t considx, prodidx;
 	int nsamples, nrecords, pass, iter;
 #ifdef	INVARIANTS
-	int ncallchains;
-	int nfree;
 	int start_ticks = ticks;
 #endif
 	psb = pmc_pcpu[cpu]->pc_sb[ring];
@@ -4798,10 +4796,6 @@ pmc_capture_user_callchain(int cpu, int ring, struct trapframe *tf)
 	    ("[pmc,%d] Retrieving callchain for thread that doesn't want it",
 		__LINE__));
 
-#ifdef	INVARIANTS
-	ncallchains = 0;
-	nfree = 0;
-#endif
 	nrecords = INT_MAX;
 	pass = 0;
  restart:
@@ -4820,13 +4814,8 @@ pmc_capture_user_callchain(int cpu, int ring, struct trapframe *tf)
 
 #ifdef	INVARIANTS
 		if (ps->ps_nsamples == PMC_SAMPLE_FREE) {
-			nfree++;
 			continue;
 		}
-
-		if ((ps->ps_pmc == NULL) ||
-		    (ps->ps_pmc->pm_state != PMC_STATE_RUNNING))
-			nfree++;
 #endif
 		if (ps->ps_td != td ||
 		   ps->ps_nsamples != PMC_USER_CALLCHAIN_PENDING ||
@@ -4857,10 +4846,6 @@ pmc_capture_user_callchain(int cpu, int ring, struct trapframe *tf)
 		 * as 'processable' by the timer tick sweep code.
 		 */
 
-#ifdef INVARIANTS
-		ncallchains++;
-#endif
-
 		if (__predict_true(nsamples < pmc_callchaindepth - 1))
 			nsamples += pmc_save_user_callchain(ps->ps_pc + nsamples,
 		       pmc_callchaindepth - nsamples - 1, tf);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207241102.26OB2JOl041385>