aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmacro.c
AgeCommit message (Collapse)AuthorFilesLines
2002-07-17cppexp.c (cpp_interpret_integer, [...]): Clarify and correct use of "bool" ↵Neil Booth1-12/+13
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-01* cppmacro.c: Forgotten commit.Neil Booth1-2/+6
From-SVN: r55134
2002-06-19cpphash.h (struct cpp_reader): Make date and time strings.Neil Booth1-64/+87
* cpphash.h (struct cpp_reader): Make date and time strings. (_cpp_builtin_macro_text, _cpp_copy_replacement_text, _cpp_replacement_text_len): New. * cppinit.c (cpp_create_reader): Update. (init_builtins): Register appropriate builtins for -traditional-cpp. * cppmacro.c (new_number_token): Remove. (_cpp_builtin_macro_text): New. (builtin_macro): Use it. (cpp_macro_definition): Update to handle traditional macros. * cppmain.c (cb_line_change): Don't do column positioning for traditional output. * cpptrad.c (enum ls): Rename ls_fun_macro to ls_fun_open. New state ls_fun_close. (skip_whitespace): Fix. (maybe_start_funlike): Don't set state.parsing_args. (scan_out_logical_line): Remove duplicate error. Use lex_state rather than state.parsing_args. (push_replacement_text): Handle builtins. (_cpp_replacement_text_len, _cpp_copy_replacement_text): New. From-SVN: r54771
2002-06-13cpplib.c (end_directive): Handle line skipping.Neil Booth1-0/+1
* cpplib.c (end_directive): Handle line skipping. Only remove the rest of the line if the directive was valid. * cppmacro.c (_cpp_push_text_context): Set NODE_DISABLED when expanding a traditional macro. * cpptrad.c (recursive_macro): New. (read_logical_line_trad): Handle skipping. (scan_out_logical_line): Continue after a successful directive. Don't expand macros whilst skipping, or if recursing. (_cpp_create_trad_definition): scan_out_logical_line now sets the output current position. From-SVN: r54573
2002-06-10cpphash.h (struct cpp_macro): Put comments on their own lines.Neil Booth1-7/+8
* cpphash.h (struct cpp_macro): Put comments on their own lines. (_cpp_expansions_different_trad): New. * cppmacro.c (warn_of_redefinition): Fix for traditional case. * cpptrad.c (canonicalize_text): New. (scan_out_logical_line): Handle no arguments correctly. (save_replacement_text): Commit memory when finished. (_cpp_expansions_different_trad): New. From-SVN: r54432
2002-06-09cpphash.h (_cpp_push_text_context): Update.Neil Booth1-41/+57
* cpphash.h (_cpp_push_text_context): Update. (_cpp_arguments_ok): New. * cppmacro.c (_cpp_arguments_ok): New, split out from... (collect_args): ...here. (_cpp_push_text_context): Change inputs. * cpptrad.c (struct fun_macro, maybe_start_funlike, save_argument, replace_args_and_push): New. (lex_identifier, _cpp_lex_identifier_trad, scan_parameters): Don't use IS macros directly. (scan_out_logical_line): Handle function-like macro argument collection. (push_replacement_text): Update. (replacement_length): Remove. (_cpp_create_trad_definition): Don't skip whitespace before checking for '('. From-SVN: r54412
2002-06-07cpptrad.c (struct block, [...]): New.Neil Booth1-5/+5
* 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-06-05cpphash.h (_cpp_create_definition): Update prototype.Neil Booth1-59/+93
* cpphash.h (_cpp_create_definition): Update prototype. (_cpp_push_text_context, _cpp_create_trad_definition): New. ( cpp_lex_identifier_trad): New. (_cpp_set_trad_context): New. * cppinit.c (cpp_finish_options): Don't conditionalize builtins. * cpplib.c (SEEN_EOL): Update. (lex_macro_node): Update for -traditional. (cpp_push_buffer, _cpp_pop_buffer): Similarly. * cppmacro.c (_cpp_create_definition): Split into create_iso_definition() and _cpp_create_trad_definition(). (warn_of_redefinition): Update prototype; handle traditional macros. (_cpp_push_text_context): New. * cpptrad.c (skip_whitespace, push_replacement_text): New. (lex_identifier): Call ht_lookup with correct start. (_cpp_lex_identifier_tradm _cpp_create_trad_definition, _cpp_set_trad_context): New. (scan_out_logical_line): Update to handle changing contexts. From-SVN: r54293
2002-06-04cpphash.h (FIRST, [...]): New.Neil Booth1-11/+11
* cpphash.h (FIRST, LAST, CUR, RLIMIT): New. (struct cpp_context): Add traditional fields. * cppmacro.c (paste_all_tokens, push_ptoken_context, push_token_context, cpp_get_token, _cpp_backup_tokens): Update. * cpptrad.c (skip_comment, lex_identifier, _cpp_read_logical_line_trad, scan_out_logical_line): Update. From-SVN: r54242
2002-05-29re PR preprocessor/6844 (Seg fault when trying to preprocess a file with ↵Neil Booth1-1/+1
lots of #define's) PR preprocessor/6844 * cppmacro.c (cpp_macro_definition): Reserve space for terminating NUL. From-SVN: r54014
2002-05-24re PR preprocessor/6780 (Incorrect diagnosis of token pasting)Neil Booth1-0/+2
PR preprocessor/6780 * cppmacro.c (enter_macro_context): Clear state.angled_headers. testsuite: * gcc.dg/cpp/paste12.c: New test. From-SVN: r53851
2002-05-22cpperror.c: Fix formatting.Kazu Hirata1-6/+6
* 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-21c-common.c (c_common_init): Set options->unsigned_char from flag_signed_char.Zack Weinberg1-3/+6
* c-common.c (c_common_init): Set options->unsigned_char from flag_signed_char. (cb_register_builtins): Define __STRICT_ANSI__ and __CHAR_UNSIGNED__ here... * cppinit.c (init_builtins): Not here. (cpp_create_reader): unsigned_char option defaults to 0, not !DEFAULT_SIGNED_CHAR. (COMMAND_LINE_OPTIONS, cpp_handle_option): Lose -fsigned-char and -funsigned-char. * cpphash.h (struct spec_nodes): Kill n__STRICT_ANSI__. * cpphash.c (_cpp_init_hashtable): Don't set it. * cppmacro.c (builtin_macro) [BT_STDC]: Use the language setting directly. Clarify comment. From-SVN: r53703
2002-05-16c-common.c (STDC_0_IN_SYSTEM_HEADERS, [...]): Default-define here.Zack Weinberg1-2/+12
* c-common.c (STDC_0_IN_SYSTEM_HEADERS, REGISTER_PREFIX): Default-define here. (builtin_define_with_value): Can now wrap the expansion in quotation marks if such is wanted. (cb_register_builtins): Update calls to builtin_define_with_value. Define __REGISTER_PREFIX__, __USER_LABEL_PREFIX__, and __VERSION__ here. (c_common_init): Set options->stdc_0_in_system_headers. * c-lex.h: Update prototype of builtin_define_with_value. * cppdefault.h: Remove default definitions of USER_LABEL_PREFIX and REGISTER_PREFIX. * cppinit.c (VERS, ULP, C, X): Kill. (builtin_array): Remove entries for __VERSION__, __USER_LABEL_PREFIX__, __REGISTER_PREFIX__, and __HAVE_BUILTIN_SETJMP__. Make __STDC__ always a builtin, not a constant. (init_builtins): Kill off a bunch of now-dead code. (COMMAND_LINE_OPTIONS): Remove -fleading-underscore and -fno-leading-underscore. (cpp_handle_option): Remove code to set user_label_prefix. (cpp_post_options): Likewise. * cpplib.h (struct cpp_options): Remove user_label_prefix. (stdc_0_in_system_headers): New. * cppmacro.c (builtin_macro): Check CPP_OPTION (pfile, stdc_0_in_system_headers) too to decide the value of __STDC__. * tradcpp.c (user_label_prefix): Kill. (main): Remove code handling -f(no-)leading-underscore. (initialize_builtins): Don't define __REGISTER_PREFIX__ or __USER_LABEL_PREFIX__. (install_value): Wrap compound statement in dummy loop so the macro works properly in an if statement. From-SVN: r53525
2002-05-16cpphash.h (cpp_macro): Move here, and make expansion a union.Neil Booth1-27/+15
* cpphash.h (cpp_macro): Move here, and make expansion a union. * cppmacro.c (cpp_macro): Remove. (enter_macro_context, replace_args, warn_of_redefinition, _cpp_create_definition, cpp_macro_definition): Update. From-SVN: r53509
2002-05-09cpplib.c (cpp_init_internal_pragmas): Remove #pragma poison.Neil Booth1-2/+2
* cpplib.c (cpp_init_internal_pragmas): Remove #pragma poison. * cppmacro.c (paste_all_tokens): Bad pastes are a hard error. doc: * cpp.texi: Update for removal of obsolete features. testsuite: * gcc.dg/cpp/poison.c: Update. * gcc.dg/cpp/20000625-2.c: Remove. * gcc.dg/cpp/direct2s.c: Remove final test. From-SVN: r53333
2002-04-22cppfiles.c (_cpp_pop_file_buffer): Return void.Neil Booth1-2/+6
* cppfiles.c (_cpp_pop_file_buffer): Return void. Move file change and include code to _cpp_pop_buffer. * cpphash.h (struct pending_option): Predeclare. (struct cpp_reader): New member next_include_file. (_cpp_pop_file_buffer): Update. (_cpp_push_next_buffer): Update, rename. * cppinit.c (cpp_destroy): Free include chain and pending here. (cpp_finish_options): Simplify. (_cpp_push_next_buffer): Rename and clean up. * cpplib.c (cpp_pop_buffer): Move code from _cpp_pop_file_buffer. Clarify. * cppmacro.c (cpp_scan_nooutput): Set return_at_eof here. From-SVN: r52621
2002-04-21cppexp.c (struct op, [...]): Replace U_CHAR with uchar.Neil Booth1-10/+10
* 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-21cppmacro.c (funlike_invocation_p): Don't step back over CPP_EOF.Neil Booth1-6/+11
* cppmacro.c (funlike_invocation_p): Don't step back over CPP_EOF. testsuite: * gcc.dg/cpp/endif.h, gcc.dg/cpp/endif.c: New tests. From-SVN: r52586
2002-04-14cpperror.c (print_location): Don't print include chain if line == 0.Neil Booth1-28/+39
* 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-04-07cppinit.c (cpp_create_reader): Initialize discard_comments_in_macro_exp.Jason Thorpe1-0/+9
* cppinit.c (cpp_create_reader): Initialize discard_comments_in_macro_exp. (COMMAND_LINE_OPTIONS): Add "-CC" option. (cpp_handle_option): Handle "-CC" option. * cpplex.c (save_comment): If saving a C++ comment in a directive, convert it to a C comment. (_cpp_lex_direct): Pass second comment start character to save_comment to indicate comment type. * cpplib.c (_cpp_handle_directive): If processing a "#define" directive and discard_comments_in_macro_exp is false, re-enable saving of comments. (lex_macro_node): If discard_comments_in_macro_exp is false, discard any comments before the macro identifier. * cpplib.h (struct cpp_options): Add discard_comments_in_macro_exp member. * cppmacro.c (cpp_get_token): If expanding a macro while processing a directive, discard any comments we might encounter. (parse_params): If discard_comments_in_macro_exp is false, ignore comments in the macro parameter list. * gcc.c (cpp_unique_options): Add "-CC" option. (option_map): Map "--comments-in-macros" to "-CC". * doc/cppopts.texi: Document "-CC" option. * f/lang-specs.h: Add "-CC" option. * testsuite/gcc.dg/cpp/maccom1.c: New test. * testsuite/gcc.dg/cpp/maccom2.c: New test. * testsuite/gcc.dg/cpp/maccom3.c: New test. * testsuite/gcc.dg/cpp/maccom4.c: New test. * testsuite/gcc.dg/cpp/maccom5.c: New test. * testsuite/gcc.dg/cpp/maccom6.c: New test. From-SVN: r51975
2002-04-05cppmacro.c (cpp_macro_definition): Do not emit spaces after macro formal ↵Jim Blandy1-4/+7
parameter names. * cppmacro.c (cpp_macro_definition): Do not emit spaces after macro formal parameter names. From-SVN: r51890
2002-03-19cppmacro.c (cpp_macro_definition): Emit a space after the macro name...Jim Blandy1-1/+4
* cppmacro.c (cpp_macro_definition): Emit a space after the macro name, even if the replacement list contains no tokens, as required by Dwarf. From-SVN: r51045
2002-03-14cpphash.h (struct lexer_state): Remove line_extension member.Zack Weinberg1-8/+6
* cpphash.h (struct lexer_state): Remove line_extension member. * cpplib.c (dequote_string, do_linemarker): New functions. (linemarker_dir): New data object. (DIRECTIVE_TABLE): No longer need to interpret #line in preprocessed source. Delete obsolete comment about return values of handlers. (end_directive, directive_diagnostics, _cpp_handle_directive): Don't muck with line_extension. (directive_diagnostics): No need to issue warnings for linemarkers here. (_cpp_handle_directive): Issue warnings for linemarkers here, when appropriate. Dispatch linemarkers to do_linemarker, not do_line. (do_line): Code to handle linemarkers split out to do_linemarker. Convert escape sequences in filename argument, both places. * cppmacro.c (quote_string): Rename cpp_quote_string and export. All callers changed. * cpplib.h (cpp_quote_string): Prototype. * cppmain.c (print_line): Call cpp_quote_string on to_file before printing it. * doc/cpp.texi: Document that escapes are now interpreted in #line and in linemarkers, and that non-printing characters are converted to octal escapes when linemarkers are generated. From-SVN: r50779
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-27cpplex.c (_cpp_lex_token): Handle directives in macro arguments.Neil Booth1-28/+9
* cpplex.c (_cpp_lex_token): Handle directives in macro arguments. * cpplib.c (_cpp_handle_directive): Save and restore state if parsing macro args when entering a directive. * cppmacro.c (collect_args): No need to handle directives in macro arguments. (enter_macro_context, replace_args): Use the original macro definition in case it was redefined whilst collecting arguments. doc: * cpp.texi: Update. testsuite: * gcc.dg/cpp/undef1.c: Remove. * gcc.dg/cpp/directiv.c: Update. * gcc.dg/cpp/mac-dir-1.c, mac-dir-2.c: New tests. From-SVN: r50091
2002-01-03cpperror.c: Update comments and copyright.Neil Booth1-1/+1
* 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
2002-01-03cppmacro.c: Don't include intl.h.Neil Booth1-38/+54
* cppmacro.c: Don't include intl.h. Update comments. (new_number_token): Allocate enough buffer for 64-bit unsigned integers; update prototype. * cppmain.c: Update comments. From-SVN: r48518
2001-12-15c-typeck.c, [...]: Use "built-in" and "bit-field" spellings in messages.Joseph Myers1-1/+1
* c-typeck.c, config/i386/i386.h, config/mcore/mcore.h, config/ns32k/ns32k.h, config/rs6000/sysv4.h, fold-const.c, toplev.c, cppinit.c, cppmacro.c, gcc.c: Use "built-in" and "bit-field" spellings in messages. * po/gcc.pot: Regenerate. ch: * expr.c: Use "built-in" spelling in messages. From-SVN: r48048
2001-12-01c-decl.c (duplicate_decls, [...]): Remove trailing period from diagnostics.Neil Booth1-1/+1
* c-decl.c (duplicate_decls, parmlist_tags_warning): Remove trailing period from diagnostics. * c-lex.c (cb_file_change): Similarly. * cppmacro.c (check_trad_stringification): Similarly. * gcc.c (do_spec_1): Similarly. * genattr.c (main): Similarly. * genattrtab.c (main, operate_exp, make_length_attrs): Similarly. * gencodes.c (main): Similarly. * genconfig.c (main): Similarly. * genconstants.c (main): Similarly. * genemit.c (main): Similarly. * genextract.c (main): Similarly. * genopinit.c (main): Similarly. * genoutput.c (main): Similarly. * genpeep.c (main): Similarly. * genrecog.c (main): Similarly. * mips-tfile.c (add_file, error): Similarly. * profile.c (init_branch_prob): Similarly. * reload1.c (spill_failure): Similarly. * stmt.c (parse_output_constraint): Similarly. * varasm.c (assemble_variable): Similarly. cp: * class.c (finish_struct): Similarly. * decl.c (check_tag_decl): Similarly. * lex.c (cxx_set_yydebug): Similarly. * typeck2.c (friendly_abort): Similarly. java: * expr.c (expand_byte_code): Similarly. * jcf-parse.c (load_class, jcf_parse): Similarly. * jcf-write.c (generate_classfile): Similarly. * lex.c (java_lex): Similarly. From-SVN: r47517
2001-11-26cppfiles.c (stack_include_file): Don't optimize zero-length files.Neil Booth1-4/+4
* cppfiles.c (stack_include_file): Don't optimize zero-length files. (read_include_file): NUL-terminate read files. * cpplex.c (handle_newline, skip_escaped_newlines, get_effective_char, skip_whitespace, parse_identifier, parse_identifier_slow, parse_number, parse_string, _cpp_lex_direct): Optimize for the fact that buffers are guaranteed NUL-terminated. * cpplib.c (destringize_and_run, cpp_define, handle_assertion): Be sure buffers are NUL terminated. * cppmacro.c (warn_of_redefinition): Kill compile warning. * c-common.c: Include tree-inline.h. (c_language): Move separate definitions here. (c_common_init_options, c_common_post_options): New. (c_common_lang_init): Rename c_common_init. * c-common.h (c_common_lang_init): Similarly. (c_common_init_options, c_common_post_options): New. * c-lang.c (c_post_options): Move body to c_common_post_options. (c_init_options): Use c_common_init_options. (c_init): Update. * langhooks.def: Rearrange. * langhooks.h: Rearrange, and improve comments. * toplev.c (do_compile): New function. (toplev_main): Use it. (lang_independent_f_options, parse_options_and_default_flags, process_options): Remove trailing periods. * Makefile.in: Update. cp: * decl2.c (c_language): Move to c-common.c. * lex.c (cxx_post_options, cxx_init_options): Use c-common.c functions. (cxx_init): Update. objc: * objc-act.c (objc_post_options, objc_init_options): Use c-common.c functions. (ojbc_init): Update. From-SVN: r47362
2001-11-23cppmacro.c (warn_of_redefinition): Warn regardless of -pedantic.Neil Booth1-3/+0
* cppmacro.c (warn_of_redefinition): Warn regardless of -pedantic. * gcc.dg/cpp/mi6.c, gcc.dg/cpp/redef2.c: Update. From-SVN: r47282
2001-11-19cppmacro.c (_cpp_backup_tokens): Revert previous check-in.Neil Booth1-2/+4
* cppmacro.c (_cpp_backup_tokens): Revert previous check-in. Don't fall off the base token run. * gcc.dg/cpp/fpreprocessed.c: New test case. From-SVN: r47182
2001-11-19cppmacro.c (_cpp_backup_tokens): Pop cur_run before decrementing cur_token, ↵Jason Merrill1-1/+1
not after. * cppmacro.c (_cpp_backup_tokens): Pop cur_run before decrementing cur_token, not after. * config/clipper/clix.h, config/h8300/elf.h, config/mips/linux.h: Lose ASM_OUTPUT_CONSTRUCTOR. * system.h: Poison it and INT_ASM_OP. * c-lang.c (finish_file): Don't check for it. * libgcc2.c (L_ctors): Check TARGET_ASM_CONSTRUCTOR instead. From-SVN: r47169
2001-11-04ChangeLog.2, [...]: Fix spelling errors.Joseph Myers1-1/+1
* ChangeLog.2, ChangeLog.4, ChangeLog.5, ChangeLog, FSFChangeLog.10, FSFChangeLog.11, alias.c, attribs.c, caller-save.c, calls.c, cfg.c, cfganal.c, cfgcleanup.c, cfgrtl.c, cppmacro.c, fold-const.c, ifcvt.c, local-alloc.c, profile.c, sched-int.h, toplev.c, config/alpha/alpha.c, config/alpha/alpha.md, config/c4x/c4x.h, config/cris/cris.h, config/cris/cris.md, config/i370/i370.md, config/i386/i386.c, config/i386/i386.h, config/i386/i386.md, config/i386/xm-djgpp.h, config/ia64/ia64.c, config/m68hc11/m68hc11.c, config/m68k/m68k.md, config/mcore/mcore.h, config/mmix/mmix.c, config/ns32k/ns32k.h, config/ns32k/ns32k.md, config/rs6000/rs6000.c, config/rs6000/sysv4.h, config/sh/sh.md: Fix spelling errors. From-SVN: r46760
2001-10-21cpphash.h (struct cpp_buffer): Delete read_ahead and extra_char.Neil Booth1-2/+1
* cpphash.h (struct cpp_buffer): Delete read_ahead and extra_char. * cpplex.c (lex_percent, lex_dot): Remove. (get_effective_char, skip_block_comment, skip_line_comment, parse_identifier_slow, parse_number, parse_string, save_comment, _cpp_lex_direct): Update to do lookback freely. (IF_NEXT_IS, BACKUP): New macros. * cpplib.c (cpp_push_buffer): Don't set read_ahead and extra_char. * cppmacro.c (paste_tokens): Update. From-SVN: r46392
2001-10-10calls.c: Fix formatting.Kazu Hirata1-2/+2
* calls.c: Fix formatting. * c-decl.c: Likewise. * cfgcleanup.c: Likewise. * combine.c: Likewise. * cppfiles.c: Likewise. * cpplib.c: Likewise. * cppmacro.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * dwarf2out.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * gcse.c: Likewise. * genattrtab.c: Likewise. * ggc-page.c: Likewise. * integrate.c: Likewise. * libgcc2.c: Likewise. * loop.c: Likewise. * optabs.c: Likewise. * profile.c: Likewise. * protoize.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reload1.c: Likewise. * reload.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * sched-rgn.c: Likewise. * sdbout.c: Likewise. * stmt.c: Likewise. * toplev.c: Likewise. * varasm.c: Likewise. From-SVN: r46145
2001-10-08cppmacro.c (_cpp_create_definition): Leave comments off.Neil Booth1-1/+0
* cppmacro.c (_cpp_create_definition): Leave comments off. * doc/cpp.texi: Update. From-SVN: r46089
2001-10-08cppmacro.c (funlike_invocation_p): Move some logic to caller in ↵Neil Booth1-32/+51
enter_macro_context. * cppmacro.c (funlike_invocation_p): Move some logic to caller in enter_macro_context. Create a padding token in its own context if necessary when the search for '(' fails. (enter_macro_context): Update. * gcc.dg/cpp/spacing1.c: Update test. From-SVN: r46070
2001-10-02cpphash.h: Update comments.Neil Booth1-62/+85
* cpphash.h: Update comments. (cpp_context): Update. (spec_nodes): Remove n__Pragma. * cppinit.c (cpp_create_reader): Update. (builtin_array): Add _Pragma. * cpplib.h: Update comments. (NODE_DISABLED, BT_PRAGMA): New. (cpp_start_lookahead, cpp_stop_lookahead): Remove prototypes. * cppmacro.c (struct cpp_macro): Remove disabled. (builtin_macro): Return int, handle _Pragma, push the new token on the context stack. (funlike_invocation_p): Unconstify, update. (enter_macro_context): Handle builtins here. (replace_args, push_token_context, push_ptoken_context): Update for prototype changes. (_cpp_pop_context): Update. (cpp_get_token): Don't handle buitins, nor _Pragma here. (cpp_sys_macro_p): Update. (_cpp_free_definition): Clear disabled flag. (_cpp_create_definition): Upate. * cppmain.c: Update comments. From-SVN: r45948
2001-09-30cpphash.h (POOL_ALIGN, [...]): Remove.Neil Booth1-43/+30
* cpphash.h (POOL_ALIGN, POOL_FRONT, POOL_LIMIT, POOL_BASE, POOL_SIZE, POOL_ROOM, POOL_COMMIT, struct cpp_chunk, struct cpp_pool, _cpp_init_pool, _cpp_free_pool, _cpp_pool_reserve, _cpp_pool_alloc, _cpp_next_chunk): Remove. (_cpp_extend_buff, BUFF_ROOM): Update. (_cpp_append_extend_buff): New. (struct cpp_reader): Remove macro_pool, add a_buff. * cppinit.c (cpp_create_reader): Initialize a_buff, instead of macro_pool. (cpp_destroy): Free a_buff instead of macro_pool. * cpplex.c (new_chunk, chunk_suitable, _cpp_next_chunk, new_chunk, _cpp_init_pool, _cpp_free_pool, _cpp_pool_reserve, _cpp_pool_alloc, ): Remove. (parse_number, parse_string): Update use of _cpp_extend_buff. (_cpp_extend_buff): Update. (_cpp_append_extend_buff, cpp_aligned_alloc): New. * cpplib.c (glue_header_name, parse_answer): Update use of _cpp_extend_buff. (cpp_register_pragma, cpp_register_pragma_space): Use _cpp_aligned_alloc. (do_assert, do_unassert): Check for EOL, update. * cppmacro.c (stringify_arg, collect_args): Update to use _cpp_extend_buff and _cpp_append_extend_buff. (save_parameter, parse_params, alloc_expansion_token, _cpp_create_definition): Rework memory management. * gcc.dg/cpp/redef2.c: Add test. From-SVN: r45899
2001-09-28cpphash.h (struct cpp_buff): Make unsigned.Neil Booth1-28/+29
* cpphash.h (struct cpp_buff): Make unsigned. (_cpp_get_buff): Take length of size_t. (_cpp_unaligned_alloc): New. (BUFF_ROOM, BUFF_FRONT, BUFF_LIMIT): New. (struct cpp_reader): Remove ident_pool. Add u_buff. * cppinit.c (cpp_create_reader): Initialize u_buff, not ident_pool. (cpp_destroy): Destroy u_buff, not ident_pool. * cpplex.c (parse_number, parse_string, save_comment, cpp_token_as_text): Update to use the unaligned buffer. (new_buff): Make unsigned. (_cpp_unaligned_alloc): New. * cpplib.c (glue_header_name): Update to use the unaligned buffer. * cppmacro.c (new_number_token, builtin_macro, stringify_arg): Similarly. (collect_args): Make unsigned. From-SVN: r45858
2001-09-27cpphash.h: Update comment.Neil Booth1-76/+53
* cpphash.h: Update comment. * cpplex.c: Update comments. (_cpp_can_paste): Remove. * cpplib.h (_cpp_can_paste): Remove. * cppmacro.c (paste_tokens, paste_all_tokens): Update to use the lexer rather than _cpp_can_paste. From-SVN: r45840
2001-09-26cpphash.h (struct cpp_pool): Remove locks and locked.Neil Booth1-42/+24
* cpphash.h (struct cpp_pool): Remove locks and locked. (struct cpp_context): Add member buff. (struct cpp_reader): Remove member argument_pool. (_cpp_lock_pool, _cpp_unlock_pool): Remove. * cppinit.c (cpp_create_reader, cpp_destroy): Argument_pool is dead. * cpplex.c (chunk_suitable): Remove pool argument. (MIN_BUFF_SIZE, BUFF_SIZE_UPPER_BOUND, EXTENDED_BUFF_SIZE): New. (new_buff, _cpp_extend_buff): Update. (_cpp_get_buff): Fix silly pointer bug. Be more selective about which buffer is returned. (_cpp_next_chunk, _cpp_init_pool): Pool locking removed. (_cpp_lock_pool, _cpp_unlock_pool): Remove. * cppmacro.c (lock_pools, unlock_pools): Remove. (push_ptoken_context): Take a _cpp_buff. (enter_macro_context): Pool locking removed. (replace_args): Use a _cpp_buff for the replacement list with arguments replaced. (push_token_context): Clear buff. (expand_arg): Use _cpp_pop_context. (_cpp_pop_context): Free a context's buffer, if any. From-SVN: r45833
2001-09-26cpphash.h (struct _cpp_buff, [...]): New.Neil Booth1-113/+124
* cpphash.h (struct _cpp_buff, _cpp_get_buff, _cpp_release_buff, _cpp_extend_buff, _cpp_free_buff): New. (struct cpp_reader): New member free_buffs. * cppinit.c (cpp_destroy): Free buffers. * cpplex.c (new_buff, _cpp_release_buff, _cpp_get_buff, _cpp_extend_buff, _cpp_free_buff): New. * cpplib.h (struct cpp_options): Remove unused member. * cppmacro.c (collect_args): New. Combines the old parse_arg and parse_args. Use _cpp_buff for memory allocation. (funlike_invocation_p, replace_args): Update. From-SVN: r45827
2001-09-24c-lex.c (cb_def_pragma): Update.Neil Booth1-336/+387
* 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-09-17cpphash.h (_cpp_lex_direct): New.Neil Booth1-20/+46
* cpphash.h (_cpp_lex_direct): New. * cpplex.c (_cpp_lex_token): Update. (lex_token): Rename _cpp_lex_direct; lex into pfile->cur_token, and increment that pointer. * cppmacro.c (alloc_expansion_token): New. (lex_expansion_token): Lex macro expansion directly into macro storage. From-SVN: r45656
2001-09-16cpphash.h (_cpp_lex_token): Update prototype.Neil Booth1-9/+8
* cpphash.h (_cpp_lex_token): Update prototype. * cpplex.c (_cpp_lex_token): New prototype. * cpplib.c (skip_rest_of_line, check_eol, _cpp_handle_directive, lex_macro_node, read_flag, do_pragma_poison): Update. * cppmacro.c (cpp_get_token, parse_params, lex_expansion_token): Update. From-SVN: r45646
2001-09-16cppmain.c (scan_translation_unit): Don't worry about putting a space after ↵Neil Booth1-2/+6
hashes. * cppmain.c (scan_translation_unit): Don't worry about putting a space after hashes. * cpplib.c (directive_diagnostics): New. (_cpp_handle_directive): Update to use directive_diagnostics. (run_directive): Don't toggle prevent_expansion. (do_line): Backup in case of the line extension. * cpplib.h (cpp_lexer_pos): Remove. * cppmacro.c (_cpp_create_definition): Precede a leading # with whitespace. * gcc.dg/cpp/line5.c: New testcase. From-SVN: r45645
2001-09-15cpphash.h (struct cpp_reader): Remove lexer_pos, directive_pos.Neil Booth1-9/+2
* cpphash.h (struct cpp_reader): Remove lexer_pos, directive_pos. Split mlstring_pos into mls_line and mls_col. * cppinit.c (cpp_create_reader): Initialize line to 1. (cpp_destroy): Free tokenruns. (push_include): Don't update lexer_pos. * cpplex.c (unterminated, parse_string): Update. (lex_token): Don't update lexer_pos, update. * cpplib.c (if_stack): Save line instead of line + col. (start_directive, _cpp_do__Pragma, do_else, do_elif, push_conditional, _cpp_pop_buffer): Update. * cppmacro.c (funlike_invocation_p): Don't save lexer_pos. (_cpp_create_definition): Update. From-SVN: r45627