aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
AgeCommit message (Collapse)AuthorFilesLines
2003-08-03* cppexp.c (parse_defined): Warn only if -pedantic.Neil Booth1-1/+1
From-SVN: r70116
2003-07-19alias.c [...]: Remove unnecessary casts.Kaveh R. Ghazi1-2/+1
* alias.c alloc-pool.c bitmap.c bitmap.h bt-load.c builtins.c c-common.c c-decl.c c-incpath.c c-lex.c c-opts.c c-parse.in c-pragma.c c-typeck.c calls.c cfg.c cfganal.c cfgloop.c cfgrtl.c collect2.c combine.c conflict.c coverage.c cppexp.c cppfiles.c cpphash.c cppinit.c cpplex.c cpplib.c cppmacro.c cppspec.c cpptrad.c cse.c cselib.c dbxout.c defaults.h df.c dominance.c dwarf2out.c dwarfout.c emit-rtl.c except.c expmed.c expr.c final.c fix-header.c flow.c fold-const.c function.c gcc.c gccspec.c gcov.c gcse.c genattr.c genattrtab.c genautomata.c genconditions.c genemit.c genextract.c genoutput.c genrecog.c gensupport.c ggc-page.c ggc-simple.c global.c graph.c haifa-sched.c hashtable.c integrate.c jump.c langhooks.c lcm.c line-map.c local-alloc.c loop.c mips-tdump.c mips-tfile.c mkdeps.c optabs.c params.c postreload.c prefix.c print-tree.c protoize.c ra-build.c ra-colorize.c ra-rewrite.c ra.c recog.c reg-stack.c regclass.c regmove.c regrename.c reload.c reload1.c reorg.c resource.c sbitmap.c sched-deps.c sched-rgn.c sched-vis.c sdbout.c simplify-rtx.c ssa-ccp.c ssa.c stmt.c stor-layout.c timevar.c tlink.c toplev.c tree-dump.c tree.c unroll.c unwind-dw2-fde.c varasm.c varray.c vmsdbgout.c xcoffout.c: Remove unnecessary casts. From-SVN: r69587
2003-07-13Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H).Zack Weinberg1-2/+0
* Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H). (hashtable.o, line-map.o, mkdeps.o): Likewise, from dependency list. Move these all together down by cpplib. * cpplib.h: Don't refer to MAX_WCHAR_TYPE_SIZE when determining definition of CPPCHAR_SIGNED_T. * cppcharset.c, cpperror.c, cppexp.c, cppfiles.c, cpphash.c, cppinit.c * cpplex.c, cpplib.c, cppmacro.c, cpppch.c, cpptrad.c, hashtable.c * line-map.c, mkdeps.c: Don't include coretypes.h or tm.h. * cpphash.c (_cpp_init_hashtable): Don't use gcc_obstack_init. * cppinit.c (cpp_create_reader): Likewise. * cpphash.h (scan_out_logical_line): Rename _cpp_scan_out_logical_line. * cpptrad.c: Likewise. All callers changed. * cpplib.c: All callers changed. * c-ppoutput.c: Replace 'uchar' with 'unsigned char' throughout. * hashtable.h: Define GTY(x) to nothing here too. From-SVN: r69298
2003-06-17* cpplib.h, cpphash.h, cppcharset.c, cpperror.c, cppexp.cZack Weinberg1-115/+58
* cppfiles.c, cpphash.c, cppinit.c, cpplex.c, cpplib.c * cppmacro.c, cpppch.c, cpptrad.c, cppspec.c: Convert to ISO C: new-style function declarations, no need for PARAMS, no special punctuation on indirect function calls, use string constant concatenation where convenient. From-SVN: r68070
2003-04-22c-lex.c (c_lex): Handle CPP_OTHER differently.Neil Booth1-6/+0
* c-lex.c (c_lex): Handle CPP_OTHER differently. * cppexp.c (_cpp_parse_expr): Similarly. * cpplex.c (SPELL_CHAR): Remove. (_cpp_lex_direct): Stray chars are saved as byte strings. (cpp_spell_token, cpp_output_token, _cpp_equiv_token): Don't handle SPELL_CHAR. (cpp_avoid_paste): Update handling of CPP_OTHER. * cpplib.h: Spell CPP_OTHER like a number. (struct cpp_token): Remove member c. * cppmacro.c (stringify_arg): Update handling of CPP_OTHER. From-SVN: r65951
2003-04-19cppexp.c (eval_token): Permit true and false even if pedantic.Neil Booth1-8/+0
* cppexp.c (eval_token): Permit true and false even if pedantic. testsuite: * gcc.dg/cpp/truefalse.cpp: New test. * gcc.dg/cpp/cpp.exp: Update. From-SVN: r65811
2003-03-31cppexp.c (cpp_classify_number): Accept '.' after "0x".Michael Matz1-1/+2
* cppexp.c (cpp_classify_number): Accept '.' after "0x". * testsuite/gcc.dg/cpp/c99-hexfloat-3.c: New file. From-SVN: r65091
2002-12-19ChangeLog: Follow spelling conventions.Kazu Hirata1-1/+1
* ChangeLog: Follow spelling conventions. * ChangeLog.2: Likewise. * ChangeLog.4: Likewise. * ChangeLog.5: Likewise. * cppexp.c: Likewise. * df.c: Likewise. * gcov.c: Likewise. * gengtype.c: Likewise. * reload1.c: Likewise. * sched-rgn.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * timevar.c: Likewise. * toplev.c: Likewise. * tree.h: Likewise. * varasm.c: Likewise. * config/fr30/fr30.md: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/pa/pa.c: Likewise. From-SVN: r60281
2002-12-16Merge basic-improvements-branch to trunkZack Weinberg1-0/+2
From-SVN: r60174
2002-11-29cpplib.c (_cpp_test_assertion): Default *value to 0.Hans-Peter Nilsson1-0/+1
* cpplib.c (_cpp_test_assertion): Default *value to 0. * cppexp.c (num_part_mul): Initialize result.unsignedp, to 1. From-SVN: r59648
2002-09-22ChangeLog: Follow spelling conventions.Kazu Hirata1-1/+1
* ChangeLog: Follow spelling conventions. * ChangeLog.0: Likewise. * ChangeLog.1: Likewise. * ChangeLog.2: Likewise. * ChangeLog.3: Likewise. * ChangeLog.4: Likewise. * ChangeLog.5: Likewise. * ChangeLog.6: Likewise. * FSFChangeLog.10: Likewise. * FSFChangeLog.11: Likewise. * alias.c: Likewise. * basic-block.h: Likewise. * c-aux-info.c: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-semantics.c: Likewise. * c-typeck.c: Likewise. * calls.c: Likewise. * cfganal.c: Likewise. * cfgloop.c: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * conflict.c: Likewise. * cppexp.c: Likewise. * cppfiles.c: Likewise. * cpphash.h: Likewise. * cppinit.c: Likewise. * cpplex.c: Likewise. * cpplib.c: Likewise. * cpplib.h: Likewise. * cppmacro.c: Likewise. * cse.c: Likewise. From-SVN: r57398
2002-09-16ABOUT-NLS: Follow spelling conventions.Kazu Hirata1-2/+2
* ABOUT-NLS: Follow spelling conventions. * ChangeLog: Likewise. * ChangeLog.1: Likewise. * ChangeLog.2: Likewise. * ChangeLog.3: Likewise. * ChangeLog.4: Likewise. * ChangeLog.5: Likewise. * ChangeLog.6: Likewise. * FSFChangeLog.10: Likewise. * FSFChangeLog.11: Likewise. * c-common.c: Likewise. * c-lex.c: Likewise. * c-objc-common.c: Likewise. * cppexp.c: Likewise. * cppinit.c: Likewise. * cpplex.c: Likewise. * doloop.c: Likewise. * flow.c: Likewise. * function.c: Likewise. * integrate.c: Likewise. * loop.c: Likewise. * reg-stack.c: Likewise. * reload.h: Likewise. * ssa.c: Likewise. From-SVN: r57188
2002-08-02c-common.c (c_common_init): -Wtraditional also implies -Wlong-long.Zack Weinberg1-7/+12
* c-common.c (c_common_init): -Wtraditional also implies -Wlong-long. * cppinit.c (cpp_post_options): Likewise. * cppexp.c (cpp_classify_number): Suppress -Wtraditional warning about 'LL' suffix (but not 'ULL' etc) when -Wno-long-long is in effect. * cppmacro.c (_cpp_builtin_macro_text) [BT_TIME, BT_DATE]: Check for failing time()/localtime(), issue a warning, and make __TIME__ and __DATE__ expand to fallback strings. * doc/cpp.texi, doc/extend.texi: Document behavior of __DATE__ and __TIME__ when the date and time cannot be determined. From-SVN: r55969
2002-07-23cppexp.c (parse_defined): Mark macro used.Neil Booth1-0/+2
* cppexp.c (parse_defined): Mark macro used. * cpphash.h (struct cpp_macro): New member "used". (_cpp_mark_macro_used, _cpp_warn_if_unused_macro): New. (struct cpp_reader): New member. * cppinit.c (cpp_finish_options): Set first_unused_line. (cpp_finish): Warn of unused macros if requested. (OPT_TABLE): New switches. (cpp_handle_option): Handle them. * cpplib.c (do_undef): Warn if macro unused. (do_ifdef, do_ifndef): Mark macro used. * cpplib.h (struct cpp_options): New member. * cppmacro.c (_cpp_warn_if_unused_macro): New. (enter_macro_context): Mark macro used. (_cpp_create_definition): Mark macro unused; warn if unused when redefined. * cpptrad.c (scan_out_logcial_line, push_replacement_text): Mark macros used. * doc/cppopts.texi: Update. testsuite: * gcc.dg/cpp/trad/Wunused.c, gcc.dg/cpp/trad/Wunused.h, gcc.dg/cpp/Wunused.c, gcc.dg/cpp/Wunused.h: New tests. From-SVN: r55692
2002-07-20cppexp.c (struct op): Add token pointer.Neil Booth1-28/+59
* cppexp.c (struct op): Add token pointer. (check_promotion, CHECK_PROMOTION): New. (optab): Update. (_cpp_parse_expr): Update, use token pointer of struct op. (reduce): Warn about change of sign owing to promotion. * cppinit.c (cpp_handle_option): New warning if -Wall. * cpplib.h (struct cpp_options): New member. testsuite: * gcc.dg/cpp/Wsignprom.c: New tests. From-SVN: r55611
2002-07-19cppexp.c (ALWAYS_EVAL): Remove.Neil Booth1-108/+105
* cppexp.c (ALWAYS_EVAL): Remove. (optab, reduce): Always evaluate. (num_unary_op, num_binary_op, num_div_op): Issue diagnostics only if not skipping evaluation. testsuite: * gcc.dg/cpp/expr.c: New tests. From-SVN: r55595
2002-07-18cppexp.c (cpp_num_mul): Remove unused parameter.Neil Booth1-105/+139
* cppexp.c (cpp_num_mul): Remove unused parameter. (UNARY, BINARY, OTHER, binary_handler): Remove. (ALWAYS_EVAL): New. (optab): Update. (reduce): Refactor to a large switch, don't use a function pointer. From-SVN: r55570
2002-07-17cppexp.c (cpp_interpret_integer, [...]): Clarify and correct use of "bool" ↵Neil Booth1-8/+8
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
2002-07-09cpperror.c (cpp_error): Default to directive_line within directives here.Neil Booth1-2/+4
* cpperror.c (cpp_error): Default to directive_line within directives here. * cppexp.c (cpp_interpret_integer): Only use traditional number semantics in directives. * cpplib.c (prepare_directive_trad): Don't reset pfile->line. (do_include_common): Similarly. * cpptrad.c (scan_out_logical_line): Implement accurate quoting of <> in #include. * doc/cpp.texi: Update. From-SVN: r55347
2002-06-20cppexp.c (cpp_interpret_integer): Don't force traditional numbers to be ↵Neil Booth1-3/+6
unsigned. * cppexp.c (cpp_interpret_integer): Don't force traditional numbers to be unsigned. * cpplib.c (prepare_directive_trad): Set line number for diagnostics. * cpptrad.c (scan_out_logical_line): Continue scanning out at start of buffer. * gcc.c (trad_capable_cpp): Use cc1 always. f: * lang-specs.h: Use cc1 for traditional preprocessing. testsuite: * gcc.dg/cpp/assert_trad1.c, gcc.dg/cpp/assert_trad2.c, gcc.dg/cpp/assert_trad3.c, gcc.dg/cpp/defined_trad.c, gcc.dg/cpp/hash2.c, gcc.dg/cpp/tr-define.c, gcc.dg/cpp/tr-direct.c, gcc.dg/cpp/tr-sign.c, gcc.dg/cpp/tr-str.c, gcc.dg/cpp/uchar-2.c: Remove. From-SVN: r54856
2002-06-07cppexp.c (num_equality_op): Use a temporary variable to work around gcc ↵Jason Merrill1-2/+4
3.0.4 bug. * cppexp.c (num_equality_op): Use a temporary variable to work around gcc 3.0.4 bug. From-SVN: r54339
2002-06-02c-common.c (c_common_init): Override cpplib's default warn_long_long setting.Neil Booth1-0/+27
* c-common.c (c_common_init): Override cpplib's default warn_long_long setting. * c-lex.c (lex_number): Replace with interpret_integer, interpret_float, narrowest_unsigned_type and narrowest_signed_type, taking advantage of the new cpplib functionality. * cpperror.c (_cpp_begin_message): If a warning is turned into an error, avoid printing "warning:". * cppexp.c (cpp_num_sign_extend): New. * cppinit.c: Update comment. * cpplib.h (cpp_num_sign_extend): New. * tree.h: Update comment. testsuite: * gcc.dg/wtr-int-type-1.c, gcc.dg/wtr-suffix-1.c, gcc.dg/cpp/paste4.c, gcc.dg/cpp/sysmac2.c: Update for mofified diagnostics. * gcc.dg/c99-intconst-1.c: No longer fail. From-SVN: r54180
2002-06-01cppexp.c (cpp_classify_number): Cast precission to int for correct printf ↵Andreas Jaeger1-4/+4
format. * cppexp.c (cpp_classify_number): Cast precission to int for correct printf format. From-SVN: r54147
2002-05-29cppexp.c (cpp_num): Move to cpplib.h.Neil Booth1-181/+332
2002-05-29 Neil Booth <neil@daikokuya.demon.co.uk> Zack Weinberg <zack@codesourcery.com> * cppexp.c (cpp_num): Move to cpplib.h. (CPP_ERROR): Remove. (interpret_float_suffix, interpret_int_suffix): New. (struct suffix, vsuf_1, vsuf_2, vsuf_3): Remove. (cpp_classify_number, cpp_interpret_integer): New. (interpret_number): Remove. (eval_token): Update to use new routines. * cpphash.h (cpp_num_part): Move to cpplib.h. * cppinit.c (cpp_post_options): Set warn_long_long. * cpplib.h (struct cpp_options): Add warn_long_long. (cpp_num, cpp_num_part, CPP_N_CATEGORY, CPP_N_INVALID, CPP_N_INTEGER, CPP_N_FLOATING, CPP_N_WIDTH, CPP_N_SMALL, CPP_N_MEDIUM, CPP_N_LARGE, CPP_N_RADIX, CPP_N_DEC, CPP_N_HEX, CPP_N_OCTAL, CPP_N_UNSIGNED, CPP_N_IMAGINARY, cpp_classify_number, cpp_interpret_integer): New. testsuite: * gcc.dg/cpp/c++98-pedantic.c, gcc.dg/cpp/c89-pedantic.c, gcc.dg/cpp/c94-pedantic.c, gcc.dg/cpp/gnuc89-pedantic.c, gcc.dg/cpp/if-1.c: Update for modified diagnostics. Co-Authored-By: Zack Weinberg <zack@codesourcery.com> From-SVN: r54007
2002-05-28cppexp.c (interpret_number): Optimize for single-digit and ↵Neil Booth1-21/+51
less-than-half-precision cases. * cppexp.c (interpret_number): Optimize for single-digit and less-than-half-precision cases. (num_trim, num_positive, num_div_op): Cast constants. From-SVN: r53943
2002-05-27cppexp.c (num_trim): Use 1UL instead of 1 for long int.H.J. Lu1-8/+8
2002-05-27 H.J. Lu (hjl@gnu.org) * cppexp.c (num_trim): Use 1UL instead of 1 for long int. (num_positive): Likewise. (num_div_op): Likewise. From-SVN: r53939
2002-05-27c-common.c (c_common_init): Set CPP arithmetic precision.Neil Booth1-1/+0
* c-common.c (c_common_init): Set CPP arithmetic precision. * cppexp.c (cpp_num_part): Move typedef ... * cpphash.h: ...here; make unsigned HOST_WIDE_INT. * cppinit.c (cpp_create_reader): Default to host long arithmetic. (sanity_checks): Update. testsuite: * gcc.dg/cpp/arith-2.c, gcc.dg/cpp/arith-3.c: New tests. * gcc.dg/cpp/if-3.c: Remove. From-SVN: r53911
2002-05-26cppexp.c (possible_sum_sign, [...]): Remove.Neil Booth1-319/+805
* cppexp.c (possible_sum_sign, integer_overflow, left_shift, right_shift): Remove. (cpp_num, cpp_num_part, PART_PRECISION, HALF_MASK, LOW_PART, HIGH_PART): New. (struct op): Use cpp_num. (num_zerop, num_eq, num_positive, num_greater_freq, num_trim, num_part_mul, num_unary_op, num_binary_op, num_negate, num_bitwise_op, num_inequality_op, num_equality_op, num_mul, num_div_op, num_lshift, num_rshift, append_digit): New. (interpret_number, parse_defined, eval_token, reduce): Update for two-integer arithmetic. (binary_handler): New typedef. (optab): Update. (COMPARE, EQUALITY, BITWISE, MINMAX, UNARY, SHIFT): Delete. (_cpp_parse_expr, reduce): Update to handle two-integers. * cpplib.c (_cpp_test_assertion): Back up on CPP_EOF. testsuite: * gcc.dg/cpp/arith-1.c: New semantic tests. * gcc.dg/cpp/if-1.c: Update. From-SVN: r53900
2002-05-22cpperror.c: Fix formatting.Kazu Hirata1-4/+4
* cpperror.c: Fix formatting. * cppexp.c: Likewise. * cppfiles.c: Likewise. * cpphash.c: Likewise. * cpphash.h: Likewise. * cppinit.c: Likewise. * cpplex.c: Likewise. * cpplib.c: Likewise. * cppmacro.c: Likewise. * cppmain.c: Likewise. * cppspec.c: Likewise. From-SVN: r53751
2002-05-09* cppexp.c (_cpp_expand_op_stack): Set op_limit.Neil Booth1-3/+5
From-SVN: r53348
2002-05-06c-common.c (warn_multichar): New.Neil Booth1-1/+10
* c-common.c (warn_multichar): New. (c_common_init): Set CPP's warn_multichar. * c-common.h (warn_multichar): New. * c-decl.c (warn_multichar): Remove. * c-lex.c (lex_charconst): Update. * c-tree.h (warn_multichar): Remove. * cppexp.c (eval_token): Sign-extend charconst value. * cppinit.c (cpp_create_reader): Set warn_multichar. * cpplex.c (cpp_interpret_charconst): Don't sign-extend each character. Update prototype. Sign-extend the result. * cpplib.h: Fix conditions. (struct cpp_options): Add new warning flag. (cpp_interpret_charconst): Update prototype. cp: * Make-lang.in (decl2.o): Update. * cp-tree.h (warn_multichar): Remove. * decl2.c: Include c-common.h. (warn_multichar): Remove. doc: * cpp.texi: Update documentation. testsuite: * gcc.dg/cpp/charconst-3.c: Correct tests accordingly. From-SVN: r53240
2002-05-04c-lex.c (lex_string): Let cpp_parse_escape handles truncation and ↵Neil Booth1-4/+4
sign-extension. * c-lex.c (lex_string): Let cpp_parse_escape handles truncation and sign-extension. (lex_charconst): Update for change in prototype of cpp_interpret_charconst. Extend from cppchar_t to HOST_WIDE_INT appropriately. * cpphash.h (BITS_PER_CPPCHAR_T): New. * cppinit.c (cpp_create_reader): Initialize them for no change in semantics. (cpp_post_options): Add sanity checks. * cpplex.c (cpp_parse_escape): Handle precision, sign-extension and truncation issues. Calculate in type cppchar_t. (MAX_CHAR_TYPE_SIZE, MAX_WCHAR_TYPE_SIZE): Remove. (cpp_interpret_charconst): Calculate in type cppchar_t. Handle run-time dependent precision correctly. Return whether the result is signed or not. * cpplib.c (dequote_string): Use cppchar_t; update. * cpplib.h (cppchar_signed_t): New. struct cpp_options): New precision members. (cpp_interpret_charconst, cpp_parse_escape): Update prototypes. From-SVN: r53152
2002-04-28cppexp.c (lex): Move some code to _cpp_parse_expr, but keep most cases as ↵Neil Booth1-99/+54
function eval_token. * cppexp.c (lex): Move some code to _cpp_parse_expr, but keep most cases as function eval_token. (eval_token): New function. (_cpp_parse_expr): Read token here for improved diagnostics. Don't use op_as_text. Detect bad ':' here. (reduce): Don't detect bad ':' here. (op_as_text): Remove. * cpphash.h (_cpp_test_assertion): Change prototype. * cpplib.c (_cpp_test_assertion): Change prototype. testsuite: * gcc.dg/cpp/if-cexp.c: Add a test. From-SVN: r52866
2002-04-28cppexp.c (lex): Update to use state.skip_eval.Neil Booth1-331/+306
* cppexp.c (lex): Update to use state.skip_eval. (struct op): Remove prio and flags members. (FLAG_BITS, FLAG_MASK, PRIO_SHIFT, EXTRACT_PRIO, EXTRACT_FLAGS, SHORT_CIRCUIT, RIGHT_ASSOC, ..._PRIO, op_to_prio): Remove. (LEFT_ASSOC): New macro. (optab): New table of operator priorities and flags. (SHIFT): Update. (_cpp_parse_expr): Clean up logic. Return bool. Use a malloc-ed parser stack. (reduce): New; reduce the operator stack. (_cpp_expand_op_stack): Expand the operator stack as necessary. * cpphash.h (struct op): Predeclare. (struct cpp_reader): New members op_stack, op_limit. (struct lexer_state): New member skip_eval. (_cpp_parse_expr): Update. (_cpp_expand_op_stack): New. * cpplib.c (do_if): Update. * cppinit.c (cpp_create_reader): Create op stack. (cpp_destroy): And destroy it. * cpplib.h (CPP_LAST_CPP_OP): Correct. (TTYPE_TABLE): Correct. testsuite: * gcc.dg/cpp/if-mop.c: Update. * gcc.dg/cpp/if-mpar.c: Add test. * gcc.dg/cpp/if-oppr.c: Update. From-SVN: r52853
2002-04-26cppexp.c (CPP_UMINUS, CPP_UPLUS): New.Neil Booth1-78/+75
* cppexp.c (CPP_UMINUS, CPP_UPLUS): New. (HAVE_NO_R_OPERAND): Remove. (HAVE_VALUE): Remove. (op_to_prio): Update. (UNARY): Don't alter flags. (_cpp_parse_expr): want_value used to indicate whether a number or unary operator is expected next. Distinguish unary and binary +/-. (op_as_text): Update for unary operators. From-SVN: r52780
2002-04-21cppexp.c (struct op, [...]): Replace U_CHAR with uchar.Neil Booth1-6/+6
* cppexp.c (struct op, parse_number): Replace U_CHAR with uchar. * cppfiles.c (read_include_file): Similarly. * cpphash.h (DSC, U_CHAR, ustrcmp, ustrncmp, ustrlen, uxstrdup ustrchr, ufputs): Similarly. * cppinit.c (TRIGRAPH_MAP, cpp_destroy): Similarly. * cpplex.c (parse_slow, unescaped_terminator_p, save_comment, cpp_ideq, parse_identifier, parse_number): Similarly. * cpplib.c (struct directive, dequote_string, D, run_directive, cpp_push_buffer): Similarly. * cppmacro.c (new_string_token, builtin_macro, cpp_quote_string, _cpp_create_definition, check_trad_stringification, cpp_macro_definition): Similarly. From-SVN: r52587
2002-04-14cpperror.c (print_location): Don't print include chain if line == 0.Neil Booth1-24/+33
* cpperror.c (print_location): Don't print include chain if line == 0. (cpp_begin_message): Update to use DL_ macros. (cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line, cpp_notice, cpp_notice_from_errno): Remove. (cpp_error, cpp_error_with_line): Update to take a diagnostic level. (cpp_errno): New. * cppexp.c (CPP_ICE): Remove. (SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined, lex, integer_overflow, _cpp_parse_expr): Update. * cppfiles.c (read_include_file, find_include_file, handle_missing_header, _cpp_read_file, remap_filename): Update. * cpphash.h (enum error_type): Remove. (_cpp_begin_message): Update. * cppinit.c (append_include_chain, remove_dup_dirs, output_deps, cpp_handle_option, cpp_post_options): Update. * cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment, skip_whitespace, parse_identifier, parse_slow, parse_string, _cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape, cpp_interpret_charconst): Update. * cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive, lex_macro_node, do_undef, glue_header_name, parse_include, do_include_common, read_flag, do_line, do_linemarker, do_ident, cpp_register_pragma, do_pragma_once, do_pragma_system_header, do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else, do_elif, do_endif, parse_answer, parse_assertion, do_assert, _cpp_pop_buffer, do_diagnostic): Update. * cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR, DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New. (cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line, cpp_notice, cpp_notice_from_errno): Remove. (cpp_error, cpp_error_with_line): Update to take a diagnostic level. (cpp_errno): New. * cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens, collect_args, enter_macro_context, save_parameter, parse_params, _cpp_create_definition, check_trad_stringification, cpp_macro_definition): Update. * cppmain.c (cpp_preprocess_file): Update. * fix-header.c (read_scan_file): Update. From-SVN: r52302
2002-03-03attribs.c (init_attributes, [...]): Use ARRAY_SIZE in lieu of explicit ↵Kaveh R. Ghazi1-4/+3
sizeof/sizeof. * attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. * i386.c (override_options, ix86_init_mmx_sse_builtins, ix86_expand_builtin): Likewise. * mips.c (mips_add_gc_roots): Likewise. * mmix.c (mmix_output_condition): Likewise. * rs6000.c (rs6000_override_options, altivec_expand_builtin, altivec_init_builtins): Likewise. * sparc.c (mark_ultrasparc_pipeline_state): Likewise. * cppexp.c (Nsuff, parse_number): Likewise. * cppinit.c (builtin_array_end): Likewise. * gcc.c (n_default_compilers, process_command): Likewise. * genpreds.c (output_predicate_decls): Likewise. * ggc-page.c (NUM_EXTRA_ORDERS): Likewise. * lcm.c (N_ENTITIES): Likewise. * stor-layout.c (set_sizetype): Likewise. ada: * utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. cp: * decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. * decl2.c (cxx_decode_option): Likewise. * lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise. java: * class.c (init_class_processing): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. * decl.c (java_init_decl_processing): Likewise. * jcf-parse.c (init_jcf_parse): Likewise. * parse.y (init_src_parse): Likewise. From-SVN: r50255
2002-02-27c-common.c, [...]: Delete code implementing -traditional mode.Zack Weinberg1-1/+1
* c-common.c, c-common.h, c-decl.c, c-lex.c, c-parse.in, c-tree.h, c-typeck.c, cppexp.c, cpplex.c, cpplib.c, cpplib.h, cppmacro.c, objc/lang-specs.h, objc/objc-act.c, builtin-types.def, builtins.def, dwarf2out.c, dwarfout.c, gcc.c, toplev.c: Delete code implementing -traditional mode. * ada/misc.c, ch/ch-tree.h, ch/decl.c, cp/decl2.c, f/com.c, f/lex.c, f/top.c, java/builtins.c, java/decl.c: Delete traditional-mode-related code copied from the C front end but not used, or used only to permit the compiler to link. * doc/bugreport.texi, doc/cpp.texi, doc/extend.texi, doc/invoke.texi, doc/standards.texi, doc/trouble.texi: Document removal of -traditional mode for compilation, and remove documentation only relevant to that mode. * config/nextstep.h, config/ptx4.h, config/svr4.h, config/convex/convex.h, config/d30v/d30v.h, config/i386/dgux.h, config/i386/osf1elf.h, config/i386/osfelf.h, config/i386/osfrose.h, config/i386/sco5.h, config/i386/sol2.h, config/m68k/a-ux.h, config/m68k/hp310.h, config/m88k/dgux.h, config/m88k/dguxbcs.h, config/m88k/luna.h, config/m88k/m88k.c, config/m88k/m88k.h, config/m88k/openbsd.h, config/mips/abi64.h, config/mips/osfrose.h, config/mips/svr4-5.h, config/mips/svr4-t.h, config/sparc/sol2-sld-64.h, config/sparc/sol2.h, config/stormy16/stormy16.h: Remove all references to -traditional from target specs. Delete all mention of the no-longer-necessary TRADITIONAL_RETURN_FLOAT macro. Also delete a couple of commented-out definitions of DOLLARS_IN_IDENTIFIERS, with (incorrect) commentary referring to -traditional. * system.h: Poison TRADITIONAL_RETURN_FLOAT. * doc/tm.texi: Remove mention of TRADITIONAL_RETURN_FLOAT macro. * testsuite/gcc.c-torture/execute/920730-1t.c, testsuite/gcc.c-torture/execute/920730-1t.x, testsuite/gcc.dg/ext-glob.c: Delete test cases, only relevant to -traditional. From-SVN: r50110
2002-02-24cpplex.c (cpp_interpret_charconst): Get signedness or otherwise of wide ↵Neil Booth1-2/+4
character constants correct. * cpplex.c (cpp_interpret_charconst): Get signedness or otherwise of wide character constants correct. * cppexp.c (lex): Get signedness of wide charconsts correct. * testsuite/gcc.dg/cpp/wchar-1.c: New test. From-SVN: r50005
2002-01-03cpperror.c: Update comments and copyright.Neil Booth1-8/+12
* cpperror.c: Update comments and copyright. * cppexp.c, cppfiles.c, cpphash.c, cpphash.h, cppinit.c, cpplex.c, cpplib.c, cpplib.h, cppmacro.c, cppmain.c: Similarly. From-SVN: r48522
2001-11-10cppexp.c (parse_number): Use ISXDIGIT/hex_value.Kaveh R. Ghazi1-8/+3
* cppexp.c (parse_number): Use ISXDIGIT/hex_value. * cpplex.c (hex_digit_value): Use hex_p/hex_value. * cppmain.c (general_init): Call hex_init. From-SVN: r46912
2001-11-05cppexp.c (lex, [...]): Update warning about defined.Neil Booth1-6/+5
* cppexp.c (lex, parse_defined): Update warning about defined. * gcc.dg/cpp/defined.c: Update. From-SVN: r46794
2001-10-21c-format.c (maybe_read_dollar_number): Use safe-ctype macros and/or fold ↵Kaveh R. Ghazi1-1/+1
extra calls into fewer ones. * c-format.c (maybe_read_dollar_number): Use safe-ctype macros and/or fold extra calls into fewer ones. * collect2.c (dump_file): Likewise. * cppexp.c (parse_number): Likewise. * cpplex.c (_cpp_lex_direct): Likewise. * final.c (output_asm_insn, asm_fprintf): Likewise. * fix-header.c (inf_scan_ident, main): Likewise. * fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix): Likewise. * fold-const.c (real_hex_to_f): Likewise. * gen-protos.c (parse_fn_proto): Likewise. * genattrtab.c (check_attr_test, check_attr_value): Likewise. * genrecog.c (change_state, write_action): Likewise. * gensupport.c (shift_output_template): Likewise. * local-alloc.c (requires_inout): Likewise. * mips-tfile.c (IS_ASM_IDENT): Likewise. * protoize.c (is_id_char, main): Likewise. * real.c (asctoeg): Likewise. * recog.c (asm_operand_ok): Likewise. * reload.c (find_reloads): Likewise. * scan.c (scan_identget_token): Likewise. * sched-vis.c (print_value): Likewise. * stringpool.c (ggc_alloc_string): Likewise. * toplev.c (read_integral_parameter, decode_g_option): Likewise. * tradcif.y (parse_number, yylex, parse_escape): Likewise. * tradcpp.c (rescan): Likewise. * tree.c (clean_symbol_name): Likewise. * varasm.c (decode_reg_name): Likewise. * alpha.h (ASM_OUTPUT_ASCII): Likewise. * darwin.c (name_needs_quotes, func_name_maybe_scoped): Likewise. * dsp16xx.h (ASM_OUTPUT_ASCII): Likewise. * m88k.c (output_ascii): Likewise. * m88k.h (OVERRIDE_OPTIONS): Likewise. * mcore.h (REG_CLASS_FROM_LETTER): Likewise. * ns32k/encore.h (ASM_OUTPUT_ASCII): Likewise. * sh.h (REG_CLASS_FROM_LETTER): Likewise. cp: * xref.c (GNU_xref_member): Use safe-ctype macros and/or fold extra calls into fewer ones. f: * bad.c (ffebad_finish): Use safe-ctype macros and/or fold extra calls into fewer ones. * implic.c (ffeimplic_lookup_): Likewise. * intdoc.c (dumpimp): Likewise. * intrin.c (ffeintrin_init_0): Likewise. * lex.c (ffelex_backslash_, ffelex_cfebackslash_, ffelex_hash_): Likewise. * lex.h (ffelex_is_firstnamechar): Likewise. * target.c (ffetarget_integerhex): Likewise. java: * gjavah.c (jni_print_char, decode_signature_piece): Use safe-ctype macros and/or fold extra calls into fewer ones. * lex.c (java_read_unicode, java_lex): Likewise. * lex.h (JAVA_START_CHAR_P, JAVA_PART_CHAR_P, JAVA_ASCII_DIGIT, JAVA_ASCII_HEXDIGIT, JAVA_ASCII_LETTER): Likewise. * mangle_name.c (append_unicode_mangled_name, unicode_mangling_length): Likewise. From-SVN: r46397
2001-10-11alias.c: Remove uses of "register" specifier in declarations of arguments ↵Stan Shebs1-1/+1
and local... 2001-10-10 Stan Shebs <shebs@apple.com> * alias.c: Remove uses of "register" specifier in declarations of arguments and local variables. * c-common.c: Ditto. * c-convert.c: Ditto. * c-decl.c: Ditto. * c-format.c: Ditto. * c-semantics.c: Ditto. * c-typeck.c: Ditto. * caller-save.c: Ditto. * calls.c: Ditto. * cfg.c: Ditto. * cfgbuild.c: Ditto. * cfgrtl.c: Ditto. * collect2.c: Ditto. * combine.c: Ditto. * convert.c: Ditto. * cppexp.c: Ditto. * cppfiles.c: Ditto. * cse.c: Ditto. * dbxout.c: Ditto. * defaults.h: Ditto. * df.c: Ditto. * dwarf2out.c: Ditto. * dwarfout.c: Ditto. * emit-rtl.c: Ditto. * explow.c: Ditto. * expmed.c: Ditto. * expr.c: Ditto. * final.c: Ditto. * fix-header.c: Ditto. * floatlib.c: Ditto. * flow.c: Ditto. * fold-const.c: Ditto. * function.c: Ditto. * gcc.c: Ditto. * gcse.c: Ditto. * gen-protos.c: Ditto. * genattrtab.c: Ditto. * gencheck.c: Ditto. * genconfig.c: Ditto. * genemit.c: Ditto. * genextract.c: Ditto. * genflags.c: Ditto. * gengenrtl.c: Ditto. * genoutput.c: Ditto. * genpeep.c: Ditto. * genrecog.c: Ditto. * gensupport.c: Ditto. * global.c: Ditto. * gmon.c: Ditto. * graph.c: Ditto. * haifa-sched.c: Ditto. * hard-reg-set.h: Ditto. * hash.c: Ditto. * integrate.c: Ditto. * jump.c: Ditto. * lists.c: Ditto. * local-alloc.c: Ditto. * loop.c: Ditto. * mips-tdump.c: Ditto. * mips-tfile.c: Ditto. * optabs.c: Ditto. * prefix.c: Ditto. * print-rtl.c: Ditto. * read-rtl.c: Ditto. * real.c: Ditto. * recog.c: Ditto. * reg-stack.c: Ditto. * regclass.c: Ditto. * regmove.c: Ditto. * reload.c: Ditto. * reload1.c: Ditto. * reorg.c: Ditto. * resource.c: Ditto. * rtl.c: Ditto. * rtlanal.c: Ditto. * scan.c: Ditto. * sched-deps.c: Ditto. * sched-rgn.c: Ditto. * sdbout.c: Ditto. * simplify-rtx.c: Ditto. * stmt.c: Ditto. * stor-layout.c: Ditto. * toplev.c: Ditto. * tradcif.y: Ditto. * tradcpp.c: Ditto. * tree.c: Ditto. * unroll.c: Ditto. * varasm.c: Ditto. * xcoffout.c: Ditto. From-SVN: r46173
2001-10-07builtins.c (expand_builtin_setjmp_receiver): Const-ify.Kaveh R. Ghazi1-6/+6
* builtins.c (expand_builtin_setjmp_receiver): Const-ify. * c-common.c (fname_var_t, c_tree_code_type, c_tree_code_length): Likewise. * c-dump.c (dump_option_value_info): Likewise. * c-format.c (format_length_info, format_char_info, format_flag_spec, format_flag_pair, format_kind_info): Likewise. * collect2.c (names): Likewise. * cppdefault.h (default_include): Likewise. * cppexp.c (suffix, vsuf_1, vsuf_2, vsuf_3): Likewise. * flow.c (life_analysis): Likewise. * gcc.c (dir_separator_str, modify_target, option_map, target_option_translations, spec_list_1, extra_specs_1, init_spec): Likewise. * gcov.c (gcov_version_string): Likewise. * genattr.c (write_units): Likewise. * genattrtab.c (make_length_attrs, write_function_unit_info): Likewise. * gengenrtl.c (rtx_definition, defs): Likewise. * genrecog.c (pred_table): Likewise. * global.c (global_alloc): Likewise. * lcm.c (optimize_mode_switching): Likewise. * local-alloc.c (find_free_reg): Likewise. * params.h (param_info): Likewise. * predict.c (predictor_info): Likewise. * protoize.c (unexpansion_struct): Likewise. * real.c (bmask): Likewise. * recog.h (insn_operand_data, insn_data): Likewise. * regclass.c (initial_fixed_regs, initial_call_used_regs): Likewise. * stmt.c (expand_nl_goto_receiver): Likewise. * toplev.c (da, debug_args, lang_opt, documented_lang_options, target_switches, target_options): Likewise. * tradcif.y (token, tokentab2, yylex): Likewise. * tree.h (attribute_spec): Likewise. * alpha.c (override_options, alpha_lookup_xfloating_lib_func): Likewise. * arc.c (arc_output_function_epilogue): Likewise. * arm.c (processors, all_cores, all_architectures, arm_override_options, isr_attribute_arg, isr_attribute_args, arm_isr_value): Likewise. * avr.c (mcu_type_s, reg_class_tab, order_regs_for_local_alloc): Likewise. * c4x.c (c4x_int_reglist): Likewise. * d30v.c (override_options): Likewise. * h8300.c (shift_insn): Likewise. * i386.c (size_cost, i386_cost, i486_cost, pentium_cost, pentiumpro_cost, k6_cost, athlon_cost, pentium4_cost, ix86_cost, ix86_expand_sse_comi, ix86_expand_sse_compare, override_options, builtin_description, bdesc_comi, bdesc_2arg, bdesc_1arg, ix86_init_mmx_sse_builtins, ix86_expand_builtin): Likewise. * i386.h (processor_costs, ix86_cost): Likewise. * m68hc11.c (m68hc11_cost, m6811_cost, m6812_cost): Likewise. * m68hc11.h (processor_costs, m68hc11_cost): Likewise. * m68k.c (codes_68881, codes_FPA): Likewise. * m88k.c (mode_from_align, max_from_align, all_from_align, best_from_align, m_options): Likewise. * m88k.h (ORDER_REGS_FOR_LOCAL_ALLOC): Likewise. * mcore.c (mode_from_align): Likewise. * mips/elf64.h (UNIQUE_SECTION): Likewise. * mips/iris6gld.h (UNIQUE_SECTION): Likewise. * mips.c (mips_sw_reg_names, mips_regno_to_class): Likewise. * mips.h (mips_regno_to_class): Likewise. * ns32k.c (scales): Likewise. * pa.c (import_string, magic_milli): Likewise. * rs6000.c (alt_reg_names, rs6000_override_options): Likewise. * sparc.c (leaf_reg_remap, sparc_override_options, reg_leaf_alloc_order, reg_nonleaf_alloc_order, reg_alloc_orders): Likewise. * sparc.h (sparc_cpu_select, leaf_reg_remap): Likewise. cp: * class.c (build_vtable_entry_ref): Const-ify. * decl.c (predefined_identifier, initialize_predefined_identifiers): Likewise. * init.c (build_new_1): Likewise. * lex.c (cplus_tree_code_type, cplus_tree_code_length, resword): Likewise. f: * bad.c (_ffebad_message_, ffebad_messages_): Const-ify. * bld.c (ffebld_arity_op_): Likewise. * bld.h (ffebld_arity_op_): Likewise. * com.c (ffecom_init_0): Likewise. * intdoc.c (_ffeintrin_name_, _ffeintrin_gen_, _ffeintrin_spec_, _ffeintrin_imp_, names, gens, imps, specs, cc_pair, cc_descriptions, cc_summaries): Likewise. * intrin.c (_ffeintrin_name_, _ffeintrin_gen_, _ffeintrin_spec_, _ffeintrin_imp_, ffeintrin_names_, ffeintrin_gens_, ffeintrin_imps_, ffeintrin_specs_): Likewise. java: * jcf-io.c (format_uint): Const-ify. * lang.c (java_tree_code_type, java_tree_code_length): Likewise. * lex.c (java_get_line_col): Likewise. * parse.y (build_incdec): Likewise. From-SVN: r46062
2001-10-06cpplex.c (enum spell_type): Add SPELL_NUMBER.Zack Weinberg1-2/+2
* cpplex.c (enum spell_type): Add SPELL_NUMBER. (cpp_token_len, cpp_spell_token, cpp_output_token, _cpp_equiv_tokens): Handle it. * cpplib.h (TTYPE_TABLE): Use SPELL_NUMBER for CPP_NUMBER and CPP_COMMENT, SPELL_NONE for CPP_PADDING and CPP_EOF. * cppexp.c (_cpp_parse_expr): Use the correct operator code in error messages. From-SVN: r46052
2001-09-24c-lex.c (cb_def_pragma): Update.Neil Booth1-23/+16
* c-lex.c (cb_def_pragma): Update. (c_lex): Update, and skip padding. * cppexp.c (lex, parse_defined): Update, remove unused variable. * cpphash.h (struct toklist): Delete. (union utoken): New. (struct cpp_context): Update. (struct cpp_reader): New members eof, avoid_paste. (_cpp_temp_token): New. * cppinit.c (cpp_create_reader): Update. * cpplex.c (_cpp_temp_token): New. (_cpp_lex_direct): Add PREV_WHITE when parsing args. (cpp_output_token): Don't print leading whitespace. (cpp_output_line): Update. * cpplib.c (glue_header_name, parse_include, get__Pragma_string, do_include_common, do_line, do_ident, do_pragma, do_pragma_dependency, _cpp_do__Pragma, parse_answer, parse_assertion): Update. (get_token_no_padding): New. * cpplib.h (CPP_PADDING): New. (AVOID_LPASTE): Delete. (struct cpp_token): New union member source. (cpp_get_token): Update. * cppmacro.c (macro_arg): Convert to use pointers to const tokens. (builtin_macro, paste_all_tokens, paste_tokens, funlike_invocation_p, replace_args, quote_string, stringify_arg, parse_arg, next_context, enter_macro_context, expand_arg, _cpp_pop_context, cpp_scan_nooutput, _cpp_backup_tokens, _cpp_create_definition): Update. (push_arg_context): Delete. (padding_token, push_token_context, push_ptoken_context): New. (make_string_token, make_number_token): Update, rename. (cpp_get_token): Update to handle tokens as pointers to const, and insert padding appropriately. * cppmain.c (struct printer): New member prev. (check_multiline_token): Constify. (do_preprocessing, cb_line_change): Update. (scan_translation_unit): Update to handle spacing. * scan-decls.c (get_a_token): New. (skip_to_closing_brace, scan_decls): Update. * fix-header.c (read_scan_file): Update. * doc/cpp.texi: Update. * gcc.dg/cpp/macro10.c: New test. * gcc.dg/cpp/strify3.c: New test. * gcc.dg/cpp/spacing1.c: Add tests. * gcc.dg/cpp/19990703-1.c: Remove bogus test. * gcc.dg/cpp/20000625-2.c: Fudge to pass. From-SVN: r45793
2001-08-09cppexp.c (EXTRACT_PRIO): Uppercase and parenthsize macro parameter.Graham Stott1-2/+2
* cppexp.c (EXTRACT_PRIO): Uppercase and parenthsize macro parameter. (EXTRACT_FLAGS): Likewise. From-SVN: r44737
2001-07-29cppexp.c (parse_defined): Always record the macro name.Neil Booth1-22/+20
* cppexp.c (parse_defined): Always record the macro name. (lex): Don't worry about identifiers, or special-case CPP_NOT here. (_cpp_parse_expr): Figure out at the end of the routine whether we saw a valid !defined() expression. * cppfiles.c (stack_include_file): Update for mi_valid. (_cpp_pop_file_buffer): Similarly. * cpplex.c (_cpp_lex_token): Similarly. * cpphash.h (enum mi_state, enum mi_ind, mi_state, mi_if_not_defined, mi_lexed): Remove. (mi_valid): New. * cpplib.c (do_if): Simplify. (do_endif, push_conditional, _cpp_handle_directive): Update for renaming of mi_state to mi_valid. * cpp.texi: Add index entries for digraphs, and add comment that C++ refers to them as alternative tokens. From-SVN: r44459