Use bool in gprof

* basic_blocks.c: Replace bfd_boolean with bool, FALSE with false,
	and TRUE with true throughout.
	* basic_blocks.h: Likewise.
	* cg_arcs.c: Likewise.
	* cg_dfn.c: Likewise.
	* cg_print.c: Likewise.
	* corefile.c: Likewise.
	* gmon_io.c: Likewise.
	* gprof.c: Likewise.
	* gprof.h: Likewise.
	* hist.c: Likewise.
	* mips.c: Likewise.
	* source.c: Likewise.
	* source.h: Likewise.
	* sym_ids.c: Likewise.
	* sym_ids.h: Likewise.
	* symtab.h: Likewise.
	* vax.c: Likewise.
This commit is contained in:
Alan Modra 2021-03-31 10:29:52 +10:30
parent 9193bc4285
commit faa7a26040
18 changed files with 120 additions and 98 deletions

View File

@ -1,3 +1,24 @@
2021-03-31 Alan Modra <amodra@gmail.com>
* basic_blocks.c: Replace bfd_boolean with bool, FALSE with false,
and TRUE with true throughout.
* basic_blocks.h: Likewise.
* cg_arcs.c: Likewise.
* cg_dfn.c: Likewise.
* cg_print.c: Likewise.
* corefile.c: Likewise.
* gmon_io.c: Likewise.
* gprof.c: Likewise.
* gprof.h: Likewise.
* hist.c: Likewise.
* mips.c: Likewise.
* source.c: Likewise.
* source.h: Likewise.
* sym_ids.c: Likewise.
* sym_ids.h: Likewise.
* symtab.h: Likewise.
* vax.c: Likewise.
2021-01-13 Alan Modra <amodra@gmail.com>
* Makefile.in: Regenerate.

View File

