Skip to content

Commit

Permalink
emit: Optionally pass a conf_fprintf struct to type_emissions__init
Browse files Browse the repository at this point in the history
For later to use it to toggle some features, such as emitting the
atomic_ types as _Atomic typedefs.

Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Oct 13, 2022
1 parent 8c2b37e commit 8d2e166
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ctracer.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ int main(int argc, char *argv[])
goto out;
}

type_emissions__init(&emissions);
type_emissions__init(&emissions, NULL);

/*
* Create the methods_cus (Compilation Units) object where we will
Expand Down
3 changes: 2 additions & 1 deletion dwarves_emit.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
#include "dwarves_emit.h"
#include "dwarves.h"

void type_emissions__init(struct type_emissions *emissions)
void type_emissions__init(struct type_emissions *emissions, struct conf_fprintf *conf_fprintf)
{
INIT_LIST_HEAD(&emissions->base_type_definitions);
INIT_LIST_HEAD(&emissions->definitions);
INIT_LIST_HEAD(&emissions->fwd_decls);
emissions->conf_fprintf = conf_fprintf;
}

static void type_emissions__add_definition(struct type_emissions *emissions,
Expand Down
4 changes: 3 additions & 1 deletion dwarves_emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ struct cu;
struct ftype;
struct tag;
struct type;
struct conf_fprintf;

struct type_emissions {
struct list_head definitions; /* struct type entries */
struct list_head base_type_definitions; /* struct base_type entries */
struct list_head fwd_decls; /* struct class entries */
struct conf_fprintf *conf_fprintf;
};

void type_emissions__init(struct type_emissions *temissions);
void type_emissions__init(struct type_emissions *temissions, struct conf_fprintf *conf_fprintf);

int ftype__emit_definitions(struct ftype *ftype, struct cu *cu,
struct type_emissions *emissions, FILE *fp);
Expand Down
2 changes: 1 addition & 1 deletion pahole.c
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,7 @@ static error_t pahole__options_parser(int key, char *arg,
// case 'Z': ctf_encode = 1; break; // FIXME: Disabled
case ARGP_compile:
compilable = true;
type_emissions__init(&emissions);
type_emissions__init(&emissions, &conf);
conf.no_semicolon = true;
conf.strip_inline = true;
break;
Expand Down
4 changes: 2 additions & 2 deletions pfunct.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ static error_t pfunct__options_parser(int key, char *arg,
case 'a': addr = strtoull(arg, NULL, 0);
conf_load.get_addr_info = true; break;
case 'b': expand_types = true;
type_emissions__init(&emissions); break;
type_emissions__init(&emissions, &conf); break;
case 'c': class_name = arg; break;
case 'f': function_name = arg; break;
case 'F': conf_load.format_path = arg; break;
Expand Down Expand Up @@ -689,7 +689,7 @@ static error_t pfunct__options_parser(int key, char *arg,
case ARGP_no_parm_names: conf.no_parm_names = 1; break;
case ARGP_compile:
expand_types = true;
type_emissions__init(&emissions);
type_emissions__init(&emissions, &conf);
compilable_output = true;
conf.no_semicolon = true;
conf.strip_inline = true;
Expand Down

0 comments on commit 8d2e166

Please sign in to comment.