[MAKEFILE]: Use -Wall
And fix the warnings generated. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
parent
5b46f10f60
commit
e45f877489
2
Makefile
2
Makefile
|
@ -9,7 +9,7 @@ INSTALL_DATA = ${INSTALL} -m 644
|
|||
CC = gcc
|
||||
LIBS = -ldw -lelf
|
||||
INCLUDES = -I. -I/usr/include/elfutils
|
||||
CFLAGS = -g -O2 $(INCLUDES)
|
||||
CFLAGS = -g -O2 $(INCLUDES) -Wall
|
||||
LDFLAGS = $(LIBS)
|
||||
|
||||
INSTALL = cp
|
||||
|
|
15
classes.c
15
classes.c
|
@ -184,8 +184,8 @@ int class__is_struct(const struct class *self, struct cu *cu,
|
|||
return self->tag == DW_TAG_structure_type;
|
||||
}
|
||||
|
||||
static const uint64_t class__size(const struct class *self,
|
||||
const struct cu *cu)
|
||||
static uint64_t class__size(const struct class *self,
|
||||
const struct cu *cu)
|
||||
{
|
||||
uint64_t size = self->size;
|
||||
|
||||
|
@ -352,7 +352,7 @@ static uint64_t class_member__print(struct class_member *self,
|
|||
class_name = class__name(class, cu, class_name_bf, sizeof(class_name_bf));
|
||||
if (class->tag == DW_TAG_array_type)
|
||||
snprintf(member_name_bf, sizeof(member_name_bf),
|
||||
"%s[%lu];", self->name ?: "",
|
||||
"%s[%llu];", self->name ?: "",
|
||||
class->nr_entries);
|
||||
else if (self->bit_size != 0)
|
||||
snprintf(member_name_bf, sizeof(member_name_bf),
|
||||
|
@ -530,7 +530,6 @@ void class__print_inline_expansions(struct class *self, const struct cu *cu)
|
|||
|
||||
void class__print_variables(struct class *self, const struct cu *cu)
|
||||
{
|
||||
struct class *class_type;
|
||||
struct variable *pos;
|
||||
|
||||
if (self->nr_variables == 0)
|
||||
|
@ -607,7 +606,7 @@ static void class__print_struct(struct class *self, const struct cu *cu)
|
|||
list_for_each_entry(pos, &self->members, node) {
|
||||
if (sum > 0 && last_size > 0 && sum % cacheline_size == 0)
|
||||
printf(" /* ---------- cacheline "
|
||||
"%u boundary ---------- */\n",
|
||||
"%lu boundary ---------- */\n",
|
||||
sum / cacheline_size);
|
||||
size = class_member__print(pos, cu);
|
||||
if (pos->hole > 0) {
|
||||
|
@ -641,7 +640,8 @@ static void class__print_struct(struct class *self, const struct cu *cu)
|
|||
puts(" */");
|
||||
|
||||
if (sum + sum_holes != self->size - self->padding)
|
||||
printf("\n/* BRAIN FART ALERT! %llu != %d + %d(holes), diff = %llu */\n\n",
|
||||
printf("\n/* BRAIN FART ALERT! %llu != "
|
||||
"%lu + %lu(holes), diff = %llu */\n\n",
|
||||
self->size, sum, sum_holes,
|
||||
self->size - (sum + sum_holes));
|
||||
putchar('\n');
|
||||
|
@ -777,7 +777,7 @@ static uint64_t attr_offset(Dwarf_Die *die)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static uintmax_t attr_upper_bound(Dwarf_Die *die)
|
||||
static uint64_t attr_upper_bound(Dwarf_Die *die)
|
||||
{
|
||||
Dwarf_Attribute attr;
|
||||
|
||||
|
@ -871,7 +871,6 @@ static void cu__process_die(Dwarf *dwarf, Dwarf_Die *die)
|
|||
} else if (tag == DW_TAG_subrange_type)
|
||||
cu__current_class->nr_entries = attr_upper_bound(die);
|
||||
else if (tag == DW_TAG_variable) {
|
||||
char bf[1024];
|
||||
uint64_t abstract_origin = attr_numeric(die,
|
||||
DW_AT_abstract_origin);
|
||||
struct variable *variable;
|
||||
|
|
|
@ -35,8 +35,8 @@ struct class {
|
|||
uint64_t type;
|
||||
uint64_t low_pc;
|
||||
uint64_t high_pc;
|
||||
uint64_t nr_entries; /* For arrays */
|
||||
unsigned int tag; /* struct, union, base type, etc */
|
||||
uintmax_t nr_entries; /* For arrays */
|
||||
const char *decl_file;
|
||||
unsigned int decl_line;
|
||||
unsigned short nr_members;
|
||||
|
|
6
pahole.c
6
pahole.c
|
@ -11,6 +11,7 @@
|
|||
#include <stdio.h>
|
||||
#include <dwarf.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "classes.h"
|
||||
|
||||
|
@ -62,7 +63,7 @@ static void structures__add(const struct class *class)
|
|||
|
||||
static void structure__print(struct structure *self)
|
||||
{
|
||||
printf("%-32.32s %5lu\n", self->class->name, self->nr_files);
|
||||
printf("%-32.32s %5u\n", self->class->name, self->nr_files);
|
||||
}
|
||||
|
||||
static void print_total_structure_stats(void)
|
||||
|
@ -180,6 +181,9 @@ int main(int argc, char *argv[])
|
|||
class_name = argv[optind++]; break;
|
||||
default: usage(); return EXIT_FAILURE;
|
||||
}
|
||||
} else {
|
||||
usage();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (cu__load_file(file_name) != 0) {
|
||||
|
|
11
pfunct.c
11
pfunct.c
|
@ -70,7 +70,7 @@ static void inlines__add(const struct class *class)
|
|||
|
||||
static void inline_function__print(struct inline_function *self)
|
||||
{
|
||||
printf("%-31.31s %6lu %7lu %6lu %6lu\n", self->name,
|
||||
printf("%-31.31s %6lu %7lu %6lu %6u\n", self->name,
|
||||
self->size_expansions, self->nr_expansions,
|
||||
self->size_expansions / self->nr_expansions,
|
||||
self->nr_files);
|
||||
|
@ -171,7 +171,7 @@ static int sizes_iterator(struct cu *cu, struct class *class, void *cookie)
|
|||
if (class->tag != DW_TAG_subprogram || class->inlined)
|
||||
return 0;
|
||||
|
||||
printf("%s: %u\n", class->name ?: "", class->high_pc - class->low_pc);
|
||||
printf("%s: %llu\n", class->name ?: "", class->high_pc - class->low_pc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ static int inlines_iterator(struct cu *cu, struct class *class, void *cookie)
|
|||
return 0;
|
||||
|
||||
if (class->name != NULL)
|
||||
printf("%s: %lu %lu\n", class->name,
|
||||
printf("%s: %u %lu\n", class->name,
|
||||
class->cu_total_nr_inline_expansions,
|
||||
class->cu_total_size_inline_expansions);
|
||||
return 0;
|
||||
|
@ -307,7 +307,7 @@ static int cu_total_inlines_iterator(struct cu *cu, void *cookie)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
int option, option_index;
|
||||
const char *file_name = NULL;
|
||||
const char *file_name;
|
||||
char *class_name = NULL;
|
||||
char *function_name = NULL;
|
||||
int show_sizes = 0;
|
||||
|
@ -345,6 +345,9 @@ int main(int argc, char *argv[])
|
|||
function_name = argv[optind++]; break;
|
||||
default: usage(); return EXIT_FAILURE;
|
||||
}
|
||||
} else {
|
||||
usage();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (cu__load_file(file_name) != 0) {
|
||||
|
|
|
@ -154,7 +154,7 @@ static int cu_lost_iterator(struct cu *cu, void *cookie)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
int option, option_index;
|
||||
const char *file_name = NULL;
|
||||
const char *file_name;
|
||||
|
||||
while ((option = getopt_long(argc, argv, "h",
|
||||
long_options, &option_index)) >= 0)
|
||||
|
@ -168,6 +168,9 @@ int main(int argc, char *argv[])
|
|||
case 1: file_name = argv[optind++]; break;
|
||||
default: usage(); return EXIT_FAILURE;
|
||||
}
|
||||
} else {
|
||||
usage();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (cu__load_file(file_name) != 0) {
|
||||
|
|
Loading…
Reference in New Issue