The branch main has been updated by ngie:

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

commit fd809148cafd880aedb4e9db101742f7b1de4317
Author:     Enji Cooper <[email protected]>
AuthorDate: 2026-08-09 22:45:11 +0000
Commit:     Enji Cooper <[email protected]>
CommitDate: 2026-08-09 22:56:50 +0000

    pmc(8): resolve -Wshadow issues
    
    - Prefix all structs with the struct keyword to avoid collisions between
      the types and variables with the same "name".
    - Use `_` suffixed variables in initializers to distinguish input
      parameters from public members [1].
    
    Resolve some trailing whitespace issues while here.
    
    NOTE: this doesn't resolve the -pedantic issue reported by g++ with
    `pmchdr_cpuidinfo::cpuid` about the field being a flexible array in an
    otherwise empty struct.
    
    1. I generally do this the other way around, i.e., suffix private/protected
       members with `_`, but these are public members in structs and I don't 
want
       to introduce a lot of churn in calling code.
    
    Reported by:    g++14 with FreeBSD CI (powerpc64 tinderbox)
    Fixes:  ce6ab51f ("pmc: enable the new pmc commands")
---
 usr.sbin/pmc/view.hh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/usr.sbin/pmc/view.hh b/usr.sbin/pmc/view.hh
index 062325b096dc..46b7c49222f0 100644
--- a/usr.sbin/pmc/view.hh
+++ b/usr.sbin/pmc/view.hh
@@ -65,13 +65,13 @@ struct pmcinfo
 };
 
 /*
- * Extended pmcinfo structure stores the complete event description passed to 
+ * Extended pmcinfo structure stores the complete event description passed to
  * libpmc.
  */
 struct pmcinfox
 {
        pmcinfox() : rate(0), event() { }
-       pmcinfox(uint32_t rate, std::string event) : rate(rate), event(event) { 
}
+       pmcinfox(uint32_t rate_, std::string &event_) : rate(rate_), 
event(event_) { }
        ~pmcinfox() { }
        uint32_t                        rate;
        std::string                     event;
@@ -103,7 +103,7 @@ struct vmmap
 struct threadinfo
 {
        threadinfo() : name("") { }
-       threadinfo(const std::string &name) : name(name) { }
+       threadinfo(const std::string &name_) : name(name_) { }
        ~threadinfo() { }
        std::string                     name;
 };
@@ -197,7 +197,7 @@ struct pmcfilter
        std::unordered_set<std::string> events;
        cpuset_t                        cpus;
        /*
-        * Advanced filters for AMD IBS but should be generalized to support 
+        * Advanced filters for AMD IBS but should be generalized to support
         * other processors.
         */
        uint64_t                        ibs_ldlat;
@@ -388,8 +388,8 @@ protected:
        // Fields available to views
        uint64_t                                tscfreq;
        std::unordered_map<uint32_t, uint32_t>  pmcid;
-       std::unordered_map<uint32_t, pmcinfo>   pmcinfo;
-       std::unordered_map<pid_t, procinfo>     procs;
+       std::unordered_map<uint32_t, struct pmcinfo> pmcinfo;
+       std::unordered_map<pid_t, struct procinfo> procs;
        std::unordered_map<pid_t, pid_t>        tidtopid;
        std::unordered_map<std::string, image>  images;
        std::string                             sysroot;
@@ -399,8 +399,8 @@ protected:
        std::string                             cpumodel;
        std::string                             osrelease;
        std::string                             buildid;
-       std::vector<pmcinfox>                   extpmcinfo;
-       std::map<uint32_t, cpuidleaf>           cpuid; // x86 Only
+       std::vector<struct pmcinfox>            extpmcinfo;
+       std::map<uint32_t, struct cpuidleaf>    cpuid; // x86 Only
 private:
        image loadimage(const std::string &path);
        void mapimage(pid_t pid, const image &im, uint64_t linkaddr);

Reply via email to