diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index f40ba3b28271..d515f25d4c99 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -6,9 +6,6 @@ LIB= pmc 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 -Wno-cast-align - .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" .if ${MACHINE_ARCH} == "aarch64" @@ -31,6 +28,11 @@ libpmc_events.c: ${JEVENTS} SRCS+= libpmc_events.c .endif +WARNS?= 3 + +CFLAGS+= -I${.CURDIR} +CWARNFLAGS.gcc+= -Wno-shadow -Wno-cast-align + MAN= pmc.3 MAN+= pmc_allocate.3 MAN+= pmc_attach.3 diff --git a/lib/libpmc/Makefile.inc b/lib/libpmc/Makefile.inc new file mode 100644 index 000000000000..1b7d7d41c4c6 --- /dev/null +++ b/lib/libpmc/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +WARNS?= 3 diff --git a/lib/libpmc/libpmc_json.cc b/lib/libpmc/libpmc_json.cc index 6581fa6985d6..0a4a8d68a540 100644 --- a/lib/libpmc/libpmc_json.cc +++ b/lib/libpmc/libpmc_json.cc @@ -29,19 +29,21 @@ */ #include -#include #include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include #include #include + +#include #include +#include using std::string; diff --git a/lib/libpmc/pmu-events/jevents.c b/lib/libpmc/pmu-events/jevents.c index c59780e3d59e..e5e81d208857 100644 --- a/lib/libpmc/pmu-events/jevents.c +++ b/lib/libpmc/pmu-events/jevents.c @@ -1,5 +1,3 @@ -#define _XOPEN_SOURCE 500 /* needed for nftw() */ -#define __BSD_VISIBLE 1 /* needed for asprintf() */ /* Parse event JSON files */ /* @@ -33,22 +31,22 @@ * */ - +#include +#include /* getrlimit */ +#include +#include /* getrlimit */ +#include +#include +#include +#include +#include +#include #include #include #include -#include #include -#include #include -#include -#include -#include -#include -#include /* getrlimit */ -#include /* getrlimit */ #include -#include #include "list.h" #include "jsmn.h" #include "json.h" @@ -641,7 +639,7 @@ int json_events(const char *fn, addfield(map, &extra_desc, " ", "(Precise event)", NULL); } - snprintf(buf, sizeof buf, "event=%#llx", eventcode); + snprintf(buf, sizeof(buf), "event=%#llx", eventcode); addfield(map, &event, ",", buf, NULL); if (desc && extra_desc) addfield(map, &desc, " ", extra_desc, NULL); @@ -866,7 +864,7 @@ static int get_maxfds(void) if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { if (rlim.rlim_max == RLIM_INFINITY) return 512; - return min((unsigned)rlim.rlim_max / 2, 512); + return MIN(rlim.rlim_max / 2, 512); } return 512; diff --git a/lib/libpmc/pmu-events/jevents.h b/lib/libpmc/pmu-events/jevents.h index cd3d1c19021b..637d3c36128c 100644 --- a/lib/libpmc/pmu-events/jevents.h +++ b/lib/libpmc/pmu-events/jevents.h @@ -11,12 +11,4 @@ int json_events(const char *fn, void *data); char *get_cpu_str(void); -#ifndef min -#define min(x, y) ({ \ - typeof(x) _min1 = (x); \ - typeof(y) _min2 = (y); \ - (void) (&_min1 == &_min2); \ - _min1 < _min2 ? _min1 : _min2; }) -#endif - #endif