aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplex.c
AgeCommit message (Collapse)AuthorFilesLines
2003-11-01re PR preprocessor/12847 (xxx.c:1:20: xxxx.h: No such file or directory)John David Anglin1-17/+19
PR preprocessor/12847 * cppfiles.c, cppexp.c, cpperror.c, cpplib.h, cpplib.c, cpplex.c, cppinit.c, cpptrad.c, cppmacro.c, fix-header.c, cpppch.c, c-pch.c, c-incpath.c, cppcharset.c (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR, DL_ICE, DL_EXTRACT, DL_WARNING_P): Prefix macro names with "CPP_". From-SVN: r73183
2003-10-13cpplex.c (_cpp_clean_line): In the common case of a line with no trigraphs ↵Zack Weinberg1-13/+70
and no \-newline... * cpplex.c (_cpp_clean_line): In the common case of a line with no trigraphs and no \-newline, avoid writing to memory. (_cpp_skip_block_comment): Use a local 'cur' pointer instead of the buffer member. Make c an uchar to avoid unnecessary sign extensions. From-SVN: r72437
2003-10-02cpplex.c (_cpp_get_fresh_line): Revert my no-longer-needed 08-28 change...Per Bothner1-11/+4
* cpplex.c (_cpp_get_fresh_line): Revert my no-longer-needed 08-28 change, since we're never called with a NULL buffer. (_cpp_lex_direct): Likewise. * cpptrad.c (_cpp_read_logical_line_trad): Likewise. Return false if buffer is NULL at end. * cpplex.c (_cpp_get_fresh_line): Return value now just depends on whether pfile->buffer is NULL after pop, ignoring return_at_eof. From-SVN: r72013
2003-08-28Fix (hopefully temporary) for breakage caused by my 08-21 patch.Per Bothner1-2/+6
* cpplex.c (_cpp_get_fresh_line): Check for null buffer. (_cpp_lex_buffer): Likewise. * cpptrad.c (_cpp_read_logical_line_trad): Likewise. From-SVN: r70898
2003-08-21cppfiles.c (stack_file): Correctly pass return_at_eof parameter to ↵Per Bothner1-3/+0
cpp_push_buffer. * cppfiles.c (stack_file): Correctly pass return_at_eof parameter to cpp_push_buffer. * cpplex.c (_cpp_get_fresh_line): Don't buffer->prev - handled by return_at_eof check. Always call _cpp_pop_buffer at end. From-SVN: r70646
2003-07-22cpplex.c (_cpp_process_line_notes): Mention option name in trigraphs warning.Geoffrey Keating1-3/+6
* cpplex.c (_cpp_process_line_notes): Mention option name in trigraphs warning. From-SVN: r69659
2003-07-19alias.c [...]: Remove unnecessary casts.Kaveh R. Ghazi1-2/+2
* 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-07-07genextract.c: Convert remaining prototypes to ISO C90.Andreas Jaeger1-2/+1
2003-07-07 Andreas Jaeger <aj@suse.de> * genextract.c: Convert remaining prototypes to ISO C90. * cpplex.c (_cpp_free_buff): Convert prototype to ISO C90. * fold-const.c (fold_single_bit_test): Likewise. * diagnostic.c (default_diagnostic_finalizer): Likewise. * cfgrtl.c (rtl_redirect_edge_and_branch): Likewise. * gengtype.c (write_array): Generate ISO C90 prototypes. * genflags.c (gen_proto): Generate ISO C90 prototypes. For cp: 2003-07-07 Andreas Jaeger <aj@suse.de> * friend.c: Convert to ISO C90 prototypes. * Make-lang.in ($(srcdir)/cp/cfns.h): Use ANSI-C as output language. * cfns.h: Regenerate. * typeck.c: Convert remaining prototypes to ISO C90. * search.c: Likewise. * decl2.c (build_expr_from_tree): Convert prototype to ISO C90. * semantics.c (expand_or_defer_fn): Likewise * mangle.c (discriminator_for_string_literal): Likewise. * g++spec.c (lang_specific_driver): Likewise. * search.c (lookup_base_r): Remove unused variable. From-SVN: r69050
2003-07-05cpplib.h (CPP_AT_NAME, [...]): New token types.Zack Weinberg1-288/+1
* cpplib.h (CPP_AT_NAME, CPP_OBJC_STRING): New token types. (struct cpp_options): Add narrow_charset, wide_charset, bytes_big_endian fields. Remove EBCDIC field. (cpp_init_iconv, cpp_interpret_string): New external interfaces. * cpphash.h: Include <iconv.h> if we have it, otherwise provide a dummy definition of iconv_t. (struct cpp_reader): Add narrow_cset_desc and wide_cset_desc fields. (_cpp_valid_ucn): Update prototype. (_cpp_destroy_iconv): New prototype. * doc/cpp.texi: Document character set handling. * doc/cppopts.texi: Document -fexec-charset= and -fexec-wide-charset=. * doc/extend.texi: Delete entire section on multiline strings. Rewrite section on __FUNCTION__ etc now that these are variables in C. * cppucnid.tab, cppucnid.pl: New files. * cppucnid.h: New generated file. * cppcharset.c: Include cppucnid.h. Lots of commentary added. (iconv_open, iconv, iconv_close): Provide dummy definitions if !HAVE_ICONV. (SOURCE_CHARSET, struct strbuf, init_iconv_desc, cpp_init_iconv, _cpp_destroy_iconv, convert_cset, width_to_mask, convert_ucn, emit_numeric_escape, convert_hex, convert_oct, convert_escape, cpp_interpret_string, narrow_str_to_charconst, wide_str_to_charconst): New. (ucn_valid_in_identifier): Use a binary search through the ucnranges table defined in cppucnid.h, not a long chain of if statements. (_cpp_valid_ucn): Add a limit pointer. Downgrade "universal character names are only valid in C++ and C99" to a warning. Issue the "meaning of \[uU] is different in traditional C" warning here. Take care not to let iconv see an invalid UCS value if we get a malformed UCN. Issue an error if we don't have iconv. (cpp_interpret_charconst): Moved here from cpplex.c. Use cpp_interpret_string to do the heavy lifting. * cppinit.c (cpp_create_reader): Initialize bytes_big_endian, narrow_charset, wide_charset fields of options structure. (cpp_destroy): Call _cpp_destroy_iconv. * cpplex.c (forms_identifier_p): Adjust call to _cpp_valid_ucn. (maybe_read_ucn, hex_digit_value, cpp_parse_escape): Delete. (cpp_interpret_charconst): Moved to cppcharset.c. * cpplib.c (dequote_string): Delete. (interpret_string_notranslate): New. (do_line, do_linemarker): Use interpret_string_notranslate. * Makefile.in (cppcharset.o): Depend on cppucnid.h. * c-common.c (fname_string, combine_strings): Delete. * c-common.h (fname_string, combine_strings): Delete prototypes. * c-lex.c (ignore_escape_flag): Delete. (cb_ident): Use cpp_interpret_string, not lex_string. (get_nonpadding_token): New function. (c_lex): Handle Objective-C @-prefixed identifiers and strings here. Adjust calls to lex_string. Don't write *value twice. (lex_string): Now handles string constant concatenation. Most of the work handed off to cpp_interpret_string. Call fix_string_type here. * c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): Replace with FUNC_NAME, throughout. (OBJC_STRING): New token type. (primary:STRING): No need to call fix_string_type here. (primary:objc_string): Make that OBJC_STRING. (objc_string nonterminal): Delete. (yylexname): Delete code to handle fake string constants. (yylexstring): Delete entirely. (_yylex): Handle CPP_AT_NAME and CPP_OBJC_STRING. No need to handle CPP_ATSIGN. * c.opt (-fexec-charset=, -fwide-exec-charset=): New options. * c-opts.c (missing_arg, c_common_handle_option): Handle OPT_fexec_charset_ and OPT_fwide_exec_charset_. (c_common_init): Set cpp_opts->bytes_big_endian, not cpp_opts->EBCDIC. Call cpp_init_iconv. (print_help): Document -fexec-charset= and -fexec-wide-charset=. (TARGET_EBCDIC): Delete default definition. * objc/objc-act.c (build_objc_string_object): No need to handle string constant concatenation. cp: * parser.c (cp_lexer_read_token): No need to handle string constant concatenation. testsuite: * gcc.c-torture/execute/wchar_t-1.x: New file; XFAIL wchar_t-1.c everywhere. * gcc.dg/concat.c: Concatenation of string constants with __FUNCTION__ / __PRETTY_FUNCTION__ is now a hard error. * gcc.dg/wtr-strcat-1.c: Loosen dg-warning regexp. * gcc.dg/cpp/escape-2.c: Use wide character constants where necessary to avoid multi-character character constant warning. * gcc.dg/cpp/escape.c: Likewise. * gcc.dg/cpp/ucs.c: Likewise. Remove backslashes from dg-bogus comments, as they confuse Tcl. Fix a typo. libstdc++-v3: * testsuite/22_locale/collate/compare/wchar_t/2.cc * testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc * testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc * testsuite/22_locale/collate/hash/wchar_t/2.cc * testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc * testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc * testsuite/22_locale/collate/transform/wchar_t/2.cc * testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc * testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc: XFAIL on all targets. From-SVN: r68952
2003-06-28builtins.c: Follow spelling conventions.Kazu Hirata1-1/+1
* builtins.c: Follow spelling conventions. * cgraph.c: Likewise. * cpplex.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/iwmmxt.md: Likewise. * config/c4x/c4x-modes.def: Likewise. * config/c4x/c4x.c: Likewise. * config/c4x/c4x.h: Likewise. * config/c4x/c4x.md: Likewise. * config/i386/i386-interix.h: Likewise. * config/mips/mips.h: Likewise. From-SVN: r68648
2003-06-17* cpplib.h, cpphash.h, cppcharset.c, cpperror.c, cppexp.cZack Weinberg1-144/+70
* 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-06-16builtin-attrs.def, [...]: Don't use macros from "symcat.h", instead rely on ↵Kaveh R. Ghazi1-1/+1
ISO C. * builtin-attrs.def, builtin-attrs.def, builtins.c, cpplex.c, cpplib.c, gencheck.c, gengenrtl.c, machmode.def, protoize.c: Don't use macros from "symcat.h", instead rely on ISO C. * system.h: Don't include "symcat.h". * configure.in (AC_C_STRINGIZE): Delete. * config.in, configure: Regenerate. From-SVN: r68035
2003-06-12ChangeLog: Follow spelling conventions.Kazu Hirata1-2/+2
* ChangeLog: Follow spelling conventions. * ChangeLog.2: Likewise. * c-decl.c: Likewise. * cfgloop.h: Likewise. * cgraph.c: Likewise. * coverage.c: Likewise. * cppcharset.c: Likewise. * cpphash.h: Likewise. * cpplex.c: Likewise. * cpplib.c: Likewise. * dbxout.c: Likewise. * df.c: Likewise. * dwarf2out.c: Likewise. * dwarfout.c: Likewise. * emit-rtl.c: Likewise. * explow.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gengtype.c: Likewise. * ggc.h: Likewise. * opts.c: Likewise. * real.c: Likewise. * reload.c: Likewise. * stmt.c: Likewise. From-SVN: r67849
2003-06-12Don't warn on dollars in builtin macro definitions,Hans-Peter Nilsson1-3/+3
e.g. __REGISTER_PREFIX__. * cpphash.h (struct cpp_reader): Move member warn_dollars... * cpplib.h (struct cpp_options): ...to here. Change type to unsigned char. * cppinit.c (cpp_create_reader): Set it to 1 here. (post_options): Don't set it here. * c-opts.c (c_common_init_options): Reset it to 0 here. (finish_options): Set it here. * cpplex.c (forms_identifier_p): Tweak for new location of warn_dollars. From-SVN: r67824
2003-05-17c-common.c, c-common.h (dollars_in_ident): Remove.Neil Booth1-4/+2
* c-common.c, c-common.h (dollars_in_ident): Remove. * c-opts.c (DOLLARS_IN_IDENTIFIERS): Default to true. (c_common_init_options, c_common_decode_option): Set dollars_in_ident. * cpphash.h (warned_dollar): Rename warn_dollars. * cppinit.c (struct lang_flags, lang_defaults, cpp_set_lang) Permit dollars regardless of -std=. (post_options): Set warn_dollars. * cpplex.c (forms_identifier_p): Use warn_dollars. * config/darwin.h, config/alpha/vms.h, config/m68hc11/m68hc11.h: Remove redundant definitions of DOLLARS_IN_IDENTIFIERS. * doc/cpp.texi, doc/cppopts.texi, doc/invoke.texi, doc/tm.texi: Update documentation. testsuite: * gcc.dg/dollar.c: New test. From-SVN: r66911
2003-05-04cppinit.c (cpp_create_reader, [...]): Warn about trigraphs unless explicity ↵Neil Booth1-1/+34
set or -trigraphs. * cppinit.c (cpp_create_reader, post_options): Warn about trigraphs unless explicity set or -trigraphs. * cpplex.c (warn_in_comment): New. (_cpp_process_line_notes): Better handling of -Wtrigraphs. (_cpp_skip_block_comment): Add call to _cpp_process_line_notes. * doc/cppopts.texi, doc/cpp.texi: Update. testsuite: * gcc.dg/cpp/Wtrigraphs.c: Update. * gcc.dg/cpp/Wtrigraphs-2.c: New tests. From-SVN: r66459
2003-04-26Revert cpplex.c changeNeil Booth1-0/+6
From-SVN: r66118
2003-04-26* _cpp_lex_direct: Remove pointless code.Neil Booth1-6/+0
From-SVN: r66106
2003-04-24cpplex.c (cpp_token_len): Tighten up.Neil Booth1-7/+7
* cpplex.c (cpp_token_len): Tighten up. (cpp_token_as_text): Need extra byte now. * cpplib.c (glue_header_name): Need extra 2 bytes. * cppmacro.c (cpp_macro_definition): Need extra byte. From-SVN: r66049
2003-04-23Makefile.in (c-lex.o, [...]): Update.Neil Booth1-114/+71
* Makefile.in (c-lex.o, LIBCPP_OBJS, cpplex.o): Update. * c-lex.c (MULTIBYTE_CHARS): Remove conditionals. (lex_string): Take cpp_string with full spelling. (cb_ident): Update. (c_lex): Update diagnostics. * cpplex.c (SPELL_NUMBER, SPELL_STRING): Combine into SPELL_LITERAL. (create_literal): New. (lex_string): Unterminated literals have type CPP_OTHER. (_cpp_lex_direct): Update calls to lex_string. Use create_literal for CPP_OTHER. (cpp_token_len, cpp_spell_token, cpp_output_token): Simplify. (_cpp_equiv_tokens, cpp_interpret_charconst): Update. * cpplib.c (parse_include, do_line, do_linemarker, destringize_and_run): Update for token storing full spelling. * cpplib.h: Update token spelling types. * cppmacro.c (stringify_arg, check_trad_stringification): Update for token storing full spelling. cp: * Make-lang.in (lex.o): Remove mbchar.h. * lex.c (MULTIBYTE_CHARS): Lose. * parser.c (cp_lexer_get_preprocessor_token): CPP_OTHER handled in c-lex.c. testsuite: * gcc.dg/cpp/include2.c: Update. * gcc.dg/cpp/multiline-2.c: New. * gcc.dg/cpp/multiline.c: Update. * gcc.dg/cpp/strify2.c: Update. * gcc.dg/cpp/trad/literals-2.c: Update. From-SVN: r66019
2003-04-22* cpplex.c (_cpp_get_fresh_line): Pop the buffer if return_at_eof.Neil Booth1-4/+4
From-SVN: r65954
2003-04-22c-lex.c (c_lex): Handle CPP_OTHER differently.Neil Booth1-15/+11
* 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-20cpphash.h (NOTE_ESC_NL, [...]): Remove.Neil Booth1-27/+24
* cpphash.h (NOTE_ESC_NL, NOTE_ESC_SPACE_NL, NOTE_TRIGRAPH, NOTE_NEWLINE): Remove. * cpplex.c (_cpp_clean_line, _cpp_process_line_notes): Update to handle new form of line note type. From-SVN: r65860
2003-04-20cpplex.c (_cpp_lex_direct): Set BOL for CPP_EOF tokens.Nathan Sidwell1-0/+6
.: * cpplex.c (_cpp_lex_direct): Set BOL for CPP_EOF tokens. * gcov.c (output_lines): Don't be so fussy about going past EOF. cp: * cp/decl2.c (start_static_storage_duration_function): Take count arg, don't check if it wraps round. (generate_ctor_or_dtor_function): Add locus arg, use it. (generate_ctor_and_dtor_functions_for_priority): Data arg is a locus. (finish_file): Set line numbers to past EOF for synthesized functions. From-SVN: r65847
2003-04-20Makefile.in (LIBCPP_OBJS): Add cppcharset.o.Neil Booth1-111/+82
* Makefile.in (LIBCPP_OBJS): Add cppcharset.o. (cppcharset.o): New target. * c-lex.c (is_extended_char): Move to cppcharset.c. (utf8_extend_token): Delete. * cppcharset.c: New file. * cpphash.h (_cpp_valid_ucn): New. * cpplex.c (lex_identifier): Update prototype. (continues_identifier_p): Rename forms_identifier_p. Handle UCN escapes. (maybe_read_ucs): Rename maybe_read_ucn. Update to use code in cppcharset.c. (lex_number, lex_identifier, cpp_parse_escape): Update. (_cpp_lex_direct): Update to handle UCNs. (cpp_avoid_paste): Don't paste to form a UCN. testsuite: * ucs.c: Update diagnostic messages. From-SVN: r65845
2003-04-19cpphash.h (struct cpp_buffer): Remove backup_to.Neil Booth1-160/+100
* cpphash.h (struct cpp_buffer): Remove backup_to. * cpplex.c (BACKUP, get_effective_char): Die. (_cpp_skip_block_comment): Assume '*' is location on entry. (continues_identifier_p): Respect -fno-dollars-in-identifiers. (IF_NEXT_IS): Update. (_cpp_lex_direct): Don't use backup_to; look ahead directly. From-SVN: r65819
2003-04-19cpphash.h (struct cpp_reader): New member warned_dollar.Neil Booth1-214/+101
* cpphash.h (struct cpp_reader): New member warned_dollar. * cpplex.c (continues_identifier_p): New function. (parse_identifier, parse_number, parse_string): Rename lex_identifer, lex_number and lex_string, and simplify. (parse_slow, unescaped_terminator_p): Die. (_cpp_lex_direct): Update. From-SVN: r65816
2003-04-19* skip_whitespace: Rearrange to avoid stage1 ICE.Neil Booth1-8/+5
From-SVN: r65809
2003-04-19cppfiles.c (ENABLE_VALGRIND_CHECKING, [...]): Remove.Neil Booth1-370/+222
* cppfiles.c (ENABLE_VALGRIND_CHECKING, VALGRIND_DISCARD, MMAP_THRESHOLD, TEST_THRESHOLD, SHOULD_MMAP): Remove. (struct include_file): Remove fefcnt, mapped members. (open_file, stack_include_file, _cpp_pop_file_buffer): Disable caching. (read_include_file): Don't use mmap, terminate buffers in '\r'. (purge_cache): Don't use munmap. * cpphash.h (CPP_BUF_COLUMN): Update. (lexer_state): Remove lexing_comment. (struct _cpp_line_note): New. (struct cpp_buffer): New members cur_note, notes_used, notes_cap, next_line and need_line. Remove col_adjust and saved_flags. (_cpp_process_line_notes, _cpp_clean_line, _cpp_get_fresh_line, _cpp_skip_block_comment, scan_out_logical_line): New. (_cpp_init_mbchar): Remove. * cppinit.c (init_library): Remove call to _cpp_init_mbchar. (cpp_read_main_file): Set line to 1 earlier. (post_options): -traditional-cpp doesn't want trigraphs. * cpplex.c (MULTIBYTE_CHARS): Remove code predicated on this. (add_line_note, _cpp_clean_line, _cpp_process_line_notes, _cpp_get_fresh_line): New. (handle_newline, skip_escaped_newlines, trigraph_p, continue_after_nul, _cpp_init_mbchar): Remove. (get_effective_char): Update. (_cpp_skip_block_comment): Rename from skip_block_comment, simplify. (skip_line_comment): Simplify. (skip_whitespace, parse_identifier, parse_slow, parse_number, parse_string): Update. (cpp_lex_direct): Use clean lines and process line notes. Update. (cpp_interpret_charconst): No MULTIBYTE_CHARS. * cpplib.c (prepare_directive_trad): Call scan_out_logical_line directly. (_cpp_handle_directive): Don't set saved_flags. (run_directive, destringize_and_run, cpp_define, cpp_define_builtin, cpp_undef, handle_assertion, cpp_push_buffer): Update. (_cpp_pop_buffer): Free notes. * cppmacro.c (builtin_macro, paste_tokens): \n terminate buffer. * cpppch.c (cpp_read_state): \n terminate buffer. * cpptrad.c (skip_escaped_newlines, handle_newline): Remove. (copy_comment): Use _cpp_skip_block_comment. (skip_whitespace, lex_identifier, _cpp_read_logical_line_trad): Simplify. (_cpp_overlay_buffer, _cpp_remove_overlay, push_replacement_text, save_replacement_text): Update. (scan_out_logical_line): Update to use clean lines and process line notes. * fix-header.c (read_scan_file): Update. testsuite: * gcc.dg/cpp/_Pragma4.c: Remove stray space. * gcc.dg/cpp/trad/escaped-eof.c: Correct line number. From-SVN: r65808
2003-03-17c-opts.c: Default TARGET_EBCDIC to 0 if not defined.Neil Booth1-18/+27
* c-opts.c: Default TARGET_EBCDIC to 0 if not defined. (c_common_init): Set EBCDIC in cpp options. * cpplex.c (maybe_read_ucs, cpp_parse_escape): Use EBCDIC option, not conditional compilation. * cpplib.h (struct cpp_options): New entry EBCDIC. From-SVN: r64471
2003-03-06Makefile.in (c-ppoutput.o): Update.Neil Booth1-0/+10
* Makefile.in (c-ppoutput.o): Update. * c-common.h (init_pp_output): New. (preprocess_file): Update. * c-lex.c (init_c_lex): Move mbchar initialization to cpplib. Register builtins. * c-opts.c (c_common_init): Call init_pp_output if preprocessing. Make call to cpp_read_main_file common to whether preprocessing or not. Don't register builtins. * c-ppoutput.c: Include c-pragma.h. (setup_callbacks): Rename init_pp_output. (preprocess_file): No longer setup callbacks or call cpp_read_main_file. * cpphash.h (_cpp_init_mbchar): New. * cppinit.c (init_library): Call _cpp_init_mbchar. * cpplex.c (_cpp_init_mbchar): New. From-SVN: r63913
2003-01-23* cpplex.c (cpp_interpret_charconst): Squelch warning with cast.Kaveh R. Ghazi1-1/+1
From-SVN: r61667
2003-01-18alias.c: Fix comment typos.Kazu Hirata1-1/+1
* alias.c: Fix comment typos. * basic-block.h: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-decl.c: Likewise. * c-opts.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.h: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfglayout.c: Likewise. * cfgrtl.c: Likewise. * convert.c: Likewise. * cpphash.h: Likewise. * cpplex.c: Likewise. * cpplib.h: Likewise. * df.h: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dwarf2.h: Likewise. From-SVN: r61462
2002-12-16Merge basic-improvements-branch to trunkZack Weinberg1-1/+3
From-SVN: r60174
2002-09-26c-common.h: Follow spelling conventions.Kazu Hirata1-1/+1
* c-common.h: Follow spelling conventions. * cpplex.c: Likewise. * cpplib.h: Likewise. * gthr-dce.h: Likewise. * gthr-posix.h: Likewise. * optabs.c: Likewise. * output.h: Likewise. * profile.c: Likewise. * protoize.c: Likewise. * ra-rewrite.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regclass.c: Likewise. * regmove.c: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. From-SVN: r57555
2002-09-22ChangeLog: Follow spelling conventions.Kazu Hirata1-3/+3
* 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-07-21c-decl.c (build_array_declarator): Say 'ISO C90', not 'ISO C89'.Gabriel Dos Reis1-1/+1
2002-07-21 Gabriel Dos Reis <gdr@nerim.net> * c-decl.c (build_array_declarator): Say 'ISO C90', not 'ISO C89'. (grokdeclarator): Likewise. * c-format.c (C_STD_NAME): Likewise. * c-lex.c (interpret_integer): Likewise. * c-typeck.c (build_array_ref): Likewise. * cpplex.c (_cpp_lex_direct): Likewise. * toplev.c (documented_lang_options): Likewise. testsuite/ 2002-07-21 Gabriel Dos Reis <gdr@nerim.net> * gcc.dg/c90-arraydecl-1.c: Change C89 too C90. From-SVN: r55629
2002-06-11Makefile.in: Update cppmain.o.Neil Booth1-1/+10
* Makefile.in: Update cppmain.o. * cpphash.h (struct cpp_reader): Move some members to a nested structure. (trad_line): Rename saved_line. (_cpp_read_logical_line_trad): Update. (_cpp_remove_overlay): New. * cppinit.c (cpp_create_reader): No need to set saved_line. (cpp_destroy): Update. (cpp_read_main_file): Only overlay if compiling. * cpplex.c (continue_after_nul): Return false if in directive. * cpplib.c (EXPAND): New. (directive_table, SEEN_EOL): Update. (end_directive): Remove overlay if traditional; don't skip line in traditional #define. (prepare_directive_trad): New. (_cpp_handle_directive, run_directive): Update for traditional directives. (lex_macro_node): Simplify, don't use lex_identifier_trad. * cpplib.h (struct options): Add preprocess_only. * cppmain.c: Don't include intl.h. (cpp_preprocess_file): Set options->preprocess_only. (scan_translation_unit_trad): Fix, and print line numbers. * cpptrad.c (check_output_buffer, lex_identifier, scan_parameters, maybe_start_funlike, scan_out_logical_line, replace_args_and_push, save_replacement_text, _cpp_create_trad_definition): Update for variable renaming. (_cpp_overlay_buffer): Save line number. (_cpp_remove_overlay): Rename from restore_buff, restore line. (_cpp_read_logical_line_trad): Don't handle overlays here. (scan_out_logical_line): Process directives. From-SVN: r54485
2002-06-10cpphash.h (_cpp_read_logical_line_trad, [...]): Update prototypes.Neil Booth1-1/+1
* cpphash.h (_cpp_read_logical_line_trad, _cpp_expansions_different_trad): Update prototypes. * cpplex.c (continue_after_nul): New. * cppmain.c: Include cpphash.h. (scan_translation_unit_trad): New. (cpp_preprocess_file): Call it. * cpptrad.c (_cpp_read_logical_line_trad): Take new parameter overlay. (_cpp_expansions_different_trad): Update prototype. From-SVN: r54446
2002-06-07cpptrad.c (struct block, [...]): New.Neil Booth1-14/+1
* cpptrad.c (struct block, BLOCK_HEADER_LEN, BLOCK_LEN, scan_parameters, save_replacement_text, replacement_length): New. (scan_out_logical_line): Take a macro and save parameters if non-NULL. (_cpp_logical_line_trad): Update. (_cpp_create_trad_definition): Update to handle function-like macros. * cpplex.c (new_buff): Update. (struct dummy, DEFAULT_ALIGNMENT, CPP_ALIGN): Move... * cpphash.h: ...here. (CPP_ALIGN2, _cpp_save_parameter): New. * cppmacro.c (save_parameter): Rename, export. (parse_params): Update. From-SVN: r54331
2002-05-22cpperror.c: Fix formatting.Kazu Hirata1-53/+53
* 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-17Makefile.in: Update for cpptrad.c.Neil Booth1-23/+46
* Makefile.in: Update for cpptrad.c. * cpphash.h (struct cpp_buffer): New members for buffer overlays. (struct cpp_reader): New members for traditional output. (_cpp_read_logical_line, _cpp_overlay_buffer): New. * cppinit.c (cpp_create_reader): Set trad_line. (cpp_destroy): Free trad_out_base if used. (cpp_read_main_file): Overlay an empty buffer if traditional. (cpp_finish_options): Don't do builtins. (COMMAND_LINE_OPTIONS): Add -traditional-cpp. (cpp_handle_option): Handle it. * cpplex.c (continue_after_nul): New. (_cpp_lex_direct): Use handle_nul. * cpplib.h (struct cpp_options): New traditional option. * cpptrad.c: New file. From-SVN: r53568
2002-05-11cpplex.c (_cpp_lex_direct): When in a directive at EOF fake a newline.Neil Booth1-2/+2
* cpplex.c (_cpp_lex_direct): When in a directive at EOF fake a newline. From-SVN: r53386
2002-05-08cpplex.c (cpp_interpret_charconst): Truncate as well as sign-extend.Neil Booth1-9/+11
* cpplex.c (cpp_interpret_charconst): Truncate as well as sign-extend. doc: * cpp.texi: Clarify multichar charconst valuation. testsuite: * gcc.dg/cpp/charconst-4.c: More tests. From-SVN: r53301
2002-05-07c-common.c (c_common_init): Set options->unsigned_wchar.Neil Booth1-2/+2
* c-common.c (c_common_init): Set options->unsigned_wchar. * cppinit.c (cpp_create_reader): Default unsigned_wchar, group target dependencies. (init_builtins, cpp_handle_option): Update. * cpplex.c (cpp_interpret_charconst): Update. * cpplib.h (struct cpp_options): Add unsigned_wchar, rename signed_char to unsigned_char, group target dependencies. * defaults.h (WCHAR_UNSIGNED): Remove. * system.h (WCHAR_UNSIGNED, MAX_CHAR_TYPE_SIZE): Poison. config: * freebsd.h, interix.h, alpha/freebsd.h, arm/freebsd.h, i386/386bsd.h, i386/beos-elf.h, i386/bsd386.h, i386/cygwin.h, i386/djgpp.h, i386/freebsd-aout.h, i386/i386-interix.h, i386/win32.h, ia64/freebsd.h, mips/netbsd.h, rs6000/freebsd.h, sh/elf.h, sh/sh.h, sparc/freebsd.h: Remove WCHAR_UNSIGNED. doc: * tm.texi: Remove MAX_CHAR_TYPE_SIZE. From-SVN: r53271
2002-05-06c-common.c (warn_multichar): New.Neil Booth1-7/+18
* 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-05cpplex.c (cpp_interpret_charconst): Sign-extend each character.Neil Booth1-27/+22
* cpplex.c (cpp_interpret_charconst): Sign-extend each character. Don't ignore excess characters. Treat multicharacter character constants as signed. (cpp_parse_escape): Clarify diagnostic. From-SVN: r53200
2002-05-05c-common.c (c_common_init): Set up CPP arithmetic.Neil Booth1-1/+2
* c-common.c (c_common_init): Set up CPP arithmetic. * cppinit.c (cpp_create_reader): Default CPP arithmetic to something reasonable for the host. (sanity_checks): Add checks. (cpp_read_main_file): Call sanity_checks() from here... (cpp_post_options): ... not here. * cpplex.c (cpp_interpret_charconst): Get max_chars right. * cpplib.h (struct cpp_options): New member int_precision. testsuite: * gcc.dg/cpp/charconst.c: Update tests. From-SVN: r53186