GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Functions
macroexp.c File Reference
#include "defs.h"
#include "gdbsupport/gdb_obstack.h"
#include "macrotab.h"
#include "macroexp.h"
#include "macroscope.h"
#include "c-lang.h"

Go to the source code of this file.

Classes

struct  shared_macro_buffer
 
struct  growable_macro_buffer
 
struct  macro_name_list
 

Functions

int macro_is_whitespace (int c)
 
int macro_is_digit (int c)
 
int macro_is_identifier_nondigit (int c)
 
static void set_token (shared_macro_buffer *tok, const char *start, const char *end)
 
static int get_comment (shared_macro_buffer *tok, const char *p, const char *end)
 
static int get_identifier (shared_macro_buffer *tok, const char *p, const char *end)
 
static int get_pp_number (shared_macro_buffer *tok, const char *p, const char *end)
 
static int get_character_constant (shared_macro_buffer *tok, const char *p, const char *end)
 
static int get_string_literal (shared_macro_buffer *tok, const char *p, const char *end)
 
static int get_punctuator (shared_macro_buffer *tok, const char *p, const char *end)
 
static int get_token (shared_macro_buffer *tok, shared_macro_buffer *src)
 
static void append_tokens_without_splicing (growable_macro_buffer *dest, shared_macro_buffer *src)
 
static void stringify (growable_macro_buffer *dest, const char *arg, int len)
 
gdb::unique_xmalloc_ptr< char > macro_stringify (const char *str)
 
static int currently_rescanning (struct macro_name_list *list, const char *name)
 
static bool gather_arguments (const char *name, shared_macro_buffer *src, int nargs, std::vector< shared_macro_buffer > *args_ptr)
 
static void scan (growable_macro_buffer *dest, shared_macro_buffer *src, struct macro_name_list *no_loop, const macro_scope &scope)
 
static int find_parameter (const shared_macro_buffer *tok, int is_varargs, const shared_macro_buffer *va_arg_name, int argc, const char *const *argv)
 
static void get_next_token_for_substitution (shared_macro_buffer *replacement_list, shared_macro_buffer *token, const char **start, shared_macro_buffer *lookahead, const char **lookahead_start, int *lookahead_valid, bool *keep_going)
 
static void substitute_args (growable_macro_buffer *dest, struct macro_definition *def, int is_varargs, const shared_macro_buffer *va_arg_name, const std::vector< shared_macro_buffer > &argv, struct macro_name_list *no_loop, const macro_scope &scope)
 
static int expand (const char *id, struct macro_definition *def, growable_macro_buffer *dest, shared_macro_buffer *src, struct macro_name_list *no_loop, const macro_scope &scope)
 
static int maybe_expand (growable_macro_buffer *dest, shared_macro_buffer *src_first, shared_macro_buffer *src_rest, struct macro_name_list *no_loop, const macro_scope &scope)
 
gdb::unique_xmalloc_ptr< char > macro_expand (const char *source, const macro_scope &scope)
 
gdb::unique_xmalloc_ptr< char > macro_expand_once (const char *source, const macro_scope &scope)
 
gdb::unique_xmalloc_ptr< char > macro_expand_next (const char **lexptr, const macro_scope &scope)
 

Function Documentation

◆ append_tokens_without_splicing()

static void append_tokens_without_splicing ( growable_macro_buffer * dest,
shared_macro_buffer * src )
static

◆ currently_rescanning()

static int currently_rescanning ( struct macro_name_list * list,
const char * name )
static

Definition at line 722 of file macroexp.c.

References name, macro_name_list::name, and macro_name_list::next.

Referenced by maybe_expand().

◆ expand()

static int expand ( const char * id,
struct macro_definition * def,
growable_macro_buffer * dest,
shared_macro_buffer * src,
struct macro_name_list * no_loop,
const macro_scope & scope )
static

◆ find_parameter()

static int find_parameter ( const shared_macro_buffer * tok,
int is_varargs,
const shared_macro_buffer * va_arg_name,
int argc,
const char *const * argv )
static

◆ gather_arguments()