@ -39,7 +39,7 @@ static void fskip_string (FILE *);
static void annotate_with_count (char *, unsigned int, int, PTR);
/* Default option values: */
bfd_boolean bb_annotate_all_lines = FALSE;
bool bb_annotate_all_lines = false;
unsigned long bb_min_calls = 1;
int bb_table_length = 10;
@ -144,8 +144,8 @@ bb_read_rec (FILE *ifp, const char *filename)
care about anymore. */
if ((fread (&ncalls, sizeof (ncalls), 1, ifp) != 1)
|| (fread (&addr, sizeof (addr), 1, ifp) != 1)
|| (fskip_string (ifp), FALSE)
|| (fskip_string (ifp), FALSE)
|| (fskip_string (ifp), false)
|| (fskip_string (ifp), false)
|| (fread (&line_num, sizeof (line_num), 1, ifp) != 1))
{
perror (filename);
@ -187,11 +187,11 @@ bb_read_rec (FILE *ifp, const char *filename)
}
else
{
static bfd_boolean user_warned = FALSE;
static bool user_warned = false;
if (!user_warned)
{
user_warned = TRUE;
user_warned = true;
fprintf (stderr,
_("%s: warning: ignoring basic-block exec counts (use -l or --line)\n"),
whoami);
@ -254,7 +254,7 @@ print_exec_counts (void)
unsigned int i, j, len;
if (first_output)
first_output = FALSE;
first_output = false;
else
printf ("\f\n");

View File

@ -22,7 +22,7 @@
#define basic_blocks_h
/* Options: */
extern bfd_boolean bb_annotate_all_lines; /* Force annotation of all lines? */
extern bool bb_annotate_all_lines; /* Force annotation of all lines? */
extern int bb_table_length; /* Length of most-used bb table. */
extern unsigned long bb_min_calls; /* Minimum execution count. */

View File

@ -308,7 +308,7 @@ cycle_link (void)
++num;
++cyc;
sym_init (cyc);
cyc->cg.print_flag = TRUE; /* should this be printed? */
cyc->cg.print_flag = true; /* should this be printed? */
cyc->cg.top_order = DFN_NAN; /* graph call chain top-sort order */
cyc->cg.cyc.num = num; /* internal number of cycle on */
cyc->cg.cyc.head = cyc; /* pointer to head of cycle */
@ -366,7 +366,7 @@ inherit_flags (Sym *child)
if (child == head)
{
/* just a regular child, check its parents: */
child->cg.print_flag = FALSE;
child->cg.print_flag = false;
child->cg.prop.fract = 0.0;
for (arc = child->cg.parents; arc; arc = arc->next_parent)
{
@ -394,7 +394,7 @@ inherit_flags (Sym *child)
* Its a member of a cycle, look at all parents from outside
* the cycle.
*/
head->cg.print_flag = FALSE;
head->cg.print_flag = false;
head->cg.prop.fract = 0.0;
for (member = head->cg.cyc.next; member; member = member->cg.cyc.next)
{
@ -471,7 +471,7 @@ propagate_flags (Sym **symbols)
|| (syms[INCL_GRAPH].len == 0
&& !sym_lookup (&syms[EXCL_GRAPH], child->addr)))
{
child->cg.print_flag = TRUE;
child->cg.print_flag = true;
}
}
else
@ -484,7 +484,7 @@ propagate_flags (Sym **symbols)
if (!sym_lookup (&syms[INCL_GRAPH], child->addr)
&& sym_lookup (&syms[EXCL_GRAPH], child->addr))
{
child->cg.print_flag = FALSE;
child->cg.print_flag = false;
}
}
if (child->cg.prop.fract == 0.0)
@ -617,7 +617,7 @@ cg_assemble (void)
parent->cg.prop.fract = 0.0;
parent->cg.prop.self = 0.0;
parent->cg.prop.child = 0.0;
parent->cg.print_flag = FALSE;
parent->cg.print_flag = false;
parent->cg.top_order = DFN_NAN;
parent->cg.cyc.num = 0;
parent->cg.cyc.head = parent;

View File

@ -44,8 +44,8 @@ typedef struct
}
DFN_Stack;
static bfd_boolean is_numbered (Sym *);
static bfd_boolean is_busy (Sym *);
static bool is_numbered (Sym *);
static bool is_busy (Sym *);
static void find_cycle (Sym *);
static void pre_visit (Sym *);
static void post_visit (Sym *);
@ -59,7 +59,7 @@ int dfn_counter = DFN_NAN;
/*
* Is CHILD already numbered?
*/
static bfd_boolean
static bool
is_numbered (Sym *child)
{
return child->cg.top_order != DFN_NAN && child->cg.top_order != DFN_BUSY;
@ -69,14 +69,14 @@ is_numbered (Sym *child)
/*
* Is CHILD already busy?
*/
static bfd_boolean
static bool
is_busy (Sym *child)
{
if (child->cg.top_order == DFN_NAN)
{
return FALSE;
return false;
}
return TRUE;
return true;
}

View File

@ -64,7 +64,7 @@ static void
print_header (void)
{
if (first_output)
first_output = FALSE;
first_output = false;
else
printf ("\f\n");

View File

@ -45,7 +45,7 @@ unsigned int symbol_map_count;
static void read_function_mappings (const char *);
static int core_sym_class (asymbol *);
static bfd_boolean get_src_info
static bool get_src_info
(bfd_vma, const char **, const char **, int *);
extern void i386_find_call (Sym *, bfd_vma, bfd_vma);
@ -332,7 +332,7 @@ find_call (Sym *parent, bfd_vma p_lowpc, bfd_vma p_highpc)
whoami, bfd_printable_name(core_bfd));
/* Don't give the error more than once. */
ignore_direct_calls = FALSE;
ignore_direct_calls = false;
}
}
@ -453,8 +453,9 @@ core_sym_class (asymbol *sym)
/* Get whatever source info we can get regarding address ADDR. */
static bfd_boolean
get_src_info (bfd_vma addr, const char **filename, const char **name, int *line_num)
static bool
get_src_info (bfd_vma addr, const char **filename, const char **name,
int *line_num)
{
const char *fname = 0, *func_name = 0;
int l = 0;
@ -469,7 +470,7 @@ get_src_info (bfd_vma addr, const char **filename, const char **name, int *line_
*filename = fname;
*name = func_name;
*line_num = l;
return TRUE;
return true;
}
else
{
@ -477,7 +478,7 @@ get_src_info (bfd_vma addr, const char **filename, const char **name, int *line_
(unsigned long) addr,
fname ? fname : "<unknown>", l,
func_name ? func_name : "<unknown>"));
return FALSE;
return false;
}
}
@ -564,8 +565,8 @@ core_create_syms_from (const char * sym_table_file)
symtab.limit->name = (char *) xmalloc (strlen (name) + 1);
strcpy ((char *) symtab.limit->name, name);
symtab.limit->mapped = 0;
symtab.limit->is_func = TRUE;
symtab.limit->is_bb_head = TRUE;
symtab.limit->is_func = true;
symtab.limit->is_bb_head = true;
symtab.limit->is_static = (type == 't');
min_vma = MIN (symtab.limit->addr, min_vma);
max_vma = MAX (symtab.limit->addr, max_vma);
@ -724,10 +725,10 @@ core_create_function_syms (void)
symtab.limit->is_func = (!core_has_func_syms
|| (core_syms[i]->flags & BSF_FUNCTION) != 0);
symtab.limit->is_bb_head = TRUE;
symtab.limit->is_bb_head = true;
if (cxxclass == 't')
symtab.limit->is_static = TRUE;
symtab.limit->is_static = true;
/* Keep track of the minimum and maximum vma addresses used by all
symbols. When computing the max_vma, use the ending address of the

View File

@ -586,7 +586,7 @@ gmon_out_read (const char *filename)
printf (nbbs == 1 ?
_("\t%d basic-block count record\n") :
_("\t%d basic-block count records\n"), nbbs);
first_output = FALSE;
first_output = false;
}
}

View File

@ -59,19 +59,19 @@ long hz = HZ_WRONG;
int debug_level = 0;
int output_style = 0;
int output_width = 80;
bfd_boolean bsd_style_output = FALSE;
bfd_boolean demangle = TRUE;
bfd_boolean ignore_direct_calls = FALSE;
bfd_boolean ignore_static_funcs = FALSE;
bfd_boolean ignore_zeros = TRUE;
bfd_boolean line_granularity = FALSE;
bfd_boolean print_descriptions = TRUE;
bfd_boolean print_path = FALSE;
bfd_boolean ignore_non_functions = FALSE;
bfd_boolean inline_file_names = FALSE;
bool bsd_style_output = false;
bool demangle = true;
bool ignore_direct_calls = false;
bool ignore_static_funcs = false;
bool ignore_zeros = true;
bool line_granularity = false;
bool print_descriptions = true;
bool print_path = false;
bool ignore_non_functions = false;
bool inline_file_names = false;
File_Format file_format = FF_AUTO;
bfd_boolean first_output = TRUE;
bool first_output = true;
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
@ -211,7 +211,7 @@ main (int argc, char **argv)
switch (ch)
{
case 'a':
ignore_static_funcs = TRUE;
ignore_static_funcs = true;
break;
case 'A':
if (optarg)
@ -222,14 +222,14 @@ main (int argc, char **argv)
user_specified |= STYLE_ANNOTATED_SOURCE;
break;
case 'b':
print_descriptions = FALSE;
print_descriptions = false;
break;
case 'B':
output_style |= STYLE_CALL_GRAPH;
user_specified |= STYLE_CALL_GRAPH;
break;
case 'c':
ignore_direct_calls = TRUE;
ignore_direct_calls = true;
break;
case 'C':
if (optarg)
@ -255,7 +255,7 @@ main (int argc, char **argv)
#endif /* DEBUG */
break;
case 'D':
ignore_non_functions = TRUE;
ignore_non_functions = true;
break;
case 'E':
sym_id_add (optarg, EXCL_TIME);
@ -304,10 +304,10 @@ main (int argc, char **argv)
sym_id_add (optarg, EXCL_ARCS);
break;
case 'l':
line_granularity = TRUE;
line_granularity = true;
break;
case 'L':
print_path = TRUE;
print_path = true;
break;
case 'm':
bb_min_calls = (unsigned long) strtoul (optarg, (char **) NULL, 10);
@ -421,7 +421,7 @@ main (int argc, char **argv)
}
break;
case 'T':
bsd_style_output = TRUE;
bsd_style_output = true;
break;
case 'v':
/* This output is intended to follow the GNU standards document. */
@ -438,13 +438,13 @@ This program is free software. This program has absolutely no warranty.\n"));
}
break;
case 'x':
bb_annotate_all_lines = TRUE;
bb_annotate_all_lines = true;
break;
case 'y':
create_annotation_files = TRUE;
create_annotation_files = true;
break;
case 'z':
ignore_zeros = FALSE;
ignore_zeros = false;
break;
case 'Z':
if (optarg)
@ -459,7 +459,7 @@ This program is free software. This program has absolutely no warranty.\n"));
user_specified |= STYLE_EXEC_COUNTS;
break;
case OPTION_DEMANGLE:
demangle = TRUE;
demangle = true;
if (optarg != NULL)
{
enum demangling_styles style;
@ -477,10 +477,10 @@ This program is free software. This program has absolutely no warranty.\n"));
}
break;
case OPTION_NO_DEMANGLE:
demangle = FALSE;
demangle = false;
break;
case OPTION_INLINE_FILE_NAMES:
inline_file_names = TRUE;
inline_file_names = true;
break;
default:
usage (stderr, 1);

