osprey/kg++fe/gnu/cpplib.c File Reference

#include "config.h"
#include "system.h"
#include "cpplib.h"
#include "cpphash.h"
#include "obstack.h"

Include dependency graph for cpplib.c:

Go to the source code of this file.

Data Types

type  answer
type  if_stack
type  pragma_entry
type  directive

Defines

#define KANDR   0
#define STDC89   1
#define EXTENSION   2
#define COND   (1 << 0)
#define IF_COND   (1 << 1)
#define INCL   (1 << 2)
#define IN_I   (1 << 3)
#define EXPAND   (1 << 4)
#define DIRECTIVE_TABLE
#define D(name, t, o, f)   static void CONCAT2(do_,name) PARAMS ((cpp_reader *));
#define D(n, tag, o, f)   tag,
#define D(name, t, origin, flags)
#define SEEN_EOL()   (pfile->cur_token[-1].type == CPP_EOF)

Typedefs

typedef void pragma_cb PARAMS ((cpp_reader *))
typedef struct directive directive

Enumerations

enum  { N_DIRECTIVES }

Functions/Subroutines

static void skip_rest_of_line PARAMS ((cpp_reader *))
static void end_directive PARAMS ((cpp_reader *, int))
static void directive_diagnostics PARAMS ((cpp_reader *, const directive *, int))
static void run_directive PARAMS ((cpp_reader *, int, const char *, size_t))
static void push_conditional PARAMS ((cpp_reader *, int, int, const cpp_hashnode *))
static unsigned int read_flag PARAMS ((cpp_reader *, unsigned int))
static uchar *dequote_string PARAMS ((cpp_reader *, const uchar *, unsigned int))
static int strtoul_for_line PARAMS ((const uchar *, unsigned int, unsigned long *))
static void do_diagnostic PARAMS ((cpp_reader *, int, int))
static void do_include_common PARAMS ((cpp_reader *, enum include_type))
static struct pragma_entry
*lookup_pragma_entry 
PARAMS ((struct pragma_entry *, const cpp_hashnode *pragma))
static struct pragma_entry
*insert_pragma_entry 
PARAMS ((cpp_reader *, struct pragma_entry **, const cpp_hashnode *, pragma_cb))
static void destringize_and_run PARAMS ((cpp_reader *, const cpp_string *))
static int parse_answer PARAMS ((cpp_reader *, struct answer **, int))
static struct answer **find_answer PARAMS ((cpp_hashnode *, const struct answer *))
static void handle_assertion PARAMS ((cpp_reader *, const char *, int))
static void skip_rest_of_line (cpp_reader *pfile)
static void check_eol (cpp_reader *pfile)
static void start_directive (cpp_reader *pfile)
static void end_directive (cpp_reader *pfile, int skip_line)
static void prepare_directive_trad (cpp_reader *pfile)
static void directive_diagnostics (cpp_reader *pfile, const directive *dir, int indented)
int _cpp_handle_directive (cpp_reader *pfile, int indented)
static void run_directive (cpp_reader *pfile, int dir_no, const char *buf, size_t count)
static cpp_hashnodelex_macro_node (cpp_reader *pfile)
static void do_define (cpp_reader *pfile)
static void do_undef (cpp_reader *pfile)
static const cpp_tokenglue_header_name (cpp_reader *pfile)
static const cpp_tokenparse_include (cpp_reader *pfile)
static void do_include_common (cpp_reader *pfile, enum include_type type)
static void do_include (cpp_reader *pfile)
static void do_import (cpp_reader *pfile)
static void do_include_next (cpp_reader *pfile)
static unsigned int read_flag (cpp_reader *pfile, unsigned int last)
static uchardequote_string (cpp_reader *pfile, const uchar *str, unsigned int len)
static int strtoul_for_line (uchar *str, unsigned int len, unsigned long *nump) const
static void do_line (cpp_reader *pfile)
static void do_linemarker (cpp_reader *pfile)
void _cpp_do_file_change (cpp_reader *pfile, enum lc_reason reason, const char *to_file, unsigned int file_line, unsigned int sysp)
static void do_diagnostic (cpp_reader *pfile, int code, int print_dir)
static void do_error (cpp_reader *pfile)
static void do_warning (cpp_reader *pfile)
static void do_ident (cpp_reader *pfile)
static struct pragma_entrylookup_pragma_entry (struct pragma_entry *chain, const cpp_hashnode *pragma)
static struct pragma_entryinsert_pragma_entry (cpp_reader *pfile, struct pragma_entry **chain, const cpp_hashnode *pragma, pragma_cb handler)
void cpp_register_pragma (cpp_reader *pfile, const char *space, const char *name, pragma_cb handler)
void _cpp_init_internal_pragmas (cpp_reader *pfile)
static void do_pragma (cpp_reader *pfile)
static void do_pragma_once (cpp_reader *pfile)
static void do_pragma_poison (cpp_reader *pfile)
static void do_pragma_system_header (cpp_reader *pfile)
static void do_pragma_dependency (cpp_reader *pfile)
static const cpp_tokenget_token_no_padding (cpp_reader *pfile)
static const cpp_tokenget__Pragma_string (cpp_reader *pfile)
static void destringize_and_run (cpp_reader *pfile, const cpp_string *in)
void _cpp_do__Pragma (cpp_reader *pfile)
static void do_sccs (pfile)
static void do_ifdef (cpp_reader *pfile)
static void do_ifndef (cpp_reader *pfile)
static void do_if (cpp_reader *pfile)
static void do_else (cpp_reader *pfile)
static void do_elif (cpp_reader *pfile)
static void do_endif (cpp_reader *pfile)
static void push_conditional (cpp_reader *pfile, int skip, int type, const cpp_hashnode *cmacro)
static int parse_answer (cpp_reader *pfile, struct answer **answerp, int type)
static cpp_hashnodeparse_assertion (cpp_reader *pfile, struct answer **answerp, int type)
static struct answer ** find_answer (cpp_hashnode *node, const struct answer *candidate)
int _cpp_test_assertion (cpp_reader *pfile, unsigned int *value)
static void do_assert (cpp_reader *pfile)
static void do_unassert (cpp_reader *pfile)
void cpp_define (cpp_reader *pfile, const char *str)
void _cpp_define_builtin (cpp_reader *pfile, const char *str)
void cpp_undef (cpp_reader *pfile, const char *macro)
void cpp_assert (cpp_reader *pfile, const char *str)
void cpp_unassert (cpp_reader *pfile, const char *str)
static void handle_assertion (cpp_reader *pfile, const char *str, int type)
unsigned int cpp_errors (cpp_reader *pfile)
cpp_optionscpp_get_options (cpp_reader *pfile)
cpp_callbackscpp_get_callbacks (cpp_reader *pfile)
struct line_mapscpp_get_line_maps (cpp_reader *pfile)
void cpp_set_callbacks (cpp_reader *pfile, cpp_callbacks *cb)
cpp_buffercpp_push_buffer (cpp_reader *pfile, const uchar *buffer, size_t len, int from_stage3, int return_at_eof)
void _cpp_pop_buffer (cpp_reader *pfile)
void _cpp_init_directives (cpp_reader *pfile)

