osprey-gcc/libcpp/directives.c File Reference

#include "config.h"
#include "system.h"
#include "cpplib.h"
#include "internal.h"
#include "mkdeps.h"
#include "obstack.h"

Include dependency graph for directives.c:

Go to the source code of this file.

Data Types

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 do_##name (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 )(cpp_reader *)
typedef void(* directive_handler )(cpp_reader *)
typedef struct directive directive

Enumerations

enum  { N_DIRECTIVES }

Functions/Subroutines

static void skip_rest_of_line (cpp_reader *)
static void check_eol (cpp_reader *)
static void start_directive (cpp_reader *)
static void prepare_directive_trad (cpp_reader *)
static void end_directive (cpp_reader *, int)
static void directive_diagnostics (cpp_reader *, const directive *, int)
static void run_directive (cpp_reader *, int, const char *, size_t)
static char * glue_header_name (cpp_reader *)
static const char * parse_include (cpp_reader *, int *)
static void push_conditional (cpp_reader *, int, int, const cpp_hashnode *)
static unsigned int read_flag (cpp_reader *, unsigned int)
static int strtoul_for_line (const uchar *, unsigned int, unsigned long *)
static void do_diagnostic (cpp_reader *, int, int)
static cpp_hashnodelex_macro_node (cpp_reader *)
static int undefine_macros (cpp_reader *, cpp_hashnode *, void *)
static void do_include_common (cpp_reader *, enum include_type)
static struct pragma_entrylookup_pragma_entry (struct pragma_entry *, const cpp_hashnode *)
static struct pragma_entryinsert_pragma_entry (cpp_reader *, struct pragma_entry **, const cpp_hashnode *, pragma_cb, bool, bool)
static void register_pragma (cpp_reader *, const char *, const char *, pragma_cb, bool, bool)
static int count_registered_pragmas (struct pragma_entry *)
static char ** save_registered_pragmas (struct pragma_entry *, char **)
static char ** restore_registered_pragmas (cpp_reader *, struct pragma_entry *, char **)
static void do_pragma_once (cpp_reader *)
static void do_pragma_poison (cpp_reader *)
static void do_pragma_system_header (cpp_reader *)
static void do_pragma_dependency (cpp_reader *)
static void do_linemarker (cpp_reader *)
static const cpp_tokenget_token_no_padding (cpp_reader *)
static const cpp_tokenget__Pragma_string (cpp_reader *)
static void destringize_and_run (cpp_reader *, const cpp_string *)
static int parse_answer (cpp_reader *, struct answer **, int)
static cpp_hashnodeparse_assertion (cpp_reader *, struct answer **, int)
static struct answer ** find_answer (cpp_hashnode *, const struct answer *)
static void handle_assertion (cpp_reader *, const char *, int)
int _cpp_handle_directive (cpp_reader *pfile, int indented)
static void do_define (cpp_reader *pfile)
static void do_undef (cpp_reader *pfile)
static int undefine_macros (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *h, void *data_p ATTRIBUTE_UNUSED)
void cpp_undef_all (cpp_reader *pfile)
static void do_include (cpp_reader *pfile)
static void do_import (cpp_reader *pfile)
static void do_include_next (cpp_reader *pfile)
static int strtoul_for_line (const uchar *str, unsigned int len, long unsigned int *nump)
static void do_line (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_error (cpp_reader *pfile)
static void do_warning (cpp_reader *pfile)
static void do_ident (cpp_reader *pfile)
void cpp_register_pragma (cpp_reader *pfile, const char *space, const char *name, pragma_cb handler, bool allow_expansion)
void _cpp_init_internal_pragmas (cpp_reader *pfile)
char ** _cpp_save_pragma_names (cpp_reader *pfile)
void _cpp_restore_pragma_names (cpp_reader *pfile, char **saved)
static void do_pragma (cpp_reader *pfile)
void _cpp_do__Pragma (cpp_reader *pfile)
void cpp_handle_deferred_pragma (cpp_reader *pfile, const cpp_string *s)
static void do_sccs (cpp_reader *pfile ATTRIBUTE_UNUSED)
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)
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)
unsigned int cpp_errors (cpp_reader *pfile)
cpp_optionscpp_get_options (cpp_reader *pfile)
cpp_callbackscpp_get_callbacks (cpp_reader *pfile)
void cpp_set_callbacks (cpp_reader *pfile, cpp_callbacks *cb)
struct depscpp_get_deps (cpp_reader *pfile)
cpp_buffercpp_push_buffer (cpp_reader *pfile, const uchar *buffer, size_t len, int from_stage3)
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 70 of file directives.c.

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

Value:

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

Definition at line 177 of file directives.c.

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

Definition at line 177 of file directives.c.

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

Definition at line 177 of file directives.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 141 of file directives.c.

#define EXPAND   (1 << 4)

Definition at line 74 of file directives.c.

#define EXTENSION   2

Definition at line 61 of file directives.c.

#define IF_COND   (1 << 1)

Definition at line 71 of file directives.c.

#define IN_I   (1 << 3)

Definition at line 73 of file directives.c.

#define INCL   (1 << 2)

Definition at line 72 of file directives.c.

#define KANDR   0

Definition at line 59 of file directives.c.

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

Definition at line 195 of file directives.c.

#define STDC89   1

Definition at line 60 of file directives.c.


Typedef Documentation

Definition at line 78 of file directives.c.

Definition at line 77 of file directives.c.

typedef void(* pragma_cb)(cpp_reader *)

Definition at line 42 of file directives.c.


Enumeration Type Documentation

anonymous enum

Enumerator:
N_DIRECTIVES 

Definition at line 170 of file directives.c.


Function Documentation

void _cpp_define_builtin ( cpp_reader pfile,
const char *  str 
)