View File

@ -117,20 +117,20 @@ extern long hz; /* ticks per second */
extern int debug_level; /* debug level */
extern int output_style;
extern int output_width; /* controls column width in index */
extern bfd_boolean bsd_style_output; /* as opposed to FSF style output */
extern bfd_boolean demangle; /* demangle symbol names? */
extern bfd_boolean ignore_direct_calls; /* don't count direct calls */
extern bfd_boolean ignore_static_funcs; /* suppress static functions */
extern bfd_boolean ignore_zeros; /* ignore unused symbols/files */
extern bfd_boolean line_granularity; /* function or line granularity? */
extern bfd_boolean print_descriptions; /* output profile description */
extern bfd_boolean print_path; /* print path or just filename? */
extern bfd_boolean ignore_non_functions; /* Ignore non-function symbols. */
extern bfd_boolean inline_file_names; /* print file names after symbols */
extern bool bsd_style_output; /* as opposed to FSF style output */
extern bool demangle; /* demangle symbol names? */
extern bool ignore_direct_calls; /* don't count direct calls */
extern bool ignore_static_funcs; /* suppress static functions */
extern bool ignore_zeros; /* ignore unused symbols/files */
extern bool line_granularity; /* function or line granularity? */
extern bool print_descriptions; /* output profile description */
extern bool print_path; /* print path or just filename? */
extern bool ignore_non_functions; /* Ignore non-function symbols. */
extern bool inline_file_names; /* print file names after symbols */
extern File_Format file_format; /* requested file format */
extern bfd_boolean first_output; /* no output so far? */
extern bool first_output; /* no output so far? */
extern void done (int status) ATTRIBUTE_NORETURN;

