Commit 23ff0223 by Neil Booth Committed by Neil Booth

cppexp.c (cpp_interpret_integer, [...]): Clarify and correct use of "bool" variables.

	* cppexp.c (cpp_interpret_integer, append_digit, parse_defined,
	eval_token): Clarify and correct use of "bool" variables.
	* cpplib.h (struct cpp_options): Similarly.
	* cppmacro.c (parse_params, _cpp_save_parameter): Ditto.
	* cpptrad.c (recursive_macro): Similarly.

From-SVN: r55536
parent db50171f
2002-07-17 Neil Booth <neil@daikokuya.co.uk>
* cppexp.c (cpp_interpret_integer, append_digit, parse_defined,
eval_token): Clarify and correct use of "bool" variables.
* cpplib.h (struct cpp_options): Similarly.
* cppmacro.c (parse_params, _cpp_save_parameter): Ditto.
* cpptrad.c (recursive_macro): Similarly.
Wed Jul 17 17:08:06 2002 J"orn Rennecke <joern.rennecke@superh.com> Wed Jul 17 17:08:06 2002 J"orn Rennecke <joern.rennecke@superh.com>
* config/sh/lib1funcs.asm (udivsi3_i4): Implement SHcompact version in * config/sh/lib1funcs.asm (udivsi3_i4): Implement SHcompact version in
......
...@@ -318,8 +318,8 @@ cpp_interpret_integer (pfile, token, type) ...@@ -318,8 +318,8 @@ cpp_interpret_integer (pfile, token, type)
result.low = 0; result.low = 0;
result.high = 0; result.high = 0;
result.unsignedp = type & CPP_N_UNSIGNED; result.unsignedp = !!(type & CPP_N_UNSIGNED);
result.overflow = 0; result.overflow = false;
p = token->val.str.text; p = token->val.str.text;
end = p + token->val.str.len; end = p + token->val.str.len;
...@@ -387,7 +387,7 @@ cpp_interpret_integer (pfile, token, type) ...@@ -387,7 +387,7 @@ cpp_interpret_integer (pfile, token, type)
if (base == 10) if (base == 10)
cpp_error (pfile, DL_WARNING, cpp_error (pfile, DL_WARNING,
"integer constant is so large that it is unsigned"); "integer constant is so large that it is unsigned");
result.unsignedp = 1; result.unsignedp = true;
} }
} }
...@@ -409,7 +409,7 @@ append_digit (num, digit, base, precision) ...@@ -409,7 +409,7 @@ append_digit (num, digit, base, precision)
/* Multiply by 8 or 16. Catching this overflow here means we don't /* Multiply by 8 or 16. Catching this overflow here means we don't
need to worry about add_high overflowing. */ need to worry about add_high overflowing. */
overflow = num.high >> (PART_PRECISION - shift); overflow = !!(num.high >> (PART_PRECISION - shift));
result.high = num.high << shift; result.high = num.high << shift;
result.low = num.low << shift; result.low = num.low << shift;
result.high |= num.low >> (PART_PRECISION - shift); result.high |= num.low >> (PART_PRECISION - shift);
...@@ -507,9 +507,9 @@ parse_defined (pfile) ...@@ -507,9 +507,9 @@ parse_defined (pfile)
pfile->state.prevent_expansion--; pfile->state.prevent_expansion--;
result.unsignedp = 0; result.unsignedp = false;
result.high = 0; result.high = 0;
result.overflow = 0; result.overflow = false;
result.low = node && node->type == NT_MACRO; result.low = node && node->type == NT_MACRO;
return result; return result;
} }
...@@ -604,8 +604,8 @@ eval_token (pfile, token) ...@@ -604,8 +604,8 @@ eval_token (pfile, token)
result.low = temp; result.low = temp;
} }
result.unsignedp = unsignedp; result.unsignedp = !!unsignedp;
result.overflow = 0; result.overflow = false;
return result; return result;
} }
......
...@@ -402,8 +402,8 @@ struct cpp_options ...@@ -402,8 +402,8 @@ struct cpp_options
ints and target wide characters, respectively. */ ints and target wide characters, respectively. */
size_t precision, char_precision, int_precision, wchar_precision; size_t precision, char_precision, int_precision, wchar_precision;
/* Nonzero means chars (wide chars) are unsigned. */ /* True means chars (wide chars) are unsigned. */
unsigned char unsigned_char, unsigned_wchar; bool unsigned_char, unsigned_wchar;
/* Nonzero means __STDC__ should have the value 0 in system headers. */ /* Nonzero means __STDC__ should have the value 0 in system headers. */
unsigned char stdc_0_in_system_headers; unsigned char stdc_0_in_system_headers;
......
...@@ -69,7 +69,7 @@ static cpp_token *alloc_expansion_token PARAMS ((cpp_reader *, cpp_macro *)); ...@@ -69,7 +69,7 @@ static cpp_token *alloc_expansion_token PARAMS ((cpp_reader *, cpp_macro *));
static cpp_token *lex_expansion_token PARAMS ((cpp_reader *, cpp_macro *)); static cpp_token *lex_expansion_token PARAMS ((cpp_reader *, cpp_macro *));
static bool warn_of_redefinition PARAMS ((cpp_reader *, const cpp_hashnode *, static bool warn_of_redefinition PARAMS ((cpp_reader *, const cpp_hashnode *,
const cpp_macro *)); const cpp_macro *));
static int parse_params PARAMS ((cpp_reader *, cpp_macro *)); static bool parse_params PARAMS ((cpp_reader *, cpp_macro *));
static void check_trad_stringification PARAMS ((cpp_reader *, static void check_trad_stringification PARAMS ((cpp_reader *,
const cpp_macro *, const cpp_macro *,
const cpp_string *)); const cpp_string *));
...@@ -1245,7 +1245,7 @@ _cpp_save_parameter (pfile, macro, node) ...@@ -1245,7 +1245,7 @@ _cpp_save_parameter (pfile, macro, node)
{ {
cpp_error (pfile, DL_ERROR, "duplicate macro parameter \"%s\"", cpp_error (pfile, DL_ERROR, "duplicate macro parameter \"%s\"",
NODE_NAME (node)); NODE_NAME (node));
return 1; return true;
} }
if (BUFF_ROOM (pfile->a_buff) if (BUFF_ROOM (pfile->a_buff)
...@@ -1254,11 +1254,12 @@ _cpp_save_parameter (pfile, macro, node) ...@@ -1254,11 +1254,12 @@ _cpp_save_parameter (pfile, macro, node)
((cpp_hashnode **) BUFF_FRONT (pfile->a_buff))[macro->paramc++] = node; ((cpp_hashnode **) BUFF_FRONT (pfile->a_buff))[macro->paramc++] = node;
node->arg_index = macro->paramc; node->arg_index = macro->paramc;
return 0; return false;
} }
/* Check the syntax of the parameters in a MACRO definition. */ /* Check the syntax of the parameters in a MACRO definition. Returns
static int false if an error occurs. */
static bool
parse_params (pfile, macro) parse_params (pfile, macro)
cpp_reader *pfile; cpp_reader *pfile;
cpp_macro *macro; cpp_macro *macro;
...@@ -1281,31 +1282,31 @@ parse_params (pfile, macro) ...@@ -1281,31 +1282,31 @@ parse_params (pfile, macro)
cpp_error (pfile, DL_ERROR, cpp_error (pfile, DL_ERROR,
"\"%s\" may not appear in macro parameter list", "\"%s\" may not appear in macro parameter list",
cpp_token_as_text (pfile, token)); cpp_token_as_text (pfile, token));
return 0; return false;
case CPP_NAME: case CPP_NAME:
if (prev_ident) if (prev_ident)
{ {
cpp_error (pfile, DL_ERROR, cpp_error (pfile, DL_ERROR,
"macro parameters must be comma-separated"); "macro parameters must be comma-separated");
return 0; return false;
} }
prev_ident = 1; prev_ident = 1;
if (_cpp_save_parameter (pfile, macro, token->val.node)) if (_cpp_save_parameter (pfile, macro, token->val.node))
return 0; return false;
continue; continue;
case CPP_CLOSE_PAREN: case CPP_CLOSE_PAREN:
if (prev_ident || macro->paramc == 0) if (prev_ident || macro->paramc == 0)
return 1; return true;
/* Fall through to pick up the error. */ /* Fall through to pick up the error. */
case CPP_COMMA: case CPP_COMMA:
if (!prev_ident) if (!prev_ident)
{ {
cpp_error (pfile, DL_ERROR, "parameter name missing"); cpp_error (pfile, DL_ERROR, "parameter name missing");
return 0; return false;
} }
prev_ident = 0; prev_ident = 0;
continue; continue;
...@@ -1328,12 +1329,12 @@ parse_params (pfile, macro) ...@@ -1328,12 +1329,12 @@ parse_params (pfile, macro)
/* We're at the end, and just expect a closing parenthesis. */ /* We're at the end, and just expect a closing parenthesis. */
token = _cpp_lex_token (pfile); token = _cpp_lex_token (pfile);
if (token->type == CPP_CLOSE_PAREN) if (token->type == CPP_CLOSE_PAREN)
return 1; return true;
/* Fall through. */ /* Fall through. */
case CPP_EOF: case CPP_EOF:
cpp_error (pfile, DL_ERROR, "missing ')' in macro parameter list"); cpp_error (pfile, DL_ERROR, "missing ')' in macro parameter list");
return 0; return false;
} }
} }
} }
......
...@@ -802,7 +802,7 @@ recursive_macro (pfile, node) ...@@ -802,7 +802,7 @@ recursive_macro (pfile, node)
cpp_reader *pfile; cpp_reader *pfile;
cpp_hashnode *node; cpp_hashnode *node;
{ {
bool recursing = node->flags & NODE_DISABLED; bool recursing = !!(node->flags & NODE_DISABLED);
/* Object-like macros that are already expanding are necessarily /* Object-like macros that are already expanding are necessarily
recursive. recursive.
......
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