Variables

static const directive dtable []
static const directive linemarker_dir


Define Documentation

#define COND   (1 << 0)

Definition at line 76 of file cpplib.c.

#define D ( name,
t,
origin,
flags   ) 

Value:

{ CONCAT2(do_,name), (const uchar *) STRINGX(name), \
  sizeof STRINGX(name) - 1, origin, flags },

Definition at line 184 of file cpplib.c.

#define D ( n,
tag,
o,
f   )     tag,

Definition at line 184 of file cpplib.c.

#define D ( name,
t,
o,
f   )     static void CONCAT2(do_,name) PARAMS ((cpp_reader *));

Definition at line 184 of file cpplib.c.

#define DIRECTIVE_TABLE

Value:

D(define, T_DEFINE = 0, KANDR,     IN_I)     /* 270554 */ \
D(include,  T_INCLUDE,  KANDR,     INCL | EXPAND)  /*  52262 */ \
D(endif,  T_ENDIF,  KANDR,     COND)     /*  45855 */ \
D(ifdef,  T_IFDEF,  KANDR,     COND | IF_COND) /*  22000 */ \
D(if,   T_IF,   KANDR, COND | IF_COND | EXPAND) /*  18162 */ \
D(else,   T_ELSE,   KANDR,     COND)     /*   9863 */ \
D(ifndef, T_IFNDEF, KANDR,     COND | IF_COND) /*   9675 */ \
D(undef,  T_UNDEF,  KANDR,     IN_I)     /*   4837 */ \
D(line,   T_LINE,   KANDR,     EXPAND)     /*   2465 */ \
D(elif,   T_ELIF,   STDC89,    COND | EXPAND)  /*    610 */ \
D(error,  T_ERROR,  STDC89,    0)      /*    475 */ \
D(pragma, T_PRAGMA, STDC89,    IN_I)     /*    195 */ \
D(warning,  T_WARNING,  EXTENSION, 0)      /*     22 */ \
D(include_next, T_INCLUDE_NEXT, EXTENSION, INCL | EXPAND)  /*     19 */ \
D(ident,  T_IDENT,  EXTENSION, IN_I)     /*     11 */ \
D(import, T_IMPORT, EXTENSION, INCL | EXPAND)  /* 0 ObjC */ \
D(assert, T_ASSERT, EXTENSION, 0)      /* 0 SVR4 */ \
D(unassert, T_UNASSERT, EXTENSION, 0)      /* 0 SVR4 */ \
D(sccs,   T_SCCS,   EXTENSION, 0)

