From 04e9feb06c465441db7c4a376480e88bb440414c Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Wed, 20 Apr 2005 20:48:24 +0000 Subject: o Do not include . It's automaticly included for us when is included. o Replace "#if __i386__" and "#if __amd64__" with the equivalent of "#ifdef __i386__" and "#ifdef __amd64__" (resp.) These tokens are not defined on all platforms. o Conditionally compile pmc_parse_mask() on i386 and amd64 only. It's only referenced there. This will change when support for other platforms is added, of course. Ok'd by: jkoshy@ --- lib/libpmc/libpmc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/libpmc/libpmc.c') diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 237641b1bb84..9a465863f5f7 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -32,8 +32,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include #include #include @@ -45,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include /* Function prototypes */ -#if __i386__ +#if defined(__i386__) static int k7_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); static int p6_allocate_pmc(enum pmc_event _pe, char *_ctrspec, @@ -54,7 +52,7 @@ static int p4_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); static int p5_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); -#elif __amd64__ +#elif defined(__amd64__) static int k8_allocate_pmc(enum pmc_event _pe, char *_ctrspec, struct pmc_op_pmcallocate *_pmc_config); #endif @@ -152,6 +150,7 @@ struct pmc_masks { #define PMCMASK(N,V) { .pm_name = #N, .pm_value = (V) } #define NULLMASK PMCMASK(NULL,0) +#if defined(__i386__) || defined(__amd64__) static int pmc_parse_mask(const struct pmc_masks *pmask, char *p, uint32_t *evmask) { @@ -175,12 +174,13 @@ pmc_parse_mask(const struct pmc_masks *pmask, char *p, uint32_t *evmask) } return c; } +#endif #define KWMATCH(p,kw) (strcasecmp((p), (kw)) == 0) #define KWPREFIXMATCH(p,kw) (strncasecmp((p), (kw), sizeof((kw)) - 1) == 0) #define EV_ALIAS(N,S) { .pm_alias = N, .pm_spec = S } -#if __i386__ +#if defined(__i386__) /* * AMD K7 (Athlon) CPUs. @@ -1236,7 +1236,7 @@ p5_allocate_pmc(enum pmc_event pe, char *ctrspec, return -1 || pe || ctrspec || pmc_config; /* shut up gcc */ } -#elif __amd64__ +#elif defined(__amd64__) /* * AMD K8 PMCs. @@ -1634,7 +1634,7 @@ pmc_init(void) /* set parser pointer */ switch (cpu_info.pm_cputype) { -#if __i386__ +#if defined(__i386__) case PMC_CPU_AMD_K7: pmc_mdep_event_aliases = k7_aliases; pmc_mdep_allocate_pmc = k7_allocate_pmc; @@ -1654,7 +1654,7 @@ pmc_init(void) pmc_mdep_event_aliases = p4_aliases; pmc_mdep_allocate_pmc = p4_allocate_pmc; break; -#elif __amd64__ +#elif defined(__amd64__) case PMC_CPU_AMD_K8: pmc_mdep_event_aliases = k8_aliases; pmc_mdep_allocate_pmc = k8_allocate_pmc; @@ -2117,7 +2117,7 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames, * Architecture specific APIs */ -#if __i386__ || __amd64__ +#if defined(__i386__) || defined(__amd64__) int pmc_x86_get_msr(pmc_id_t pmc, uint32_t *msr) -- cgit v1.2.3