git: 78bbe9fc3e35 - main - pmc: Use distinct names for arguments to the pmc_config constructor

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 20 Aug 2026 20:45:05 UTC
The branch main has been updated by jhb:

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

commit 78bbe9fc3e3529731df07e29464f103f96f6ebed
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-08-20 19:49:36 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-08-20 19:49:36 +0000

    pmc: Use distinct names for arguments to the pmc_config constructor
    
    This pacifies shadow warnings from GCC:
    
    usr.sbin/pmc/cmd_pmc_record.cc: In constructor 'pmc_config::pmc_config(const std::__1::string&, uint64_t, cpuset_t)':
    usr.sbin/pmc/cmd_pmc_record.cc:96:71: error: declaration of 'cpumask' shadows a member of 'pmc_config' [-Werror=shadow]
       96 |         pmc_config(const std::string &event, uint64_t count, cpuset_t cpumask)
          |                                                              ~~~~~~~~~^~~~~~~
    usr.sbin/pmc/cmd_pmc_record.cc:90:25: note: shadowed declaration is here
       90 |         cpuset_t        cpumask;
          |                         ^~~~~~~
    usr.sbin/pmc/cmd_pmc_record.cc:96:55: error: declaration of 'count' shadows a member of 'pmc_config' [-Werror=shadow]
       96 |         pmc_config(const std::string &event, uint64_t count, cpuset_t cpumask)
          |                                              ~~~~~~~~~^~~~~
    usr.sbin/pmc/cmd_pmc_record.cc:89:25: note: shadowed declaration is here
       89 |         uint64_t        count;
          |                         ^~~~~
    usr.sbin/pmc/cmd_pmc_record.cc:96:39: error: declaration of 'event' shadows a member of 'pmc_config' [-Werror=shadow]
       96 |         pmc_config(const std::string &event, uint64_t count, cpuset_t cpumask)
          |                    ~~~~~~~~~~~~~~~~~~~^~~~~
    usr.sbin/pmc/cmd_pmc_record.cc:88:25: note: shadowed declaration is here
       88 |         std::string     event;
          |                         ^~~~~
    
    Reported by:    GCC 15
    Fixes:          a79a051e7d16 ("pmc: pmc record command")
---
 usr.sbin/pmc/cmd_pmc_record.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/pmc/cmd_pmc_record.cc b/usr.sbin/pmc/cmd_pmc_record.cc
index a8373b330705..cff0db7fc9c7 100644
--- a/usr.sbin/pmc/cmd_pmc_record.cc
+++ b/usr.sbin/pmc/cmd_pmc_record.cc
@@ -93,10 +93,11 @@ public:
 	{
 		CPU_ZERO(&cpumask);
 	}
-	pmc_config(const std::string &event, uint64_t count, cpuset_t cpumask)
-	    : event(event), count(count), ids()
+	pmc_config(const std::string &_event, uint64_t _count,
+	    cpuset_t _cpumask)
+	    : event(_event), count(_count), ids()
 	{
-		CPU_COPY(&cpumask, &this->cpumask);
+		CPU_COPY(&_cpumask, &cpumask);
 	}
 	/*
 	 * Read the capabilities and fills in the cpumask for a given event