Definition at line 146 of file cpplib.c.

#define EXPAND   (1 << 4)

Definition at line 80 of file cpplib.c.

Referenced by cvrt_exp_to_pdg(), and prepare_directive_trad().

#define EXTENSION   2

Definition at line 67 of file cpplib.c.

Referenced by directive_diagnostics().

#define IF_COND   (1 << 1)

Definition at line 77 of file cpplib.c.

#define IN_I   (1 << 3)

Definition at line 79 of file cpplib.c.

Referenced by _cpp_handle_directive().

#define INCL   (1 << 2)

Definition at line 78 of file cpplib.c.

#define KANDR   0

Definition at line 65 of file cpplib.c.

Referenced by directive_diagnostics().

 
#define SEEN_EOL (  )     (pfile->cur_token[-1].type == CPP_EOF)

Definition at line 202 of file cpplib.c.

Referenced by check_eol(), check_eol_return_comments(), and skip_rest_of_line().

#define STDC89   1

Definition at line 66 of file cpplib.c.


Typedef Documentation

Definition at line 84 of file cpplib.c.

typedef void directive_handler PARAMS((cpp_reader *))

Definition at line 50 of file cpplib.c.


Enumeration Type Documentation

anonymous enum

Enumerator:
N_DIRECTIVES 

Definition at line 176 of file cpplib.c.


Function Documentation

void _cpp_define_builtin ( cpp_reader pfile,
const char *  str 
)

Definition at line 1816 of file cpplib.c.

void _cpp_do__Pragma ( cpp_reader pfile  ) 

Definition at line 1328 of file cpplib.c.

Referenced by builtin_macro().

void _cpp_do_file_change ( cpp_reader pfile,
enum lc_reason  reason,
const char *  to_file,
unsigned int  file_line,
unsigned int  sysp 
)

int _cpp_handle_directive ( cpp_reader pfile,
int  indented 
)

Definition at line 345 of file cpplib.c.

Referenced by _cpp_lex_token(), _cpp_scan_out_logical_line(), and scan_out_logical_line().

void _cpp_init_directives ( cpp_reader pfile  ) 

Definition at line 1990 of file cpplib.c.

Referenced by _cpp_init_hashtable().

void _cpp_init_internal_pragmas ( cpp_reader pfile  ) 

Definition at line 1075 of file cpplib.c.

Referenced by _cpp_init_hashtable().

void _cpp_pop_buffer ( cpp_reader pfile  ) 

int _cpp_test_assertion ( cpp_reader pfile,
unsigned int *  value 
)

Definition at line 1688 of file cpplib.c.

Referenced by eval_token().

static void check_eol ( cpp_reader pfile  )  [static]

void cpp_assert ( cpp_reader pfile,
const char *  str 
)

Definition at line 1834 of file cpplib.c.

Referenced by finish_options().

void cpp_define ( cpp_reader pfile,
const char *  str 
)

unsigned int cpp_errors ( cpp_reader pfile  ) 

Definition at line 1878 of file cpplib.c.

Referenced by c_common_post_options(), and read_scan_file().

cpp_callbacks* cpp_get_callbacks ( cpp_reader pfile  ) 

struct line_maps* cpp_get_line_maps ( cpp_reader pfile  )  [read]

Definition at line 1902 of file cpplib.c.

cpp_options* cpp_get_options ( cpp_reader pfile  ) 

cpp_buffer* cpp_push_buffer ( cpp_reader pfile,
const uchar buffer,
size_t  len,
int  from_stage3,
int  return_at_eof 
)

void cpp_register_pragma ( cpp_reader pfile,
const char *  space,
const char *  name,
pragma_cb  handler 
)

void cpp_set_callbacks ( cpp_reader pfile,
cpp_callbacks cb 
)

Definition at line 1910 of file cpplib.c.

