mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-22 09:13:06 +00:00
libdrgn: require semicolon after DEFINE_{HASH,VECTOR,BINARY_SEARCH_TREE}*
The lack of a semicolon after these macros has always confused tooling like cscope. We could add semicolons everywhere now, but let's enforce it for the future, too. Let's add a dummy struct forward declaration at the end of each macro that enforces this requirement and also provides a useful error message. Signed-off-by: Omar Sandoval <osandov@osandov.com>
This commit is contained in:
parent
968abeda56
commit
c8406e1ea0
@ -285,7 +285,8 @@ typedef typeof(entry_type) tree##_entry_type; \
|
||||
\
|
||||
struct tree { \
|
||||
struct binary_tree_node *root; \
|
||||
};
|
||||
}; \
|
||||
struct DEFINE_BINARY_SEARCH_TREE_needs_semicolon
|
||||
|
||||
/**
|
||||
* Define the functions for a binary search tree.
|
||||
@ -559,7 +560,8 @@ static struct tree##_iterator tree##_next_post_order(struct tree##_iterator it)
|
||||
tree##_node_to_entry(node->parent), \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
} \
|
||||
struct DEFINE_BINARY_SEARCH_TREE_needs_semicolon
|
||||
|
||||
/**
|
||||
* Define a binary search tree interface.
|
||||
@ -582,7 +584,7 @@ static struct tree##_iterator tree##_next_post_order(struct tree##_iterator it)
|
||||
*/
|
||||
#define DEFINE_BINARY_SEARCH_TREE(tree, entry_type, member, entry_to_key, \
|
||||
cmp_func, variant) \
|
||||
DEFINE_BINARY_SEARCH_TREE_TYPE(tree, entry_type) \
|
||||
DEFINE_BINARY_SEARCH_TREE_TYPE(tree, entry_type); \
|
||||
DEFINE_BINARY_SEARCH_TREE_FUNCTIONS(tree, member, entry_to_key, cmp_func, \
|
||||
variant)
|
||||
|
||||
|
@ -30,8 +30,8 @@ static inline Dwarf *drgn_elf_file_dwarf_key(struct drgn_elf_file * const *entry
|
||||
return (*entry)->dwarf;
|
||||
}
|
||||
DEFINE_HASH_TABLE_FUNCTIONS(drgn_elf_file_dwarf_table, drgn_elf_file_dwarf_key,
|
||||
ptr_key_hash_pair, scalar_key_eq)
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_module_vector)
|
||||
ptr_key_hash_pair, scalar_key_eq);
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_module_vector);
|
||||
|
||||
struct drgn_module_key {
|
||||
const void *build_id;
|
||||
@ -66,9 +66,10 @@ static inline bool drgn_module_key_eq(const struct drgn_module_key *a,
|
||||
a->start == b->start && a->end == b->end);
|
||||
}
|
||||
DEFINE_HASH_TABLE_FUNCTIONS(drgn_module_table, drgn_module_key,
|
||||
drgn_module_key_hash_pair, drgn_module_key_eq)
|
||||
drgn_module_key_hash_pair, drgn_module_key_eq);
|
||||
|
||||
DEFINE_HASH_SET_FUNCTIONS(c_string_set, c_string_key_hash_pair, c_string_key_eq)
|
||||
DEFINE_HASH_SET_FUNCTIONS(c_string_set, c_string_key_hash_pair,
|
||||
c_string_key_eq);
|
||||
|
||||
/**
|
||||
* @c Dwfl_Callbacks::find_elf() implementation.
|
||||
@ -598,11 +599,11 @@ struct drgn_mapped_file_segment {
|
||||
uint64_t file_offset;
|
||||
};
|
||||
|
||||
DEFINE_VECTOR(drgn_mapped_file_segment_vector, struct drgn_mapped_file_segment)
|
||||
DEFINE_VECTOR(drgn_mapped_file_segment_vector, struct drgn_mapped_file_segment);
|
||||
|
||||
DEFINE_HASH_MAP(drgn_mapped_files, const char *,
|
||||
struct drgn_mapped_file_segment_vector, c_string_key_hash_pair,
|
||||
c_string_key_eq)
|
||||
c_string_key_eq);
|
||||
|
||||
struct userspace_core_report_state {
|
||||
struct drgn_mapped_files files;
|
||||
|
@ -49,7 +49,7 @@ enum drgn_module_state {
|
||||
DRGN_DEBUG_INFO_MODULE_INDEXED,
|
||||
} __attribute__((__packed__));
|
||||
|
||||
DEFINE_HASH_TABLE_TYPE(drgn_elf_file_dwarf_table, struct drgn_elf_file *)
|
||||
DEFINE_HASH_TABLE_TYPE(drgn_elf_file_dwarf_table, struct drgn_elf_file *);
|
||||
|
||||
/**
|
||||
* A module reported to a @ref drgn_debug_info.
|
||||
@ -124,9 +124,9 @@ struct drgn_module {
|
||||
struct drgn_module *next;
|
||||
};
|
||||
|
||||
DEFINE_HASH_TABLE_TYPE(drgn_module_table, struct drgn_module *)
|
||||
DEFINE_HASH_TABLE_TYPE(drgn_module_table, struct drgn_module *);
|
||||
|
||||
DEFINE_HASH_SET_TYPE(c_string_set, const char *)
|
||||
DEFINE_HASH_SET_TYPE(c_string_set, const char *);
|
||||
|
||||
/** Cache of debugging information. */
|
||||
struct drgn_debug_info {
|
||||
@ -155,7 +155,7 @@ struct drgn_error *drgn_debug_info_create(struct drgn_program *prog,
|
||||
/** Destroy a @ref drgn_debug_info. */
|
||||
void drgn_debug_info_destroy(struct drgn_debug_info *dbinfo);
|
||||
|
||||
DEFINE_VECTOR_TYPE(drgn_module_vector, struct drgn_module *)
|
||||
DEFINE_VECTOR_TYPE(drgn_module_vector, struct drgn_module *);
|
||||
|
||||
/** State tracked while loading debugging information. */
|
||||
struct drgn_debug_info_load_state {
|
||||
|
@ -63,7 +63,7 @@ drgn_dwarf_specification_to_key(const struct drgn_dwarf_specification *entry)
|
||||
}
|
||||
DEFINE_HASH_TABLE_FUNCTIONS(drgn_dwarf_specification_map,
|
||||
drgn_dwarf_specification_to_key, int_key_hash_pair,
|
||||
scalar_key_eq)
|
||||
scalar_key_eq);
|
||||
|
||||
/**
|
||||
* Placeholder for drgn_dwarf_index_cu::file_name_hashes if the CU has no
|
||||
@ -150,9 +150,10 @@ struct drgn_dwarf_index_cu {
|
||||
const char *str_offsets;
|
||||
};
|
||||
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_dwarf_index_cu_vector)
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_dwarf_index_cu_vector);
|
||||
|
||||
DEFINE_HASH_MAP_FUNCTIONS(drgn_dwarf_type_map, ptr_key_hash_pair, scalar_key_eq)
|
||||
DEFINE_HASH_MAP_FUNCTIONS(drgn_dwarf_type_map, ptr_key_hash_pair,
|
||||
scalar_key_eq);
|
||||
|
||||
/** DIE which needs to be indexed. */
|
||||
struct drgn_dwarf_index_pending_die {
|
||||
@ -164,7 +165,7 @@ struct drgn_dwarf_index_pending_die {
|
||||
uintptr_t addr;
|
||||
};
|
||||
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_dwarf_index_pending_die_vector)
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_dwarf_index_pending_die_vector);
|
||||
|
||||
/** DIE indexed in a @ref drgn_namespace_dwarf_index. */
|
||||
struct drgn_dwarf_index_die {
|
||||
@ -200,8 +201,8 @@ struct drgn_dwarf_index_die {
|
||||
};
|
||||
|
||||
DEFINE_HASH_MAP(drgn_dwarf_index_die_map, struct nstring, uint32_t,
|
||||
nstring_hash_pair, nstring_eq)
|
||||
DEFINE_VECTOR(drgn_dwarf_index_die_vector, struct drgn_dwarf_index_die)
|
||||
nstring_hash_pair, nstring_eq);
|
||||
DEFINE_VECTOR(drgn_dwarf_index_die_vector, struct drgn_dwarf_index_die);
|
||||
|
||||
#define DRGN_DWARF_INDEX_SHARD_BITS 8
|
||||
static const size_t DRGN_DWARF_INDEX_NUM_SHARDS = 1 << DRGN_DWARF_INDEX_SHARD_BITS;
|
||||
@ -427,9 +428,9 @@ enum drgn_dwarf_index_abbrev_insn {
|
||||
static_assert(NUM_INSNS - 1 == UINT8_MAX,
|
||||
"maximum DWARF index instruction is invalid");
|
||||
|
||||
DEFINE_VECTOR(uint8_vector, uint8_t)
|
||||
DEFINE_VECTOR(uint32_vector, uint32_t)
|
||||
DEFINE_VECTOR(uint64_vector, uint64_t)
|
||||
DEFINE_VECTOR(uint8_vector, uint8_t);
|
||||
DEFINE_VECTOR(uint32_vector, uint32_t);
|
||||
DEFINE_VECTOR(uint64_vector, uint64_t);
|
||||
|
||||
struct drgn_dwarf_index_cu_buffer {
|
||||
struct binary_buffer bb;
|
||||
@ -926,7 +927,7 @@ struct path_hash_chunk {
|
||||
struct path_hash_chunk *next;
|
||||
};
|
||||
|
||||
DEFINE_VECTOR(path_hash_vector, const struct path_hash *)
|
||||
DEFINE_VECTOR(path_hash_vector, const struct path_hash *);
|
||||
|
||||
struct lnp_entry_format {
|
||||
uint64_t content_type;
|
||||
@ -3025,7 +3026,7 @@ drgn_debug_info_main_language(struct drgn_debug_info *dbinfo,
|
||||
* DIE iteration.
|
||||
*/
|
||||
|
||||
DEFINE_VECTOR(dwarf_die_vector, Dwarf_Die)
|
||||
DEFINE_VECTOR(dwarf_die_vector, Dwarf_Die);
|
||||
|
||||
/** Iterator over DWARF DIEs in a @ref drgn_module. */
|
||||
struct drgn_dwarf_die_iterator {
|
||||
@ -6442,7 +6443,7 @@ struct array_dimension {
|
||||
bool is_complete;
|
||||
};
|
||||
|
||||
DEFINE_VECTOR(array_dimension_vector, struct array_dimension)
|
||||
DEFINE_VECTOR(array_dimension_vector, struct array_dimension);
|
||||
|
||||
static struct drgn_error *subrange_length(Dwarf_Die *die,
|
||||
struct array_dimension *dimension)
|
||||
@ -7063,10 +7064,10 @@ struct drgn_dwarf_cie {
|
||||
size_t initial_instructions_size;
|
||||
};
|
||||
|
||||
DEFINE_VECTOR(drgn_dwarf_fde_vector, struct drgn_dwarf_fde)
|
||||
DEFINE_VECTOR(drgn_dwarf_cie_vector, struct drgn_dwarf_cie)
|
||||
DEFINE_VECTOR(drgn_dwarf_fde_vector, struct drgn_dwarf_fde);
|
||||
DEFINE_VECTOR(drgn_dwarf_cie_vector, struct drgn_dwarf_cie);
|
||||
DEFINE_HASH_MAP(drgn_dwarf_cie_map, size_t, size_t, int_key_hash_pair,
|
||||
scalar_key_eq)
|
||||
scalar_key_eq);
|
||||
|
||||
static struct drgn_error *
|
||||
drgn_dwarf_cfi_next_encoded(struct drgn_elf_file_section_buffer *buffer,
|
||||
@ -7616,7 +7617,7 @@ drgn_dwarf_cfi_next_block(struct drgn_elf_file_section_buffer *buffer,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEFINE_VECTOR(drgn_cfi_row_vector, struct drgn_cfi_row *)
|
||||
DEFINE_VECTOR(drgn_cfi_row_vector, struct drgn_cfi_row *);
|
||||
|
||||
static struct drgn_error *
|
||||
drgn_eval_dwarf_cfi(struct drgn_elf_file *file, enum drgn_section_index scn,
|
||||
|
@ -69,7 +69,7 @@ struct drgn_module_dwarf_info {
|
||||
void drgn_module_dwarf_info_deinit(struct drgn_module *module);
|
||||
|
||||
DEFINE_VECTOR_TYPE(drgn_dwarf_index_pending_die_vector,
|
||||
struct drgn_dwarf_index_pending_die)
|
||||
struct drgn_dwarf_index_pending_die);
|
||||
|
||||
/**
|
||||
* Index of DWARF information for a namespace by entity name.
|
||||
@ -108,9 +108,9 @@ struct drgn_dwarf_specification {
|
||||
};
|
||||
|
||||
DEFINE_HASH_TABLE_TYPE(drgn_dwarf_specification_map,
|
||||
struct drgn_dwarf_specification)
|
||||
struct drgn_dwarf_specification);
|
||||
|
||||
DEFINE_VECTOR_TYPE(drgn_dwarf_index_cu_vector, struct drgn_dwarf_index_cu)
|
||||
DEFINE_VECTOR_TYPE(drgn_dwarf_index_cu_vector, struct drgn_dwarf_index_cu);
|
||||
|
||||
/** Cached type in a @ref drgn_debug_info. */
|
||||
struct drgn_dwarf_type {
|
||||
@ -125,7 +125,7 @@ struct drgn_dwarf_type {
|
||||
bool is_incomplete_array;
|
||||
};
|
||||
|
||||
DEFINE_HASH_MAP_TYPE(drgn_dwarf_type_map, const void *, struct drgn_dwarf_type)
|
||||
DEFINE_HASH_MAP_TYPE(drgn_dwarf_type_map, const void *, struct drgn_dwarf_type);
|
||||
|
||||
/** DWARF debugging information for a program/@ref drgn_debug_info. */
|
||||
struct drgn_dwarf_info {
|
||||
|
@ -60,7 +60,7 @@
|
||||
* key_type entry_to_key(const entry_type *entry);
|
||||
* struct hash_pair hash_func(const key_type *key);
|
||||
* bool eq_func(const key_type *a, const key_type *b);
|
||||
* DEFINE_HASH_TABLE(hash_table, entry_type, entry_to_key, hash_func, eq_func)
|
||||
* DEFINE_HASH_TABLE(hash_table, entry_type, entry_to_key, hash_func, eq_func);
|
||||
* @endcode
|
||||
*
|
||||
* @sa BinarySearchTrees
|
||||
@ -406,7 +406,8 @@ struct table { \
|
||||
size_t size; \
|
||||
uintptr_t first_packed; \
|
||||
} basic[!table##_vector_policy]; \
|
||||
};
|
||||
}; \
|
||||
struct DEFINE_HASH_TABLE_needs_semicolon
|
||||
|
||||
/*
|
||||
* Common search function implementation returning an item iterator. This is
|
||||
@ -1406,7 +1407,8 @@ static struct table##_iterator table##_next(struct table##_iterator it) \
|
||||
} else { \
|
||||
return table##_next_impl(it, false); \
|
||||
} \
|
||||
}
|
||||
} \
|
||||
struct DEFINE_HASH_TABLE_needs_semicolon
|
||||
|
||||
/**
|
||||
* Define a hash table interface.
|
||||
@ -1425,7 +1427,7 @@ static struct table##_iterator table##_next(struct table##_iterator it) \
|
||||
* *</tt> and returns a @c bool.
|
||||
*/
|
||||
#define DEFINE_HASH_TABLE(table, entry_type, entry_to_key, hash_func, eq_func) \
|
||||
DEFINE_HASH_TABLE_TYPE(table, entry_type) \
|
||||
DEFINE_HASH_TABLE_TYPE(table, entry_type); \
|
||||
DEFINE_HASH_TABLE_FUNCTIONS(table, entry_to_key, hash_func, eq_func)
|
||||
|
||||
/**
|
||||
@ -1479,7 +1481,7 @@ DEFINE_HASH_TABLE_FUNCTIONS(table, HASH_MAP_ENTRY_TO_KEY, hash_func, eq_func)
|
||||
* @param[in] eq_func See @ref DEFINE_HASH_TABLE().
|
||||
*/
|
||||
#define DEFINE_HASH_MAP(table, key_type, value_type, hash_func, eq_func) \
|
||||
DEFINE_HASH_MAP_TYPE(table, key_type, value_type) \
|
||||
DEFINE_HASH_MAP_TYPE(table, key_type, value_type); \
|
||||
DEFINE_HASH_MAP_FUNCTIONS(table, hash_func, eq_func)
|
||||
|
||||
/**
|
||||
@ -1520,7 +1522,7 @@ DEFINE_HASH_TABLE_FUNCTIONS(table, HASH_SET_ENTRY_TO_KEY, hash_func, eq_func)
|
||||
* @param[in] eq_func See @ref DEFINE_HASH_TABLE().
|
||||
*/
|
||||
#define DEFINE_HASH_SET(table, key_type, hash_func, eq_func) \
|
||||
DEFINE_HASH_SET_TYPE(table, key_type) \
|
||||
DEFINE_HASH_SET_TYPE(table, key_type); \
|
||||
DEFINE_HASH_SET_FUNCTIONS(table, hash_func, eq_func)
|
||||
|
||||
/**
|
||||
|
@ -1016,7 +1016,7 @@ struct compound_initializer_state {
|
||||
uint64_t bit_offset;
|
||||
};
|
||||
|
||||
DEFINE_VECTOR(compound_initializer_stack, struct compound_initializer_state)
|
||||
DEFINE_VECTOR(compound_initializer_stack, struct compound_initializer_state);
|
||||
|
||||
struct compound_initializer_iter {
|
||||
struct initializer_iter iter;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "drgn.h"
|
||||
#include "lexer.h"
|
||||
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_token_vector)
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_token_vector);
|
||||
|
||||
void drgn_lexer_init(struct drgn_lexer *lexer, drgn_lexer_func func,
|
||||
const char *str)
|
||||
|
@ -57,7 +57,7 @@ struct drgn_token {
|
||||
size_t len;
|
||||
};
|
||||
|
||||
DEFINE_VECTOR_TYPE(drgn_token_vector, struct drgn_token)
|
||||
DEFINE_VECTOR_TYPE(drgn_token_vector, struct drgn_token);
|
||||
|
||||
/**
|
||||
* Lexer instance.
|
||||
|
@ -1249,7 +1249,7 @@ static struct drgn_error *identify_kernel_elf(Elf *elf,
|
||||
}
|
||||
|
||||
DEFINE_HASH_MAP(elf_scn_name_map, const char *, Elf_Scn *,
|
||||
c_string_key_hash_pair, c_string_key_eq)
|
||||
c_string_key_hash_pair, c_string_key_eq);
|
||||
|
||||
static struct drgn_error *
|
||||
cache_kernel_module_sections(struct kernel_module_iterator *kmod_it, Elf *elf)
|
||||
@ -1348,7 +1348,7 @@ kernel_module_table_key(struct kernel_module_file * const *entry)
|
||||
}
|
||||
|
||||
DEFINE_HASH_TABLE(kernel_module_table, struct kernel_module_file *,
|
||||
kernel_module_table_key, nstring_hash_pair, nstring_eq)
|
||||
kernel_module_table_key, nstring_hash_pair, nstring_eq);
|
||||
|
||||
static struct drgn_error *
|
||||
report_loaded_kernel_module(struct drgn_debug_info_load_state *load,
|
||||
|
@ -36,7 +36,7 @@ drgn_memory_segment_to_key(const struct drgn_memory_segment *entry)
|
||||
|
||||
DEFINE_BINARY_SEARCH_TREE_FUNCTIONS(drgn_memory_segment_tree, node,
|
||||
drgn_memory_segment_to_key,
|
||||
binary_search_tree_scalar_cmp, splay)
|
||||
binary_search_tree_scalar_cmp, splay);
|
||||
|
||||
void drgn_memory_reader_init(struct drgn_memory_reader *reader)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
DEFINE_BINARY_SEARCH_TREE_TYPE(drgn_memory_segment_tree,
|
||||
struct drgn_memory_segment)
|
||||
struct drgn_memory_segment);
|
||||
|
||||
/**
|
||||
* Memory reader.
|
||||
|
@ -37,9 +37,9 @@ static inline uint32_t drgn_thread_to_key(const struct drgn_thread *entry)
|
||||
return entry->tid;
|
||||
}
|
||||
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_prstatus_vector)
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_prstatus_vector);
|
||||
DEFINE_HASH_TABLE_FUNCTIONS(drgn_thread_set, drgn_thread_to_key,
|
||||
int_key_hash_pair, scalar_key_eq)
|
||||
int_key_hash_pair, scalar_key_eq);
|
||||
|
||||
struct drgn_thread_iterator {
|
||||
struct drgn_program *prog;
|
||||
@ -1603,7 +1603,7 @@ drgn_program_read_memory(struct drgn_program *prog, void *buf, uint64_t address,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEFINE_VECTOR(char_vector, char)
|
||||
DEFINE_VECTOR(char_vector, char);
|
||||
|
||||
LIBDRGN_PUBLIC struct drgn_error *
|
||||
drgn_program_read_c_string(struct drgn_program *prog, uint64_t address,
|
||||
@ -1771,7 +1771,7 @@ drgn_program_find_symbol_by_address(struct drgn_program *prog, uint64_t address,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEFINE_VECTOR(symbolp_vector, struct drgn_symbol *)
|
||||
DEFINE_VECTOR(symbolp_vector, struct drgn_symbol *);
|
||||
|
||||
enum {
|
||||
SYMBOLS_SEARCH_NAME = (1 << 0),
|
||||
|
@ -50,9 +50,9 @@ struct drgn_thread {
|
||||
struct drgn_object object;
|
||||
};
|
||||
|
||||
DEFINE_VECTOR_TYPE(drgn_typep_vector, struct drgn_type *)
|
||||
DEFINE_VECTOR_TYPE(drgn_prstatus_vector, struct nstring)
|
||||
DEFINE_HASH_TABLE_TYPE(drgn_thread_set, struct drgn_thread)
|
||||
DEFINE_VECTOR_TYPE(drgn_typep_vector, struct drgn_type *);
|
||||
DEFINE_VECTOR_TYPE(drgn_prstatus_vector, struct nstring);
|
||||
DEFINE_HASH_TABLE_TYPE(drgn_thread_set, struct drgn_thread);
|
||||
|
||||
struct drgn_program {
|
||||
/** @privatesection */
|
||||
|
@ -121,7 +121,7 @@ typedef struct {
|
||||
struct drgn_platform *platform;
|
||||
} Platform;
|
||||
|
||||
DEFINE_HASH_SET_TYPE(pyobjectp_set, PyObject *)
|
||||
DEFINE_HASH_SET_TYPE(pyobjectp_set, PyObject *);
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "../util.h"
|
||||
#include "../vector.h"
|
||||
|
||||
DEFINE_HASH_SET_FUNCTIONS(pyobjectp_set, ptr_key_hash_pair, scalar_key_eq)
|
||||
DEFINE_HASH_SET_FUNCTIONS(pyobjectp_set, ptr_key_hash_pair, scalar_key_eq);
|
||||
|
||||
static PyObject *percent_s;
|
||||
static PyObject *logger;
|
||||
@ -599,7 +599,7 @@ static PyObject *Program_set_pid(Program *self, PyObject *args, PyObject *kwds)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
DEFINE_VECTOR(path_arg_vector, struct path_arg)
|
||||
DEFINE_VECTOR(path_arg_vector, struct path_arg);
|
||||
|
||||
static PyObject *Program_load_debug_info(Program *self, PyObject *args,
|
||||
PyObject *kwds)
|
||||
|
@ -172,9 +172,9 @@ static bool drgn_member_key_eq(const struct drgn_member_key *a,
|
||||
}
|
||||
|
||||
DEFINE_HASH_MAP_FUNCTIONS(drgn_member_map, drgn_member_key_hash_pair,
|
||||
drgn_member_key_eq)
|
||||
drgn_member_key_eq);
|
||||
|
||||
DEFINE_HASH_SET_FUNCTIONS(drgn_type_set, ptr_key_hash_pair, scalar_key_eq)
|
||||
DEFINE_HASH_SET_FUNCTIONS(drgn_type_set, ptr_key_hash_pair, scalar_key_eq);
|
||||
|
||||
LIBDRGN_PUBLIC struct drgn_error *
|
||||
drgn_member_object(struct drgn_type_member *member,
|
||||
@ -331,9 +331,9 @@ static bool drgn_type_dedupe_eq(struct drgn_type * const *entry_a,
|
||||
* enumerators, so the hash and comparison functions ignore those.
|
||||
*/
|
||||
DEFINE_HASH_SET_FUNCTIONS(drgn_dedupe_type_set, drgn_type_dedupe_hash_pair,
|
||||
drgn_type_dedupe_eq)
|
||||
drgn_type_dedupe_eq);
|
||||
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_typep_vector)
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_typep_vector);
|
||||
|
||||
static struct drgn_error *find_or_create_type(struct drgn_type *key,
|
||||
struct drgn_type **ret)
|
||||
@ -487,7 +487,7 @@ struct drgn_error *drgn_float_type_create(struct drgn_program *prog,
|
||||
return find_or_create_type(&key, ret);
|
||||
}
|
||||
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_type_template_parameter_vector)
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_type_template_parameter_vector);
|
||||
|
||||
static void
|
||||
drgn_template_parameters_builder_init(struct drgn_template_parameters_builder *builder,
|
||||
@ -524,7 +524,7 @@ drgn_template_parameters_builder_add(struct drgn_template_parameters_builder *bu
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_type_member_vector)
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_type_member_vector);
|
||||
|
||||
void drgn_compound_type_builder_init(struct drgn_compound_type_builder *builder,
|
||||
struct drgn_program *prog,
|
||||
@ -631,7 +631,7 @@ drgn_compound_type_create(struct drgn_compound_type_builder *builder,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_type_enumerator_vector)
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_type_enumerator_vector);
|
||||
|
||||
void drgn_enum_type_builder_init(struct drgn_enum_type_builder *builder,
|
||||
struct drgn_program *prog)
|
||||
@ -865,7 +865,7 @@ drgn_incomplete_array_type_create(struct drgn_program *prog,
|
||||
return find_or_create_type(&key, ret);
|
||||
}
|
||||
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_type_parameter_vector)
|
||||
DEFINE_VECTOR_FUNCTIONS(drgn_type_parameter_vector);
|
||||
|
||||
void drgn_function_type_builder_init(struct drgn_function_type_builder *builder,
|
||||
struct drgn_program *prog)
|
||||
|
@ -58,7 +58,7 @@ struct drgn_type_finder {
|
||||
struct drgn_type_finder *next;
|
||||
};
|
||||
|
||||
DEFINE_HASH_SET_TYPE(drgn_dedupe_type_set, struct drgn_type *)
|
||||
DEFINE_HASH_SET_TYPE(drgn_dedupe_type_set, struct drgn_type *);
|
||||
|
||||
/** <tt>(type, member name)</tt> pair. */
|
||||
struct drgn_member_key {
|
||||
@ -87,8 +87,8 @@ struct drgn_member_value {
|
||||
*/
|
||||
#else
|
||||
DEFINE_HASH_MAP_TYPE(drgn_member_map, struct drgn_member_key,
|
||||
struct drgn_member_value)
|
||||
DEFINE_HASH_SET_TYPE(drgn_type_set, struct drgn_type *)
|
||||
struct drgn_member_value);
|
||||
DEFINE_HASH_SET_TYPE(drgn_type_set, struct drgn_type *);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -177,7 +177,7 @@ struct drgn_error *drgn_float_type_create(struct drgn_program *prog,
|
||||
struct drgn_type **ret);
|
||||
|
||||
DEFINE_VECTOR_TYPE(drgn_type_template_parameter_vector,
|
||||
struct drgn_type_template_parameter)
|
||||
struct drgn_type_template_parameter);
|
||||
|
||||
/**
|
||||
* Common builder shared between compound and function types for template
|
||||
@ -199,7 +199,7 @@ drgn_template_parameters_builder_add(struct drgn_template_parameters_builder *bu
|
||||
const union drgn_lazy_object *argument,
|
||||
const char *name, bool is_default);
|
||||
|
||||
DEFINE_VECTOR_TYPE(drgn_type_member_vector, struct drgn_type_member)
|
||||
DEFINE_VECTOR_TYPE(drgn_type_member_vector, struct drgn_type_member);
|
||||
|
||||
/** Builder for members of a structure, union, or class type. */
|
||||
struct drgn_compound_type_builder {
|
||||
@ -261,7 +261,7 @@ drgn_compound_type_create(struct drgn_compound_type_builder *builder,
|
||||
const struct drgn_language *lang,
|
||||
struct drgn_type **ret);
|
||||
|
||||
DEFINE_VECTOR_TYPE(drgn_type_enumerator_vector, struct drgn_type_enumerator)
|
||||
DEFINE_VECTOR_TYPE(drgn_type_enumerator_vector, struct drgn_type_enumerator);
|
||||
|
||||
/** Builder for enumerators of an enumerated type. */
|
||||
struct drgn_enum_type_builder {
|
||||
@ -407,7 +407,7 @@ drgn_incomplete_array_type_create(struct drgn_program *prog,
|
||||
const struct drgn_language *lang,
|
||||
struct drgn_type **ret);
|
||||
|
||||
DEFINE_VECTOR_TYPE(drgn_type_parameter_vector, struct drgn_type_parameter)
|
||||
DEFINE_VECTOR_TYPE(drgn_type_parameter_vector, struct drgn_type_parameter);
|
||||
|
||||
/** Builder for parameters of a function type. */
|
||||
struct drgn_function_type_builder {
|
||||
|
@ -150,7 +150,8 @@ struct vector { \
|
||||
vector##_entry_type *data; \
|
||||
size_t size; \
|
||||
size_t capacity; \
|
||||
};
|
||||
}; \
|
||||
struct DEFINE_VECTOR_needs_semicolon
|
||||
|
||||
/**
|
||||
* Define the functions for a vector.
|
||||
@ -217,7 +218,8 @@ __attribute__((__unused__)) \
|
||||
static vector##_entry_type *vector##_pop(struct vector *vector) \
|
||||
{ \
|
||||
return &vector->data[--vector->size]; \
|
||||
}
|
||||
} \
|
||||
struct DEFINE_VECTOR_needs_semicolon
|
||||
|
||||
/**
|
||||
* Define a vector interface.
|
||||
@ -229,7 +231,7 @@ static vector##_entry_type *vector##_pop(struct vector *vector) \
|
||||
* @param[in] entry_type Type of entries in the vector.
|
||||
*/
|
||||
#define DEFINE_VECTOR(vector, entry_type) \
|
||||
DEFINE_VECTOR_TYPE(vector, entry_type) \
|
||||
DEFINE_VECTOR_TYPE(vector, entry_type); \
|
||||
DEFINE_VECTOR_FUNCTIONS(vector)
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user