Commit a2a76ce7 by Zack Weinberg Committed by Zack Weinberg

cpphash.c: Fix formatting, update commentary.

	* cpphash.c: Fix formatting, update commentary.
	(dump_definition): Take three separate arguments instead of a
	MACRODEF structure argument.
	* cpphash.h: Update prototype of dump_definition.
	* cppinit.c (cpp_finish): Update call of dump_definition.

	* cpplib.c (do_define): Always create new hash entry with
	T_MACRO type.  Remove redundant check for redefinition of
	poisoned identifier.  Update call of dump_definition.
	(do_undef): Don't call check_macro_name.  Rename sym_length to
	len.
	(do_error, do_warning): Don't use copy_rest_of_line or
	SKIP_WHITE_SPACE.
	(do_warning): Don't use pedwarn for the actual warning,
	only the notice about its not being in the standard.  (Fixes
	bug with #warning in system headers.)
	(do_ident): Stricter argument checking - accept only a single
	string after #ident.  Also, macro-expand the line.
	(do_xifdef): Use cpp_defined.  De-obfuscate.

	(do_pragma): Split out specific pragma handling to separate
	functions.  Use get_directive_token.  Update commentary.  Do
	not pass on #pragma once or #pragma poison to the front end.
	(do_pragma_once, do_pragma_implementation, do_pragma_poison,
	do_pragma_default): New.

From-SVN: r31931
parent 2144ddea
2000-02-11 Zack Weinberg <zack@wolery.cumb.org>
* cpphash.c: Fix formatting, update commentary.
(dump_definition): Take three separate arguments instead of a
MACRODEF structure argument.
* cpphash.h: Update prototype of dump_definition.
* cppinit.c (cpp_finish): Update call of dump_definition.
* cpplib.c (do_define): Always create new hash entry with
T_MACRO type. Remove redundant check for redefinition of
poisoned identifier. Update call of dump_definition.
(do_undef): Don't call check_macro_name. Rename sym_length to
len.
(do_error, do_warning): Don't use copy_rest_of_line or
SKIP_WHITE_SPACE.
(do_warning): Don't use pedwarn for the actual warning,
only the notice about its not being in the standard. (Fixes
bug with #warning in system headers.)
(do_ident): Stricter argument checking - accept only a single
string after #ident. Also, macro-expand the line.
(do_xifdef): Use cpp_defined. De-obfuscate.
(do_pragma): Split out specific pragma handling to separate
functions. Use get_directive_token. Update commentary. Do
not pass on #pragma once or #pragma poison to the front end.
(do_pragma_once, do_pragma_implementation, do_pragma_poison,
do_pragma_default): New.
Feb 11 12:30:53 2000 Jeffrey A Law (law@cygnus.com) Feb 11 12:30:53 2000 Jeffrey A Law (law@cygnus.com)
* jump.c (jump_optimize_1): The first operand in a relational * jump.c (jump_optimize_1): The first operand in a relational
......
...@@ -89,8 +89,7 @@ struct argdata ...@@ -89,8 +89,7 @@ struct argdata
}; };
/* Return hash function on name. must be compatible with the one /* Calculate hash function on a string. */
computed a step at a time, elsewhere */
static unsigned int static unsigned int
hashf (s, len) hashf (s, len)
...@@ -169,7 +168,6 @@ void ...@@ -169,7 +168,6 @@ void
delete_macro (hp) delete_macro (hp)
HASHNODE *hp; HASHNODE *hp;
{ {
if (hp->prev != NULL) if (hp->prev != NULL)
hp->prev->next = hp->next; hp->prev->next = hp->next;
if (hp->next != NULL) if (hp->next != NULL)
...@@ -1575,15 +1573,15 @@ comp_def_part (first, beg1, len1, beg2, len2, last) ...@@ -1575,15 +1573,15 @@ comp_def_part (first, beg1, len1, beg2, len2, last)
to be read back in again. */ to be read back in again. */
void void
dump_definition (pfile, macro) dump_definition (pfile, sym, len, defn)
cpp_reader *pfile; cpp_reader *pfile;
MACRODEF macro; const U_CHAR *sym;
long len;
DEFINITION *defn;
{ {
DEFINITION *defn = macro.defn; CPP_RESERVE (pfile, len + sizeof "#define ");
CPP_RESERVE (pfile, macro.symlen + sizeof "#define ");
CPP_PUTS_Q (pfile, "#define ", sizeof "#define " -1); CPP_PUTS_Q (pfile, "#define ", sizeof "#define " -1);
CPP_PUTS_Q (pfile, macro.symnam, macro.symlen); CPP_PUTS_Q (pfile, sym, len);
if (defn->nargs == -1) if (defn->nargs == -1)
{ {
......
...@@ -107,6 +107,7 @@ extern MACRODEF create_definition PARAMS ((U_CHAR *, U_CHAR *, ...@@ -107,6 +107,7 @@ extern MACRODEF create_definition PARAMS ((U_CHAR *, U_CHAR *,
extern int compare_defs PARAMS ((cpp_reader *, DEFINITION *, extern int compare_defs PARAMS ((cpp_reader *, DEFINITION *,
DEFINITION *)); DEFINITION *));
extern void macroexpand PARAMS ((cpp_reader *, HASHNODE *)); extern void macroexpand PARAMS ((cpp_reader *, HASHNODE *));
extern void dump_definition PARAMS ((cpp_reader *, MACRODEF)); extern void dump_definition PARAMS ((cpp_reader *, const U_CHAR *, long,
DEFINITION *));
#endif #endif
...@@ -1040,16 +1040,12 @@ cpp_finish (pfile) ...@@ -1040,16 +1040,12 @@ cpp_finish (pfile)
{ {
int i; int i;
HASHNODE *h; HASHNODE *h;
MACRODEF m;
for (i = HASHSIZE; --i >= 0;) for (i = HASHSIZE; --i >= 0;)
{ {
for (h = pfile->hashtab[i]; h; h = h->next) for (h = pfile->hashtab[i]; h; h = h->next)
if (h->type == T_MACRO) if (h->type == T_MACRO)
{ {
m.defn = h->value.defn; dump_definition (pfile, h->name, h->length, h->value.defn);
m.symnam = h->name;
m.symlen = h->length;
dump_definition (pfile, m);
CPP_PUTC (pfile, '\n'); CPP_PUTC (pfile, '\n');
} }
} }
......
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