summaryrefslogtreecommitdiff
path: root/usr.bin/gprof
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2020-04-06 23:28:24 +0000
committerKyle Evans <kevans@FreeBSD.org>2020-04-06 23:28:24 +0000
commita86ddfe8c760be83b1322fe8ba3a3568421adb1f (patch)
treeaa7019fe2563345738573361cc0960bab76db543 /usr.bin/gprof
parent76fd19b0a2a878e70c0fa789165d91e944cf42b2 (diff)
downloadsrc-test-a86ddfe8c760be83b1322fe8ba3a3568421adb1f.tar.gz
src-test-a86ddfe8c760be83b1322fe8ba3a3568421adb1f.zip
mail/gprof/tip: tap with the ugly stick
The ugly stick here is this bit in the respective headers: #ifndef EXTERN #define EXTERN extern #endif with a follow-up #define EXTERN in a single .c file to push all of their definitions into one spot. A pass should be made over these three later to push these definitions into the correct files instead, but this will suffice for now and at a more leisurely pace. MFC after: 3 days
Notes
Notes: svn path=/head/; revision=359680
Diffstat (limited to 'usr.bin/gprof')
-rw-r--r--usr.bin/gprof/gprof.c1
-rw-r--r--usr.bin/gprof/gprof.h97
2 files changed, 53 insertions, 45 deletions
diff --git a/usr.bin/gprof/gprof.c b/usr.bin/gprof/gprof.c
index 4970792f0502b..8e1b0709229a9 100644
--- a/usr.bin/gprof/gprof.c
+++ b/usr.bin/gprof/gprof.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <stdint.h>
#include <string.h>
+#define EXTERN
#include "gprof.h"
static int valcmp(const void *, const void *);
diff --git a/usr.bin/gprof/gprof.h b/usr.bin/gprof/gprof.h
index f687ad82bad3d..1677b3f7a8fb2 100644
--- a/usr.bin/gprof/gprof.h
+++ b/usr.bin/gprof/gprof.h
@@ -75,18 +75,22 @@ typedef int bool;
*/
#define HISTORICAL_SCALE_2 2
+#ifndef EXTERN
+#define EXTERN extern
+#endif
+
/*
* ticks per second
*/
-long hz;
+EXTERN long hz;
-size_t histcounter_size;
-int histcounter_type;
+EXTERN size_t histcounter_size;
+EXTERN int histcounter_type;
-char *a_outname;
+EXTERN char *a_outname;
#define A_OUTNAME "a.out"
-char *gmonname;
+EXTERN char *gmonname;
#define GMONSUM "gmon.sum"
/*
@@ -146,9 +150,9 @@ struct nl {
};
typedef struct nl nltype;
-nltype *nl; /* the whole namelist */
-nltype *npe; /* the virtual end of the namelist */
-int nname; /* the number of function names */
+EXTERN nltype *nl; /* the whole namelist */
+EXTERN nltype *npe; /* the virtual end of the namelist */
+EXTERN int nname; /* the number of function names */
#define HASCYCLEXIT 0x08 /* node has arc exiting from cycle */
#define CYCLEHEAD 0x10 /* node marked as head of a cycle */
@@ -167,9 +171,9 @@ struct cl {
};
typedef struct cl cltype;
-arctype *archead; /* the head of arcs in current cycle list */
-cltype *cyclehead; /* the head of the list */
-int cyclecnt; /* the number of cycles found */
+EXTERN arctype *archead; /* the head of arcs in current cycle list */
+EXTERN cltype *cyclehead; /* the head of the list */
+EXTERN int cyclecnt; /* the number of cycles found */
#define CYCLEMAX 100 /* maximum cycles before cutting one of them */
/*
@@ -183,8 +187,8 @@ int cyclecnt; /* the number of cycles found */
* namelist entries for cycle headers.
* the number of discovered cycles.
*/
-nltype *cyclenl; /* cycle header namelist */
-int ncycle; /* number of cycles discovered */
+EXTERN nltype *cyclenl; /* cycle header namelist */
+EXTERN int ncycle; /* number of cycles discovered */
/*
* The header on the gmon.out file.
@@ -200,43 +204,46 @@ struct ophdr {
int ncnt;
};
-int debug;
+EXTERN int debug;
/*
* Each discretized pc sample has
* a count of the number of samples in its range
*/
-double *samples;
+EXTERN double *samples;
-unsigned long s_lowpc; /* lowpc from the profile file */
-unsigned long s_highpc; /* highpc from the profile file */
-unsigned long lowpc, highpc; /* range profiled, in historical units */
-unsigned sampbytes; /* number of bytes of samples */
-int nsamples; /* number of samples */
-double actime; /* accumulated time thus far for putprofline */
-double totime; /* total time for all routines */
-double printtime; /* total of time being printed */
-double scale; /* scale factor converting samples to pc
+EXTERN unsigned long s_lowpc; /* lowpc from the profile file */
+EXTERN unsigned long s_highpc; /* highpc from the profile file */
+/* range profiled, in historical units */
+EXTERN unsigned long lowpc, highpc;
+EXTERN unsigned sampbytes; /* number of bytes of samples */
+EXTERN int nsamples; /* number of samples */
+/* accumulated time thus far for putprofline */
+EXTERN double actime;
+EXTERN double totime; /* total time for all routines */
+EXTERN double printtime; /* total of time being printed */
+EXTERN double scale; /* scale factor converting samples to pc
values: each sample covers scale bytes */
-unsigned char *textspace; /* text space of a.out in core */
-int cyclethreshold; /* with -C, minimum cycle size to ignore */
+EXTERN unsigned char *textspace; /* text space of a.out in core */
+/* with -C, minimum cycle size to ignore */
+EXTERN int cyclethreshold;
/*
* option flags, from a to z.
*/
-bool aflag; /* suppress static functions */
-bool bflag; /* blurbs, too */
-bool Cflag; /* find cut-set to eliminate cycles */
-bool dflag; /* debugging options */
-bool eflag; /* specific functions excluded */
-bool Eflag; /* functions excluded with time */
-bool fflag; /* specific functions requested */
-bool Fflag; /* functions requested with time */
-bool kflag; /* arcs to be deleted */
-bool Kflag; /* use the running kernel for symbols */
-bool sflag; /* sum multiple gmon.out files */
-bool uflag; /* suppress symbols hidden from C */
-bool zflag; /* zero time/called functions, too */
+EXTERN bool aflag; /* suppress static functions */
+EXTERN bool bflag; /* blurbs, too */
+EXTERN bool Cflag; /* find cut-set to eliminate cycles */
+EXTERN bool dflag; /* debugging options */
+EXTERN bool eflag; /* specific functions excluded */
+EXTERN bool Eflag; /* functions excluded with time */
+EXTERN bool fflag; /* specific functions requested */
+EXTERN bool Fflag; /* functions requested with time */
+EXTERN bool kflag; /* arcs to be deleted */
+EXTERN bool Kflag; /* use the running kernel for symbols */
+EXTERN bool sflag; /* sum multiple gmon.out files */
+EXTERN bool uflag; /* suppress symbols hidden from C */
+EXTERN bool zflag; /* zero time/called functions, too */
/*
* structure for various string lists
@@ -245,12 +252,12 @@ struct stringlist {
struct stringlist *next;
char *string;
};
-struct stringlist *elist;
-struct stringlist *Elist;
-struct stringlist *flist;
-struct stringlist *Flist;
-struct stringlist *kfromlist;
-struct stringlist *ktolist;
+extern struct stringlist *elist;
+extern struct stringlist *Elist;
+extern struct stringlist *flist;
+extern struct stringlist *Flist;
+extern struct stringlist *kfromlist;
+extern struct stringlist *ktolist;
/*
* function declarations