void cpp_unassert ( cpp_reader pfile,
const char *  str 
)

Definition at line 1843 of file cpplib.c.

Referenced by finish_options().

void cpp_undef ( cpp_reader pfile,
const char *  macro 
)

Definition at line 1825 of file cpplib.c.

Referenced by finish_options(), and process_file().

static uchar* dequote_string ( cpp_reader pfile,
const uchar str,
unsigned int  len 
) [static]

Definition at line 748 of file cpplib.c.

References _cpp_unaligned_alloc(), c, cpp_parse_escape(), dst, result, and uchar.

Referenced by do_line(), and do_linemarker().

static void destringize_and_run ( cpp_reader pfile,
const cpp_string in 
) [static]

Definition at line 1268 of file cpplib.c.

References alloca, dest, free(), cpp_string::len, result, run_directive(), src, cpp_string::text, and xnew.

Referenced by _cpp_do__Pragma().

static void directive_diagnostics ( cpp_reader pfile,
const directive dir,
int  indented 
) [static]

static void do_assert ( cpp_reader pfile  )  [static]

static void do_define ( cpp_reader pfile  )  [static]

Definition at line 519 of file cpplib.c.

References _cpp_create_definition(), CPP_OPTION, lex_macro_node(), and node.

static void do_diagnostic ( cpp_reader pfile,
int  code,
int  print_dir 
) [static]

Definition at line 933 of file cpplib.c.

References _cpp_begin_message(), cpp_output_line(), and fprintf().

Referenced by do_error(), do_pragma_dependency(), and do_warning().

static void do_elif ( cpp_reader pfile  )  [static]

static void do_else ( cpp_reader pfile  )  [static]

static void do_endif ( cpp_reader pfile  )  [static]

static void do_error ( cpp_reader pfile  )  [static]

Definition at line 951 of file cpplib.c.

References DL_ERROR, and do_diagnostic().

static void do_ident ( cpp_reader pfile  )  [static]

Definition at line 967 of file cpplib.c.

References check_eol(), cpp_error(), cpp_get_token(), DL_ERROR, str, cpp_token::str, and cpp_token::val.

static void do_if ( cpp_reader pfile  )  [static]

Definition at line 1398 of file cpplib.c.

References _cpp_parse_expr(), push_conditional(), skip, and T_IF.

static void do_ifdef ( cpp_reader pfile  )  [static]

static void do_ifndef ( cpp_reader pfile  )  [static]

static void do_import ( cpp_reader pfile  )  [static]

Definition at line 704 of file cpplib.c.

References do_include_common(), and IT_IMPORT.

static void do_include ( cpp_reader pfile  )  [static]

Definition at line 697 of file cpplib.c.

References do_include_common(), and IT_INCLUDE.

Referenced by do_include_next().

static void do_include_common ( cpp_reader pfile,
enum include_type  type 
) [static]

static void do_include_next ( cpp_reader pfile  )  [static]

Definition at line 711 of file cpplib.c.

References do_include_common(), and IT_INCLUDE_NEXT.

static void do_line ( cpp_reader pfile  )  [static]

static void do_linemarker ( cpp_reader pfile  )  [static]

static void do_pragma ( cpp_reader pfile  )  [static]

static void do_pragma_dependency ( cpp_reader pfile  )  [static]

static void do_pragma_once ( cpp_reader pfile  )  [static]

static void do_pragma_poison ( cpp_reader pfile  )  [static]

static void do_pragma_system_header ( cpp_reader pfile  )  [static]

static void do_sccs ( pfile   )  [static]

Definition at line 1342 of file cpplib.c.

static void do_unassert ( cpp_reader pfile  )  [static]

static void do_undef ( cpp_reader pfile  )  [static]

static void do_warning ( cpp_reader pfile  )  [static]

Definition at line 958 of file cpplib.c.

References DL_WARNING_SYSHDR, and do_diagnostic().

Referenced by c_cannot_inline_tree_fn(), and inlinable_function_p().

static void end_directive ( cpp_reader pfile,
int  skip_line 
) [static]

static struct answer** find_answer ( cpp_hashnode node,
const struct answer candidate 
) [static, read]

static const cpp_token* get__Pragma_string ( cpp_reader pfile  )  [static]

Definition at line 1247 of file cpplib.c.

References get_token_no_padding(), and NULL.

Referenced by _cpp_do__Pragma().

static const cpp_token* get_token_no_padding ( cpp_reader pfile  )  [static]

Definition at line 1233 of file cpplib.c.

References cpp_get_token(), and result.