View File

@ -571,7 +571,7 @@ hist_print (void)
bfd_vma addr;
if (first_output)
first_output = FALSE;
first_output = false;
else
printf ("\f\n");

View File

@ -45,11 +45,11 @@ mips_find_call (Sym *parent, bfd_vma p_lowpc, bfd_vma p_highpc)
unsigned int op;
int offset;
Sym *child;
static bfd_boolean inited = FALSE;
static bool inited = false;
if (!inited)
{
inited = TRUE;
inited = true;
sym_init (&indirect_child);
indirect_child.name = _("<indirect child>");
indirect_child.cg.prop.fract = 1.0;

View File

@ -28,7 +28,7 @@
#define EXT_ANNO "-ann" /* Postfix of annotated files. */
/* Default option values. */
bfd_boolean create_annotation_files = FALSE;
bool create_annotation_files = false;
Search_List src_search_list = {0, 0};
Source_File *first_src_file = 0;
@ -93,9 +93,9 @@ annotate_source (Source_File *sf, unsigned int max_width,
void (*annote) (char *, unsigned int, int, void *),
void *arg)
{
static bfd_boolean first_file = TRUE;
static bool first_file = true;
int i, line_num, nread;
bfd_boolean new_line;
bool new_line;
char buf[8192];
char fname[PATH_MAX];
char *annotation, *name_only;
@ -110,7 +110,7 @@ annotate_source (Source_File *sf, unsigned int max_width,
sle = 0; /* Don't use search list for absolute paths. */
name_only = 0;
while (TRUE)
while (true)
{
DBG (SRCDEBUG, printf ("[annotate_source]: looking for %s, trying %s\n",
sf->name, fname));
@ -225,12 +225,12 @@ annotate_source (Source_File *sf, unsigned int max_width,
if (ofp == stdout)
{
if (first_file)
first_file = FALSE;
first_file = false;
else
fputc ('\n', ofp);
if (first_output)
first_output = FALSE;
first_output = false;
else
fprintf (ofp, "\f\n");
@ -239,7 +239,7 @@ annotate_source (Source_File *sf, unsigned int max_width,
annotation = (char *) xmalloc (max_width + 1);
line_num = 1;
new_line = TRUE;
new_line = true;
while ((nread = fread (buf, 1, sizeof (buf), ifp)) > 0)
{

View File

@ -36,7 +36,7 @@ Source_File;
/* Options. */
/* Create annotated output files? */
extern bfd_boolean create_annotation_files;
extern bool create_annotation_files;
/* List of directories to search for source files. */
extern Search_List src_search_list;

View File

@ -42,7 +42,7 @@ struct sym_id
struct sym_id *next;
char *spec; /* Parsing modifies this. */
Table_Id which_table;
bfd_boolean has_right;
bool has_right;
struct match left, right;
};
@ -53,10 +53,10 @@ static void parse_spec
(char *, Sym *);
static void parse_id
(struct sym_id *);
static bfd_boolean match
static bool match
(Sym *, Sym *);
static void extend_match
(struct match *, Sym *, Sym_Table *, bfd_boolean);
(struct match *, Sym *, Sym_Table *, bool);
Sym_Table syms[NUM_TABLES];
@ -181,7 +181,7 @@ parse_id (struct sym_id *id)
{
parse_spec (slash + 1, &id->right.sym);
*slash = '\0';
id->has_right = TRUE;
id->has_right = true;
}
parse_spec (id->spec, &id->left.sym);
@ -218,27 +218,27 @@ parse_id (struct sym_id *id)
/* Return TRUE iff PATTERN matches SYM. */
static bfd_boolean
static bool
match (Sym *pattern, Sym *sym)
{
if (pattern->file && pattern->file != sym->file)
return FALSE;
return false;
if (pattern->line_num && pattern->line_num != sym->line_num)
return FALSE;
return false;
if (pattern->name)
{
const char *sym_name = sym->name;
if (*sym_name && bfd_get_symbol_leading_char (core_bfd) == *sym_name)
sym_name++;
if (strcmp (pattern->name, sym_name) != 0)
return FALSE;
return false;
}
return TRUE;
return true;
}
static void
extend_match (struct match *m, Sym *sym, Sym_Table *tab, bfd_boolean second_pass)
extend_match (struct match *m, Sym *sym, Sym_Table *tab, bool second_pass)
{
if (m->prev_match != sym - 1)
{
@ -289,10 +289,10 @@ sym_id_parse (void)
for (id = id_list; id; id = id->next)
{
if (match (&id->left.sym, sym))
extend_match (&id->left, sym, &syms[id->which_table], FALSE);
extend_match (&id->left, sym, &syms[id->which_table], false);
if (id->has_right && match (&id->right.sym, sym))
extend_match (&id->right, sym, &right_ids, FALSE);
extend_match (&id->right, sym, &right_ids, false);
}
}
@ -320,10 +320,10 @@ sym_id_parse (void)
for (id = id_list; id; id = id->next)
{
if (match (&id->left.sym, sym))
extend_match (&id->left, sym, &syms[id->which_table], TRUE);
extend_match (&id->left, sym, &syms[id->which_table], true);
if (id->has_right && match (&id->right.sym, sym))
extend_match (&id->right, sym, &right_ids, TRUE);
extend_match (&id->right, sym, &right_ids, true);
}
}
@ -371,7 +371,7 @@ sym_id_parse (void)
time requesting -k a/b. Fortunately, those symbol tables don't get
very big (the user has to type them!), so a linear search is probably
tolerable. */
bfd_boolean
bool
sym_id_arc_is_present (Sym_Table *sym_tab, Sym *from, Sym *to)
{
Sym *sym;
@ -380,8 +380,8 @@ sym_id_arc_is_present (Sym_Table *sym_tab, Sym *from, Sym *to)
{
if (from->addr >= sym->addr && from->addr <= sym->end_addr
&& arc_lookup (sym, to))
return TRUE;
return true;
}
return FALSE;
return false;
}

View File

@ -38,6 +38,6 @@ extern Sym_Table syms[NUM_TABLES];
extern void sym_id_add (const char *, Table_Id);
extern void sym_id_parse (void);
extern bfd_boolean sym_id_arc_is_present (Sym_Table *, Sym *, Sym *);
extern bool sym_id_arc_is_present (Sym_Table *, Sym *, Sym *);
#endif /* sym_ids_h */

View File

@ -78,7 +78,7 @@ typedef struct sym
double child_time; /* Cumulative ticks in children. */
int index; /* Index in the graph list. */
int top_order; /* Graph call chain top-sort order. */
bfd_boolean print_flag; /* Should this be printed? */
bool print_flag; /* Should this be printed? */
struct
{
double fract; /* What % of time propagates. */

View File

@ -237,11 +237,11 @@ vax_find_call (Sym *parent, bfd_vma p_lowpc, bfd_vma p_highpc)
operandenum mode;
operandenum firstmode;
bfd_vma pc, destpc;
static bfd_boolean inited = FALSE;
static bool inited = false;
if (!inited)
{
inited = TRUE;
inited = true;
sym_init (&indirectchild);
indirectchild.cg.prop.fract = 1.0;
indirectchild.cg.cyc.head = &indirectchild;