From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: gprof: remove use of PTR
Date: Tue, 10 May 2022 11:20:18 +0930 [thread overview]
Message-ID: <YnnE2td1LHK2dG9u@squeak.grove.modra.org> (raw)
In-Reply-To: <YnnEsUxLRefYHm8x@squeak.grove.modra.org>
* basic_blocks.c: Replace uses of PTR with void * throughout.
* cg_arcs.c: Likewise.
* cg_print.c: Likewise.
* hist.c: Likewise.
* source.h: Likewise.
* symtab.c: Likewise.
diff --git a/gprof/basic_blocks.c b/gprof/basic_blocks.c
index 8ef40106cc6..782a2829c52 100644
--- a/gprof/basic_blocks.c
+++ b/gprof/basic_blocks.c
@@ -33,10 +33,10 @@
#include "symtab.h"
#include "sym_ids.h"
-static int cmp_bb (const PTR, const PTR);
-static int cmp_ncalls (const PTR, const PTR);
+static int cmp_bb (const void *, const void *);
+static int cmp_ncalls (const void *, const void *);
static void fskip_string (FILE *);
-static void annotate_with_count (char *, unsigned int, int, PTR);
+static void annotate_with_count (char *, unsigned int, int, void *);
/* Default option values: */
bool bb_annotate_all_lines = false;
@@ -53,7 +53,7 @@ static long num_lines_executed;
number, and address (in that order). */
static int
-cmp_bb (const PTR lp, const PTR rp)
+cmp_bb (const void *lp, const void *rp)
{
int r;
const Sym *left = *(const Sym **) lp;
@@ -82,7 +82,7 @@ cmp_bb (const PTR lp, const PTR rp)
/* Helper for sorting. Order basic blocks in decreasing number of
calls, ties are broken in increasing order of line numbers. */
static int
-cmp_ncalls (const PTR lp, const PTR rp)
+cmp_ncalls (const void *lp, const void *rp)
{
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
@@ -317,7 +317,7 @@ print_exec_counts (void)
that starts the basic-block. */
static void
-annotate_with_count (char *buf, unsigned int width, int line_num, PTR arg)
+annotate_with_count (char *buf, unsigned int width, int line_num, void *arg)
{
Source_File *sf = (Source_File *) arg;
Sym *b;
diff --git a/gprof/cg_arcs.c b/gprof/cg_arcs.c
index 77534ae78e8..e76c2cb78cf 100644
--- a/gprof/cg_arcs.c
+++ b/gprof/cg_arcs.c
@@ -38,13 +38,13 @@
#include "utils.h"
#include "sym_ids.h"
-static int cmp_topo (const PTR, const PTR);
+static int cmp_topo (const void *, const void *);
static void propagate_time (Sym *);
static void cycle_time (void);
static void cycle_link (void);
static void inherit_flags (Sym *);
static void propagate_flags (Sym **);
-static int cmp_total (const PTR, const PTR);
+static int cmp_total (const void *, const void *);
Sym *cycle_header;
unsigned int num_cycles;
@@ -151,7 +151,7 @@ arc_add (Sym *parent, Sym *child, unsigned long count)
static int
-cmp_topo (const PTR lp, const PTR rp)
+cmp_topo (const void *lp, const void *rp)
{
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
@@ -535,7 +535,7 @@ propagate_flags (Sym **symbols)
* first. All else being equal, compare by names.
*/
static int
-cmp_total (const PTR lp, const PTR rp)
+cmp_total (const void *lp, const void *rp)
{
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
diff --git a/gprof/cg_print.c b/gprof/cg_print.c
index ca71ba44aa2..9ebe171cc56 100644
--- a/gprof/cg_print.c
+++ b/gprof/cg_print.c
@@ -47,9 +47,9 @@ static void print_parents (Sym *);
static void sort_children (Sym *);
static void print_children (Sym *);
static void print_line (Sym *);
-static int cmp_name (const PTR, const PTR);
-static int cmp_arc_count (const PTR, const PTR);
-static int cmp_fun_nuses (const PTR, const PTR);
+static int cmp_name (const void *, const void *);
+static int cmp_arc_count (const void *, const void *);
+static int cmp_fun_nuses (const void *, const void *);
static void order_and_dump_functions_by_arcs
(Arc **, unsigned long, int, Arc **, unsigned long *);
@@ -551,7 +551,7 @@ cg_print (Sym ** timesortsym)
static int
-cmp_name (const PTR left, const PTR right)
+cmp_name (const void *left, const void *right)
{
const Sym **npp1 = (const Sym **) left;
const Sym **npp2 = (const Sym **) right;
@@ -675,7 +675,7 @@ cg_print_index (void)
We want to sort in descending order. */
static int
-cmp_arc_count (const PTR left, const PTR right)
+cmp_arc_count (const void *left, const void *right)
{
const Arc **npp1 = (const Arc **) left;
const Arc **npp2 = (const Arc **) right;
@@ -692,7 +692,7 @@ cmp_arc_count (const PTR left, const PTR right)
We want to sort in descending order. */
static int
-cmp_fun_nuses (const PTR left, const PTR right)
+cmp_fun_nuses (const void *left, const void *right)
{
const Sym **npp1 = (const Sym **) left;
const Sym **npp2 = (const Sym **) right;
diff --git a/gprof/hist.c b/gprof/hist.c
index 141a962865f..91a0d32a7a1 100644
--- a/gprof/hist.c
+++ b/gprof/hist.c
@@ -39,7 +39,7 @@
static void scale_and_align_entries (void);
static void print_header (int);
static void print_line (Sym *, double);
-static int cmp_time (const PTR, const PTR);
+static int cmp_time (const void *, const void *);
/* Declarations of automatically generated functions to output blurbs. */
extern void flat_blurb (FILE * fp);
@@ -535,7 +535,7 @@ print_line (Sym *sym, double scale)
lexicographic order of the function names. */
static int
-cmp_time (const PTR lp, const PTR rp)
+cmp_time (const void *lp, const void *rp)
{
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
diff --git a/gprof/source.h b/gprof/source.h
index 2606581c65f..5eece6bb46c 100644
--- a/gprof/source.h
+++ b/gprof/source.h
@@ -58,6 +58,6 @@ extern Source_File *source_file_lookup_name (const char *);
is not stdout, it should be closed when done with it. */
extern FILE *annotate_source
(Source_File *sf, unsigned int max_width,
- void (*annote) (char *, unsigned int, int, PTR arg),
- PTR arg);
+ void (*annote) (char *, unsigned int, int, void *),
+ void *arg);
#endif /* source_h */
diff --git a/gprof/symtab.c b/gprof/symtab.c
index ff4c18e6616..807f4b7fe94 100644
--- a/gprof/symtab.c
+++ b/gprof/symtab.c
@@ -26,7 +26,7 @@
#include "cg_arcs.h"
#include "corefile.h"
-static int cmp_addr (const PTR, const PTR);
+static int cmp_addr (const void *, const void *);
Sym_Table symtab;
@@ -58,7 +58,7 @@ sym_init (Sym *sym)
the global symbol survives. */
static int
-cmp_addr (const PTR lp, const PTR rp)
+cmp_addr (const void *lp, const void *rp)
{
const Sym *left = (const Sym *) lp;
const Sym *right = (const Sym *) rp;
--
Alan Modra
Australia Development Lab, IBM
prev parent reply other threads:[~2022-05-10 1:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-09 8:49 Do we support Not ANSI C compiler? Martin Liška
2022-05-09 9:22 ` Pedro Alves
2022-05-09 12:01 ` Martin Liška
2022-05-10 1:44 ` Alan Modra
2022-05-10 1:47 ` bfd: remove use of PTR Alan Modra
2022-05-10 1:49 ` opcodes: " Alan Modra
2022-05-10 1:49 ` gas: " Alan Modra
2022-05-10 1:50 ` Alan Modra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YnnE2td1LHK2dG9u@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).