Commit 644eddaa by Neil Booth Committed by Neil Booth

cpphash.h: Update comments.

	* cpphash.h: Update comments.
	(cpp_context): Update.
	(spec_nodes): Remove n__Pragma.
	* cppinit.c (cpp_create_reader): Update.
	(builtin_array): Add _Pragma.
	* cpplib.h: Update comments.
	(NODE_DISABLED, BT_PRAGMA): New.
	(cpp_start_lookahead, cpp_stop_lookahead): Remove prototypes.
	* cppmacro.c (struct cpp_macro): Remove disabled.
	(builtin_macro): Return int, handle _Pragma, push the new token
	on the context stack.
	(funlike_invocation_p): Unconstify, update.
	(enter_macro_context): Handle builtins here.
	(replace_args, push_token_context, push_ptoken_context):
	Update for prototype changes.
	(_cpp_pop_context): Update.
	(cpp_get_token): Don't handle buitins, nor _Pragma here.
	(cpp_sys_macro_p): Update.
	(_cpp_free_definition): Clear disabled flag.
	(_cpp_create_definition): Upate.
	* cppmain.c: Update comments.

From-SVN: r45948
parent 9d19cb95
2001-10-02 Neil Booth <neil@daikokuya.demon.co.uk>
* cpphash.h: Update comments.
(cpp_context): Update.
(spec_nodes): Remove n__Pragma.
* cppinit.c (cpp_create_reader): Update.
(builtin_array): Add _Pragma.
* cpplib.h: Update comments.
(NODE_DISABLED, BT_PRAGMA): New.
(cpp_start_lookahead, cpp_stop_lookahead): Remove prototypes.
* cppmacro.c (struct cpp_macro): Remove disabled.
(builtin_macro): Return int, handle _Pragma, push the new token
on the context stack.
(funlike_invocation_p): Unconstify, update.
(enter_macro_context): Handle builtins here.
(replace_args, push_token_context, push_ptoken_context):
Update for prototype changes.
(_cpp_pop_context): Update.
(cpp_get_token): Don't handle buitins, nor _Pragma here.
(cpp_sys_macro_p): Update.
(_cpp_free_definition): Clear disabled flag.
(_cpp_create_definition): Upate.
* cppmain.c: Update comments.
Tue Oct 2 12:46:01 CEST 2001 Bo Thorsen <bo@suse.co.uk>,
Andreas Jaeger <aj@suse.de>,
Jan Hubicka <jh@suse.cz>
......
......@@ -42,7 +42,7 @@ struct directive; /* Deliberately incomplete. */
efficiency, and partly to limit runaway recursion. */
#define CPP_STACK_MAX 200
/* A generic memory buffer. */
/* A generic memory buffer, and operations on it. */
typedef struct _cpp_buff _cpp_buff;
struct _cpp_buff
......@@ -59,6 +59,7 @@ extern _cpp_buff *_cpp_append_extend_buff PARAMS ((cpp_reader *, _cpp_buff *,
extern void _cpp_free_buff PARAMS ((_cpp_buff *));
extern unsigned char *_cpp_aligned_alloc PARAMS ((cpp_reader *, size_t));
extern unsigned char *_cpp_unaligned_alloc PARAMS ((cpp_reader *, size_t));
#define BUFF_ROOM(BUFF) (size_t) ((BUFF)->limit - (BUFF)->cur)
#define BUFF_FRONT(BUFF) ((BUFF)->cur)
#define BUFF_LIMIT(BUFF) ((BUFF)->limit)
......@@ -114,8 +115,8 @@ struct cpp_context
When the context is popped, the buffer is released. */
_cpp_buff *buff;
/* For a macro context, these are the macro and its arguments. */
cpp_macro *macro;
/* For a macro context, the macro node, otherwise NULL. */
cpp_hashnode *macro;
/* True if utoken element is token, else ptoken. */
bool direct_p;
......@@ -162,7 +163,6 @@ struct spec_nodes
cpp_hashnode *n_defined; /* defined operator */
cpp_hashnode *n_true; /* C++ keyword true */
cpp_hashnode *n_false; /* C++ keyword false */
cpp_hashnode *n__Pragma; /* _Pragma operator */
cpp_hashnode *n__STRICT_ANSI__; /* STDC_0_IN_SYSTEM_HEADERS */
cpp_hashnode *n__CHAR_UNSIGNED__; /* plain char is unsigned */
cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */
......@@ -178,7 +178,7 @@ struct cpp_buffer
struct cpp_buffer *prev;
const unsigned char *buf; /* Entire buffer. */
const unsigned char *buf; /* Entire character buffer. */
/* Pointer into the include table; non-NULL if this is a file
buffer. Used for include_next and to record control macros. */
......
......@@ -547,7 +547,6 @@ cpp_create_reader (table, lang)
s->n_defined = cpp_lookup (pfile, DSC("defined"));
s->n_true = cpp_lookup (pfile, DSC("true"));
s->n_false = cpp_lookup (pfile, DSC("false"));
s->n__Pragma = cpp_lookup (pfile, DSC("_Pragma"));
s->n__STRICT_ANSI__ = cpp_lookup (pfile, DSC("__STRICT_ANSI__"));
s->n__CHAR_UNSIGNED__ = cpp_lookup (pfile, DSC("__CHAR_UNSIGNED__"));
s->n__VA_ARGS__ = cpp_lookup (pfile, DSC("__VA_ARGS__"));
......@@ -658,6 +657,7 @@ static const struct builtin builtin_array[] =
B("__BASE_FILE__", BT_BASE_FILE),
B("__LINE__", BT_SPECLINE),
B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL),
B("_Pragma", BT_PRAGMA),
X("__VERSION__", VERS),
X("__USER_LABEL_PREFIX__", ULP),
......
......@@ -168,7 +168,7 @@ struct cpp_string
#define BOL (1 << 6) /* Token at beginning of line. */
/* A preprocessing token. This has been carefully packed and should
occupy 12 bytes on 32-bit hosts and 16 bytes on 64-bit hosts. */
occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */
struct cpp_token
{
unsigned int line; /* Logical line of first char of token. */
......@@ -353,7 +353,7 @@ struct cpp_options
/* Print column number in error messages. */
unsigned char show_column;
/* Treat C++ alternate operator names special. */
/* Nonzero means handle C++ alternate operator names. */
unsigned char operator_names;
/* True if --help, --version or --target-help appeared in the
......@@ -400,6 +400,7 @@ extern const char *progname;
#define NODE_BUILTIN (1 << 2) /* Builtin macro. */
#define NODE_DIAGNOSTIC (1 << 3) /* Possible diagnostic when lexed. */
#define NODE_WARN (1 << 4) /* Warn if redefined or undefined. */
#define NODE_DISABLED (1 << 5) /* A disabled macro. */
/* Different flavors of hash node. */
enum node_type
......@@ -409,7 +410,8 @@ enum node_type
NT_ASSERTION /* Predicate for #assert. */
};
/* Different flavors of builtin macro. */
/* Different flavors of builtin macro. _Pragma is an operator, but we
handle it with the builtin code for efficiency reasons. */
enum builtin_type
{
BT_SPECLINE = 0, /* `__LINE__' */
......@@ -418,7 +420,8 @@ enum builtin_type
BT_BASE_FILE, /* `__BASE_FILE__' */
BT_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
BT_TIME, /* `__TIME__' */
BT_STDC /* `__STDC__' */
BT_STDC, /* `__STDC__' */
BT_PRAGMA /* `_Pragma' operator */
};
#define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE))
......@@ -568,8 +571,6 @@ extern void cpp_forall_identifiers PARAMS ((cpp_reader *,
/* In cppmacro.c */
extern void cpp_scan_nooutput PARAMS ((cpp_reader *));
extern void cpp_start_lookahead PARAMS ((cpp_reader *));
extern void cpp_stop_lookahead PARAMS ((cpp_reader *, int));
extern int cpp_sys_macro_p PARAMS ((cpp_reader *));
/* In cppfiles.c */
......
......@@ -215,8 +215,8 @@ setup_callbacks ()
}
}
/* Writes out the preprocessed file. Alternates between two tokens,
so that we can avoid accidental token pasting. */
/* Writes out the preprocessed file, handling spacing and paste
avoidance issues. */
static void
scan_translation_unit (pfile)
cpp_reader *pfile;
......@@ -334,7 +334,7 @@ print_line (map, line, special_flags)
}
/* Called when a line of output is started. TOKEN is the first token
of the line, and maybe be CPP_EOF. */
of the line, and may be CPP_EOF. */
static void
cb_line_change (pfile, token, parsing_args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment