pmc gcc fixups

Fix the build of lib/libpmc and usr.sbin/pmc for gcc on amd64.

Reviewed by:    mmacy
Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D15723
This commit is contained in:
Ryan Libby 2018-06-11 16:09:54 +00:00
parent 93ed9ab20b
commit 2ef5e36473
3 changed files with 6 additions and 5 deletions

View File

@ -7,6 +7,7 @@ SRCS= libpmc.c pmclog.c libpmc_pmu_util.c libpmc_json.cc
INCS= pmc.h pmclog.h pmcformat.h
CFLAGS+= -I${.CURDIR}
CWARNFLAGS.gcc+= -Wno-shadow
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"

View File

@ -5,7 +5,8 @@
.include <src.opts.mk>
PROG_CXX= pmc
MAN=
CXXFLAGS+= -O0
CXXFLAGS+= -O0 -std=c++14
CWARNFLAGS.gcc+= -Wno-redundant-decls
LIBADD= kvm pmc m ncursesw pmcstat elf

View File

@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$");
#include <libpmcstat.h>
#include "cmd_pmc.h"
#include <iostream>
#include <string>
#include <unordered_map>
@ -182,11 +181,11 @@ static void
pmc_log_event(int fd, struct pmclog_ev *ev, bool json)
{
int len;
void *buf;
const void *buf;
if (json) {
string ret = event_to_json(ev);
buf = (void*)ret.c_str();
buf = ret.c_str();
len = ret.size();
} else {
len = ev->pl_len;
@ -233,7 +232,7 @@ pmc_filter_handler(uint32_t *lwplist, int lwpcount, uint32_t *pidlist, int pidco
pmclog_close(ps);
if ((ps = static_cast < struct pmclog_parse_state *>(pmclog_open(infd)))== NULL)
errx(EX_OSERR, "ERROR: Cannot allocate pmclog parse state: %s\n", strerror(errno));
if ((pe = (typeof(pe)) malloc(sizeof(*pe) * pmccount)) == NULL)
if ((pe = (struct pmcid_ent *) malloc(sizeof(*pe) * pmccount)) == NULL)
errx(EX_OSERR, "ERROR: failed to allocate pmcid map");
i = 0;
while (pmclog_read(ps, &ev) == 0 && i < pmccount) {