static bool gather_arguments ( const char * name,
shared_macro_buffer * src,
int nargs,
std::vector< shared_macro_buffer > * args_ptr )
static

◆ get_character_constant()

static int get_character_constant ( shared_macro_buffer * tok,
const char * p,
const char * end )
static

Definition at line 317 of file macroexp.c.

References c_parse_escape(), and set_token().

Referenced by get_token().

◆ get_comment()

static int get_comment ( shared_macro_buffer * tok,
const char * p,
const char * end )
static

Definition at line 214 of file macroexp.c.

References set_token().

Referenced by get_token().

◆ get_identifier()

static int get_identifier ( shared_macro_buffer * tok,
const char * p,
const char * end )
static

◆ get_next_token_for_substitution()

static void get_next_token_for_substitution ( shared_macro_buffer * replacement_list,
shared_macro_buffer * token,
const char ** start,
shared_macro_buffer * lookahead,
const char ** lookahead_start,
int * lookahead_valid,
bool * keep_going )
static

Definition at line 905 of file macroexp.c.

References get_token(), keep_going(), shared_macro_buffer::text, and token.

Referenced by substitute_args().

◆ get_pp_number()

static int get_pp_number ( shared_macro_buffer * tok,
const char * p,
const char * end )
static

Definition at line 278 of file macroexp.c.

References macro_is_digit(), macro_is_identifier_nondigit(), and set_token().

Referenced by get_token().

◆ get_punctuator()

static int get_punctuator ( shared_macro_buffer * tok,
const char * p,
const char * end )
static

Definition at line 429 of file macroexp.c.

References set_token().

Referenced by get_token().

◆ get_string_literal()

static int get_string_literal ( shared_macro_buffer * tok,
const char * p,
const char * end )
static

Definition at line 379 of file macroexp.c.

References c_parse_escape(), and set_token().

Referenced by get_token().

◆ get_token()

static int get_token ( shared_macro_buffer * tok,
shared_macro_buffer * src )
static

◆ macro_expand()

gdb::unique_xmalloc_ptr< char > macro_expand ( const char * source,
const macro_scope & scope )

◆ macro_expand_next()

gdb::unique_xmalloc_ptr< char > macro_expand_next ( const char ** lexptr,
const macro_scope & scope )

◆ macro_expand_once()

gdb::unique_xmalloc_ptr< char > macro_expand_once ( const char * source,
const macro_scope & scope )

Definition at line 1414 of file macroexp.c.

Referenced by macro_expand_once_command().

◆ macro_is_digit()

int macro_is_digit ( int c)

Definition at line 187 of file macroexp.c.

Referenced by extract_identifier(), get_identifier(), and get_pp_number().

◆ macro_is_identifier_nondigit()

int macro_is_identifier_nondigit ( int c)

Definition at line 194 of file macroexp.c.

Referenced by extract_identifier(), get_identifier(), and get_pp_number().

◆ macro_is_whitespace()

int macro_is_whitespace ( int c)

Definition at line 176 of file macroexp.c.

Referenced by get_token(), skip_ws(), and stringify().

◆ macro_stringify()

gdb::unique_xmalloc_ptr< char > macro_stringify ( const char * str)

◆ maybe_expand()

static int maybe_expand ( growable_macro_buffer * dest,
shared_macro_buffer * src_first,
shared_macro_buffer * src_rest,
struct macro_name_list * no_loop,
const macro_scope & scope )
static

◆ scan()

static void scan ( growable_macro_buffer * dest,
shared_macro_buffer * src,
struct macro_name_list * no_loop,
const macro_scope & scope )
static

◆ set_token()

static void set_token ( shared_macro_buffer * tok,
const char * start,
const char * end )
static

◆ stringify()

static void stringify ( growable_macro_buffer * dest,
const char * arg,
int len )
static

◆ substitute_args()

static void substitute_args ( growable_macro_buffer * dest,
struct macro_definition * def,
int is_varargs,
const shared_macro_buffer * va_arg_name,
const std::vector< shared_macro_buffer > & argv,
struct macro_name_list * no_loop,
const macro_scope & scope )
static