Referenced by get__Pragma_string(), glue_header_name(), and parse_include().

static const cpp_token* glue_header_name ( cpp_reader pfile  )  [static]

static void handle_assertion ( cpp_reader pfile,
const char *  str,
int  type 
) [static]

Definition at line 1852 of file cpplib.c.

References alloca, buf, count, memcpy, p, run_directive(), strchr, and strlen().

Referenced by cpp_assert(), and cpp_unassert().

static struct pragma_entry* insert_pragma_entry ( cpp_reader pfile,
struct pragma_entry **  chain,
const cpp_hashnode pragma,
pragma_cb  handler 
) [static, read]

Definition at line 998 of file cpplib.c.

References _cpp_aligned_alloc(), and NULL.

Referenced by cpp_register_pragma(), and register_pragma().

static cpp_hashnode* lex_macro_node ( cpp_reader pfile  )  [static]

static struct pragma_entry* lookup_pragma_entry ( struct pragma_entry chain,
const cpp_hashnode pragma 
) [static, read]

Definition at line 984 of file cpplib.c.

Referenced by cpp_register_pragma(), do_pragma(), register_pragma(), and register_pragma_1().

static void handle_assertion PARAMS ( (cpp_reader *, const char *, int)   )  [static]

static struct answer** find_answer PARAMS ( (cpp_hashnode *, const struct answer *)   )  [static, read]

static int parse_answer PARAMS ( (cpp_reader *, struct answer **, int)   )  [static]

static void destringize_and_run PARAMS ( (cpp_reader *, const cpp_string *)   )  [static]

static struct pragma_entry* insert_pragma_entry PARAMS ( (cpp_reader *, struct pragma_entry **, const cpp_hashnode *, pragma_cb  )  [static, read]

static struct pragma_entry* lookup_pragma_entry PARAMS ( (struct pragma_entry *, const cpp_hashnode *pragma)   )  [static, read]

static void do_include_common PARAMS ( (cpp_reader *, enum include_type  )  [static]

static void do_diagnostic PARAMS ( (cpp_reader *, int, int)   )  [static]

static int strtoul_for_line PARAMS ( (const uchar *, unsigned int, unsigned long *)   )  [static]

static uchar* dequote_string PARAMS ( (cpp_reader *, const uchar *, unsigned int)   )  [static]

static unsigned int read_flag PARAMS ( (cpp_reader *, unsigned int)   )  [static]

static void push_conditional PARAMS ( (cpp_reader *, int, int, const cpp_hashnode *)   )  [static]

static void run_directive PARAMS ( (cpp_reader *, int, const char *, size_t  )  [static]

static void directive_diagnostics PARAMS ( (cpp_reader *, const directive *, int)   )  [static]

static void end_directive PARAMS ( (cpp_reader *, int)   )  [static]

static void skip_rest_of_line PARAMS ( (cpp_reader *)   )  [static]

static int parse_answer ( cpp_reader pfile,
struct answer **  answerp,
int  type 
) [static]

static cpp_hashnode* parse_assertion ( cpp_reader pfile,
struct answer **  answerp,
int  type 
) [static]

static const cpp_token* parse_include ( cpp_reader pfile  )  [static]

static void prepare_directive_trad ( cpp_reader pfile  )  [static]

static void push_conditional ( cpp_reader pfile,
int  skip,
int  type,
const cpp_hashnode cmacro 
) [static]

static unsigned int read_flag ( cpp_reader pfile,
unsigned int  last 
) [static]

static void run_directive ( cpp_reader pfile,
int  dir_no,
const char *  buf,
size_t  count 
) [static]

static void skip_rest_of_line ( cpp_reader pfile  )  [static]

static void start_directive ( cpp_reader pfile  )  [static]

Definition at line 231 of file cpplib.c.

Referenced by _cpp_handle_directive(), destringize_and_run(), and run_directive().

static int strtoul_for_line ( uchar str,
unsigned int  len,
unsigned long nump 
) const [static]

Definition at line 774 of file cpplib.c.

References c, ISDIGIT, and uchar.

Referenced by do_line(), and do_linemarker().


Variable Documentation

const directive dtable[] [static]

Initial value:

Definition at line 187 of file cpplib.c.

Referenced by expand_invoke(), invoke_build_dtable(), and make_class_data().

const directive linemarker_dir [static]

Initial value:

{
  do_linemarker, U"#", 1, KANDR, IN_I
}

Definition at line 197 of file cpplib.c.


Generated on Wed Apr 8 15:30:22 2009 for Open64 by  doxygen 1.5.6