git: 503f16182e08 - main - pmc(8): add missing headers to not rely on header pollution

Enji Cooper <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a790833.39806.6b2fb8a4__11461.4949956135$1786316870$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by ngie:

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

commit 503f16182e08d58ce17843cf5a71c7dbc27af6b5
Author:     Enji Cooper <[email protected]>
AuthorDate: 2026-08-09 23:05:33 +0000
Commit:     Enji Cooper <[email protected]>
CommitDate: 2026-08-09 23:07:03 +0000

    pmc(8): add missing headers to not rely on header pollution
    
    This mutes a number of complains from g++ about needing specific headers
    for functionality related to C strings and other function prototypes.
    
    Reported by:    g++ 14
---
 usr.sbin/pmc/cmd_pmc_summary.cc | 1 +
 usr.sbin/pmc/display.cc         | 1 +
 usr.sbin/pmc/view.cc            | 1 +
 usr.sbin/pmc/view.hh            | 2 ++
 4 files changed, 5 insertions(+)

diff --git a/usr.sbin/pmc/cmd_pmc_summary.cc b/usr.sbin/pmc/cmd_pmc_summary.cc
index 610c1fee7f0d..c1eb00c28672 100644
--- a/usr.sbin/pmc/cmd_pmc_summary.cc
+++ b/usr.sbin/pmc/cmd_pmc_summary.cc
@@ -65,6 +65,7 @@
 #include <libpmcstat.h>
 #include "cmd_pmc.h"
 
+#include <algorithm>
 #include <iostream>
 #include <string>
 #include <vector>
diff --git a/usr.sbin/pmc/display.cc b/usr.sbin/pmc/display.cc
index 454cb74e29bd..fe0c86336196 100644
--- a/usr.sbin/pmc/display.cc
+++ b/usr.sbin/pmc/display.cc
@@ -42,6 +42,7 @@
 #include <unistd.h>
 
 #include <cxxabi.h>
+#include <cstring>
 #include <iomanip>
 #include <ios>
 #include <iostream>
diff --git a/usr.sbin/pmc/view.cc b/usr.sbin/pmc/view.cc
index 352856939a66..a678c061d490 100644
--- a/usr.sbin/pmc/view.cc
+++ b/usr.sbin/pmc/view.cc
@@ -43,6 +43,7 @@
 #include <unistd.h>
 
 #include <cxxabi.h>
+#include <cstring>
 #include <iostream>
 #include <map>
 #include <set>
diff --git a/usr.sbin/pmc/view.hh b/usr.sbin/pmc/view.hh
index 46b7c49222f0..9a0702c08803 100644
--- a/usr.sbin/pmc/view.hh
+++ b/usr.sbin/pmc/view.hh
@@ -36,6 +36,8 @@
 #include <libutil.h>
 #include <gelf.h>
 
+#include <vector>
+
 #include "headers.hh"
 #include "util.hh"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.