aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-03-08 23:35:19 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-03-08 23:35:19 +0000
commit88ae23e71dffcd197fc5410a582a470fcbcc2ba9 (patch)
treed22a67043ad8f0cb553637f8f1774978410ad8d9 /gcc/cppexp.c
parent737faf1404678b40cb1f5dcf2ca816d2872fb347 (diff)
downloadgcc-88ae23e71dffcd197fc5410a582a470fcbcc2ba9.zip
gcc-88ae23e71dffcd197fc5410a582a470fcbcc2ba9.tar.gz
gcc-88ae23e71dffcd197fc5410a582a470fcbcc2ba9.tar.bz2
Makefile.in (LIBCPP_DEPS): New macro.
* Makefile.in (LIBCPP_DEPS): New macro. (cpplib.o, cpphash.o, cpperror.o, cppexp.o, cppfiles.o): Use it to declare deps. * cpperror.c: Include cpphash.h. * cppexp.c: Include cpphash.h. Remove MULTIBYTE_CHARS dingleberry. (lex): Don't use CPP_WARN_UNDEF. (_cpp_parse_expr): Return an int, the truth value. * cppfiles.c: Include cpphash.h. (_cpp_merge_include_chains): Move to cppinit.c and make static. * cppinit.c (include_defaults_array): Disentangle. (cpp_cleanup): Don't free the if stack here. (cpp_finish): Pop off all buffers, not just one. * cpplib.c (eval_if_expr): Return int. (do_xifdef): Rename do_ifdef. (handle_directive): Don't use CPP_PREPROCESSED. (cpp_get_token): Don't use CPP_C89. * fix-header.c: Don't use CPP_OPTIONS. * cpplib.h: Move U_CHAR, enum node_type, struct file_name_list, struct ihash, is_idchar, is_idstart, is_numchar, is_numstart, is_hspace, is_space, CPP_BUF_PEEK, CPP_BUF_GET, CPP_FORWARD, CPP_PUTS, CPP_PUTS_Q, CPP_PUTC, CPP_PUTC_Q, CPP_NUL_TERMINATE, CPP_NUL_TERMINATE_Q, CPP_BUMP_BUFFER_LINE, CPP_BUMP_LINE, CPP_PREV_BUFFER, CPP_PRINT_DEPS, CPP_TRADITIONAL, CPP_PEDANTIC, and prototypes of _cpp_simplify_pathname, _cpp_find_include_file, _cpp_read_include_file, and _cpp_parse_expr to cpphash.h. Move struct if_stack to cpplib.c. Move struct cpp_pending to cppinit.c. Change all uses of U_CHAR to be unsigned char instead. Delete CPP_WARN_UNDEF, CPP_C89, and CPP_PREPROCESSED. From-SVN: r32435
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 3ed818c..bb2ae7a 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -27,10 +27,7 @@ Written by Per Bothner 1994. */
#include "config.h"
#include "system.h"
#include "cpplib.h"
-
-#ifdef MULTIBYTE_CHARS
-#include <locale.h>
-#endif
+#include "cpphash.h"
#ifndef CHAR_TYPE_SIZE
#define CHAR_TYPE_SIZE BITS_PER_UNIT
@@ -453,7 +450,7 @@ lex (pfile, skip_evaluation)
op.unsignedp = 0;
op.value = 0;
- if (CPP_WARN_UNDEF (pfile) && !skip_evaluation)
+ if (CPP_OPTIONS (pfile)->warn_undef && !skip_evaluation)
cpp_warning (pfile, "`%.*s' is not defined",
(int) (tok_end - tok_start), tok_start);
return op;
@@ -669,9 +666,9 @@ right_shift (pfile, a, unsignedp, b)
? (unsigned HOST_WIDEST_INT) v1 OP (unsigned HOST_WIDEST_INT) v2 : (v1 OP v2)
/* Parse and evaluate a C expression, reading from PFILE.
- Returns the value of the expression. */
+ Returns the truth value of the expression. */
-HOST_WIDEST_INT
+int
_cpp_parse_expr (pfile)
cpp_reader *pfile;
{
@@ -1004,7 +1001,7 @@ _cpp_parse_expr (pfile)
cpp_ice (pfile, "unbalanced stack in #if expression");
if (stack != init_stack)
free (stack);
- return top->value;
+ return (top->value != 0);
}
top++;