Definition at line 1939 of file directives.c.

References alloca, buf, len, memcpy, run_directive(), strlen(), and T_DEFINE.

void _cpp_do__Pragma ( 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 
)

int _cpp_handle_directive ( cpp_reader pfile,
int  indented 
)

void _cpp_init_directives ( cpp_reader pfile  ) 

Definition at line 2093 of file directives.c.

References cpp_lookup(), cpp_hashnode::directive_index, i, int, length, N_DIRECTIVES, and node.

void _cpp_init_internal_pragmas ( cpp_reader pfile  ) 

void _cpp_pop_buffer ( cpp_reader pfile  ) 

void _cpp_restore_pragma_names ( cpp_reader pfile,
char **  saved 
)

Definition at line 1148 of file directives.c.

Referenced by cpp_read_state().

char** _cpp_save_pragma_names ( cpp_reader pfile  ) 

Definition at line 1119 of file directives.c.

Referenced by cpp_prepare_state().

int _cpp_test_assertion ( cpp_reader pfile,
unsigned int *  value 
)

static void check_eol ( cpp_reader pfile  )  [static]

static int count_registered_pragmas ( struct pragma_entry pe  )  [static]

void cpp_assert ( cpp_reader pfile,
const char *  str 
)

Definition at line 1961 of file directives.c.

References handle_assertion(), and T_ASSERT.

void cpp_define ( cpp_reader pfile,
const char *  str 
)

Definition at line 1911 of file directives.c.

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

unsigned int cpp_errors ( cpp_reader pfile  ) 

Definition at line 1998 of file directives.c.

References cpp_reader::errors.

cpp_callbacks* cpp_get_callbacks ( cpp_reader pfile  ) 

Definition at line 2012 of file directives.c.

References cpp_reader::cb.

struct deps* cpp_get_deps ( cpp_reader pfile  )  [read]

Definition at line 2026 of file directives.c.

Referenced by handle_deferred_opts(), and reader_init().

cpp_options* cpp_get_options ( cpp_reader pfile  ) 

Definition at line 2005 of file directives.c.

References cpp_reader::opts.

void cpp_handle_deferred_pragma ( cpp_reader pfile,
const cpp_string s 
)

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

Definition at line 2037 of file directives.c.

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

Definition at line 1062 of file directives.c.

References register_pragma().

void cpp_set_callbacks ( cpp_reader pfile,
cpp_callbacks cb 
)

Definition at line 2019 of file directives.c.

References cpp_reader::cb.

void cpp_unassert ( cpp_reader pfile,
const char *  str 
)

Definition at line 1968 of file directives.c.

References handle_assertion(), and T_UNASSERT.

void cpp_undef ( cpp_reader pfile,
const char *  macro 
)

Definition at line 1950 of file directives.c.

References alloca, buf, len, memcpy, run_directive(), strlen(), and T_UNDEF.

void cpp_undef_all ( cpp_reader pfile  ) 

Definition at line 570 of file directives.c.

Referenced by c_common_parse_file().

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

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]

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

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 936 of file directives.c.

References CPP_DL_ERROR, and do_diagnostic().

static void do_ident ( cpp_reader pfile  )  [static]

static void do_if ( cpp_reader pfile  )  [static]

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 directives.c.

References do_include_common(), and IT_IMPORT.

static void do_include ( cpp_reader pfile  )  [static]

Definition at line 698 of file directives.c.

References do_include_common(), and IT_INCLUDE.

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

static void do_include_next ( cpp_reader pfile  )  [static]

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 ( cpp_reader *pfile  ATTRIBUTE_UNUSED  )  [static]

Definition at line 1478 of file directives.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 942 of file directives.c.

References CPP_DL_WARNING_SYSHDR, and do_diagnostic().

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 1356 of file directives.c.

References get_token_no_padding(), and NULL.

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

Definition at line 1343 of file directives.c.

References cpp_get_token(), and result.

static char * glue_header_name ( cpp_reader pfile  )  [static]

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

Definition at line 1975 of file directives.c.

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

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

Definition at line 979 of file directives.c.

References _cpp_aligned_alloc(), and NULL.

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 966 of file directives.c.

References pragma_entry::next, and pragma_entry::pragma.

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 char * parse_include ( cpp_reader pfile,
int *  pangle_brackets 
) [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 register_pragma ( cpp_reader pfile,
const char *  space,
const char *  name,
pragma_cb  handler,
bool  allow_expansion,
bool  internal 
) [static]

static char ** restore_registered_pragmas ( cpp_reader pfile,
struct pragma_entry pe,
char **  sd 
) [static]

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

static char ** save_registered_pragmas ( struct pragma_entry pe,
char **  sd 
) [static]

static void skip_rest_of_line ( cpp_reader pfile  )  [static]

static void start_directive ( cpp_reader pfile  )  [static]

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

Definition at line 754 of file directives.c.

References c, ISDIGIT, and uchar.

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

static int undefine_macros ( cpp_reader *pfile  ATTRIBUTE_UNUSED,
cpp_hashnode h,
void *data_p  ATTRIBUTE_UNUSED 
) [static]

Definition at line 557 of file directives.c.

References cpp_hashnode::flags, NODE_BUILTIN, NODE_DISABLED, NODE_POISONED, and NT_VOID.

static int undefine_macros ( cpp_reader ,
cpp_hashnode ,
void  
) [static]

Referenced by cpp_undef_all().


Variable Documentation

const directive dtable[] [static]

Initial value:

Definition at line 180 of file directives.c.

const directive linemarker_dir [static]

Initial value:

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

Definition at line 190 of file directives.c.


Generated on Wed Apr 8 14:23:17 2009 for Open64 by  doxygen 1.5.6