summaryrefslogtreecommitdiffstats
path: root/gcc/cpplib.c
Commit message (Collapse)AuthorAgeFilesLines
* * cpplib.c (do_line): Pedwarn for #line > 32767.aoliva2000-02-161-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32006 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (do_define): Only free the old definition if itzack2000-02-141-1/+2
| | | | | | | actually had one. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31964 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpphash.c: Fix formatting, update commentary.zack2000-02-111-149/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (dump_definition): Take three separate arguments instead of a MACRODEF structure argument. * cpphash.h: Update prototype of dump_definition. * cppinit.c (cpp_finish): Update call of dump_definition. * cpplib.c (do_define): Always create new hash entry with T_MACRO type. Remove redundant check for redefinition of poisoned identifier. Update call of dump_definition. (do_undef): Don't call check_macro_name. Rename sym_length to len. (do_error, do_warning): Don't use copy_rest_of_line or SKIP_WHITE_SPACE. (do_warning): Don't use pedwarn for the actual warning, only the notice about its not being in the standard. (Fixes bug with #warning in system headers.) (do_ident): Stricter argument checking - accept only a single string after #ident. Also, macro-expand the line. (do_xifdef): Use cpp_defined. De-obfuscate. (do_pragma): Split out specific pragma handling to separate functions. Use get_directive_token. Update commentary. Do not pass on #pragma once or #pragma poison to the front end. (do_pragma_once, do_pragma_implementation, do_pragma_poison, do_pragma_default): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31931 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppexp.c: Don't include cpphash.h.zack2000-02-101-24/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (parse_charconst, cpp_lex): Use cpp_defined. (cpp_lex): Use get_directive_token throughout. Remove unnecessary cases from switch. Move assertion-handling code down to OTHER case. (cpp_parse_expr): If we see '+' or '-', check the context to determine if they are unary or binary operators. Streamline the jumps a bit. Do not call skip_rest_of_line. * cpplib.c: Make skip_rest_of_line and cpp_skip_hspace static. Export get_directive_token. Update commentary. (cpp_defined): New function. (do_define): Remove reference to T_PCSTRING. Call free_definition to release memory for old definition, when redefining a macro. (eval_if_expression): Set only_seen_white to 0 before calling cpp_parse_expr. Call skip_rest_of_line after it returns. (cpp_read_check_assertion): Don't preserve a pointer into the token buffer across a call to cpp_get_token. * Makefile.in (cppexp.o): Don't depend on cpphash.h. * cppfiles.c (redundant_include_p): Use cpp_defined. * cpphash.c (free_definition): New function. (delete_macro): Use it. Update commentary. * cpphash.h: Typedef HASHNODE here. Prototype cpp_lookup and free_definition. * cpplib.h: Don't typedef HASHNODE here. Delete T_PCSTRING from enum node_type. Prototype cpp_defined and get_directive_token. Don't prototype cpp_lookup, skip_rest_of_line, or cpp_skip_hspace. * fix-header.c (check_macro_names): Use cpp_defined. (read_scan_file): Set inhibit_warnings and inhibit_errors in the options structure. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31908 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.h: Provide HASHNODE typedef and forward decl ofzack2000-02-101-18/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct hashnode only. Kill cpp_hashnode typedef. MACRODEF, DEFINITION, struct hashnode, struct macrodef, struct definition, scan_decls prototype, default defn of INCLUDE_LEN_FUDGE moved elsewhere. * cpphash.h: MACRODEF, DEFINITION, struct macrodef, struct definition, and struct hashnode moved here. Remove the unused 'predefined' field from struct definition. Replace the 'args' union with its sole member. All users updated (cpphash.c). Delete HASHSTEP and MAKE_POS macros, and hashf prototype. Add multiple include guard. * cpphash.c (hashf): Make static; use better algorithm; drop HASHSIZE parameter; return an unsigned int. (cpp_lookup): Drop HASH parameter. PFILE parameter is used. Calculate HASHSIZE modulus here. (cpp_install): Drop HASH parameter. Calculate HASHSIZE modulus here. (create_definition): Drop PREDEFINITION parameter. * cpplib.c (do_define): Don't calculate a hash value here. Don't pass (keyword == NULL) to create_definition. * scan.h: Prototype scan_decls here. * cppfiles.c: Move INCLUDE_LEN_FUDGE default defn here. * cppexp.c, cppfiles.c, cppinit.c, cpplib.c, fix-header.c: All callers of cpp_lookup and cpp_install updated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31881 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpphash.c (macarg): Hoist all the flag diddling out of thezack2000-02-101-63/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function... (macroexpand): ... and out of the loop that calls macarg. Skip over the initial paren before macro arguments with cpp_get_non_space_token; point may be some distance before that paren. Abort if it's not there. * cpplib.c (parse_clear_mark): Delete function. (parse_set_mark, parse_goto_mark): Make static. (ACTIVE_MARK_P): New macro. (skip_block_comment, skip_line_comment): Do not bump the line if ACTIVE_MARK_P is true. (cpp_pop_buffer): The buffer to be popped may not have an active mark. (cpp_get_token): When looking for the initial paren before macro arguments, only set a mark in a file buffer, Always return to that mark before proceeding to call macroexpand or return a NAME token. * cpplib.h: Remove prototypes of parse_set_mark, parse_clear_mark, parse_goto_mark. (struct cpp_options): Rename 'put_out_comments' to 'discard_comments' and invert its sense. * cppinit.c, cpphash.c, cpplib.c: All users of put_out_comments changed to use discard_comments, with opposite sense. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31879 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (cpp_define, cpp_undef): Make sure the stacked bufferzack2000-02-091-13/+30
| | | | | | | | ends with a newline and a NUL. Don't be so clever manipulating strings. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31864 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (cpp_get_token): Call CPP_BUMP_LINE after reading ammitchel2000-02-071-0/+1
| | | | | | | carriage return after a macro name. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31840 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (my_strerror, cpp_error, cpp_error_with_line,zack2000-02-061-367/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cpp_error_from_errno, cpp_warning, cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line, cpp_pedwarn_with_file_and_line): Move to cpperror.c. (cpp_print_file_and_line, v_cpp_error, v_cpp_warning, v_cpp_error_with_line, v_cpp_warning_with_line, cpp_message_from_errno, cpp_perror_with_name): Delete. * cpperror.c (cpp_print_containing_files): Take starting buffer as argument. (cpp_file_line_for_message): Rename to cpp_print_file_and_line. (v_cpp_message): Now called directly by all entry points. Remove -1 case. (cpp_pfatal_with_name, cpp_message): Delete. (cpp_notice_from_errno, cpp_ice): New functions. (cpp_notice): Is now for reporting error conditions, just without an associated file. (cpp_error, cpp_error_with_line): Don't do anything if opts->inhibit_errors is on. (cpp_pedwarn_with_file_and_line): Take column argument also. * cpplib.h: Update prototypes of exported functions. (struct cpp_options): Add inhibit_errors. * cppalloc.c, cppfiles.c: Use fprintf not cpp_notice for non-error messages. Include intl.h. * cppinit.c, cppmain.c: Likewise. Also, use cpp_notice_from_errno instead of cpp_perror_with_name or cpp_pfatal_with_name, and cpp_notice instead of cpp_message. * cppexp.c, cpphash.c, cppinit.c, cpplib.c: Use cpp_ice to report internal errors. * cpplib.c (do_define): Switch bcopy to memcpy. Give cpp_pedwarn_with_file_and_line a dummy column argument. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31829 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (copy_rest_of_line): Revert previous change: don'tzack2000-02-061-2/+0
| | | | | | | bail out early if we hit a line comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31828 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppfiles.c (read_and_prescan) [case SPECCASE_QUESTION]: Bumpzack2000-02-061-32/+48
| | | | | | | | | | | | | | | | | | | input pointer before possibly branching off to the backslash code. * cpphash.c (macroexpand): Correctly delete \r escapes when stringifying parameters. * cpplib.c (copy_rest_of_line): Go directly to skip_block_comment if we can; bail out early if we hit a line comment. (handle_directive): Treat '# 123' in an .S file just like '# <punctuation>'. Discard the shifted '#' if we hit '#\n'. Return 1 for '# not_a_directive'. (get_directive_token): Pop macro buffers here, so that cpp_get_token can't sneakily move past a newline. Add sanity checks. (cpp_get_token): goto randomchar if handle_directive returns 0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31819 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppalloc.c: Update copyright.zack2000-02-061-35/+39
| | | | | | | | | * cpplib.c: Merge all the static function prototypes into one block. * cpplib.h: Remove #if 0 block. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31818 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpperror.c: Remove #ifdef EMACS block.zack2000-02-061-122/+48
| | | | | | | | | | | | | | * cppmain.c: Likewise. * cpphash.c: Remove #if 0 blocks. * cppinit.c: Remove #if 0 blocks, and the -lint option. * cpplib.c: Remove #if 0 blocks and code referencing pcp_inside_if or for_lint. Remove duplicate error message. Fix error messages for #else after #else or #elif. Reformat. Remove archaic TODO list. * cpplib.h: Remove pcp_inside_if and for_lint flags. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31817 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.in (c-common.o): Depend on $(EXPR_H).ghazi2000-02-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * c-common.c: Include expr.h. * c-pragma.c (mark_align_stack): Add prototype. * caller-save.c (add_stored_regs): Likewise. * combine.c (record_promoted_value): Likewise. * i386.c (ix86_sched_reorder_pentium, ix86_sched_reorder_ppro): Likewise. * cppinit.c (new_pending_define): Likewise. * cpplib.c (skip_block_comment, skip_line_comment): Likewise. * dwarf2out.c (save_rtx, splice_child_die, reverse_die_lists, AT_class, AT_flag, AT_int, AT_unsigned, AT_string, AT_ref, AT_loc, AT_addr, AT_lbl, get_AT_ref, free_AT, free_die, local_scope_p, class_scope_p): Likewise. * dwarf2out.h (dwarf2out_set_demangle_name_func, dwarf2out_add_library_unit_info): Likewise. * ggc.h (ggc_page_print_statistics): Likewise. * haifa-sched.c (propagate_deps): Likewise. * reg-stack.c (next_flags_user, record_label_references): Likewise. * rtl.h (set_stack_check_libfunc): Likewise. * toplev.h (set_fatal_function): Likewise. * toplev.c (set_fatal_function): Delete prototype. * diagnostic.c: Deconstify functions returning malloc'ed ptrs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31810 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.h (cpp_reader): Add new flag, no_directives.zack2000-02-021-1/+9
| | | | | | | | | * cpphash.c (macarg): Set it. * cpplib.c (handle_directive): If no_directives is on and we find a directive, issue an error and discard the line. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31763 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpperror.c (cpp_file_line_for_message): If 'line' is zero,zack2000-01-301-3/+2
| | | | | | | | | | | | | just print "<command line>". If 'filename' is null or an empty string, print "<stdin>" for the filename. * cpplib.c (do_define): Don't print the 'location of the previous definition' message if we're still parsing the command line. (cpp_pedwarn_with_file_and_line): Always call cpp_file_line_for_message. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31697 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppinit.c (cpp_handle_option): Recognize C++ comments underzack2000-01-271-130/+114
| | | | | | | | | | | | | | | | | | | | | -std=gnu89. * cpplib.c (skip_block_comment, skip_line_comment): Split code out of... (skip_comment) ... here. Permit C++ comments in system headers always. Warn about C++ comments in user code under -std=gnu89 -pedantic. (copy_comment): Use skip_comment. (cpp_skip_hspace, cpp_get_token): skip_comment can no longer return EOF. (consider_directive_while_skipping, do_else, do_endif): Call validate_else unconditionally. (validate_else): Check CPP_PEDANTIC here. Accept non-comment text after the conditional in a system header. * cpplib.h (struct cpp_buffer): Add flag warned_cplusplus_comments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31654 138bc75d-0d04-0410-961f-82ee72b054a4
* more copyright nitsghazi2000-01-191-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31527 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppalloc.c: PROTO -> PARAMS.ghazi2000-01-191-12/+12
| | | | | | | | | | * cpperror.c: Likewise. * cppfiles.c: Likewise. * cpplib.c: Likewise. * cpplib.h: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31521 138bc75d-0d04-0410-961f-82ee72b054a4
* 2000-01-11 16:24 -0800 Zack Weinberg <zack@wolery.cumb.org>zack2000-01-121-9/+33
| | | | | | | | | | | | | | | | | | | | | | | | * cpplib.h (struct cpp_options): Change lang_asm to char. Add lang_fortran. * cppinit.c (builtin_array): Take out __STDC_VERSION__, it's done in cpp_handle_option now. (initialize_builtins): Take out special case code used only by __STDC_VERSION__. (cpp_handle_option): Turn off trigraphs and trigraph warnings if -traditional. Recognize -lang-fortran and set lang_fortran, also turn off cplusplus_comments. (print_help): Document -lang-fortran. * cpplib.c (handle_directive): Ignore `# 123 "file"' if lang_asm. Ignore all directives other than `# 123 "file"' if CPP_PREPROCESSED. (cpp_get_token): If -traditional, don't recognize directives unless the # is in column 1. (parse_string): If lang_fortran or lang_asm, silently terminate strings ('' or "") at end of line. Remove unnecessary braces. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31342 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-10-28 21:27 -0700 Zack Weinberg <zack@bitmover.com>zack1999-10-291-30/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cpplib.h (struct cpp_buffer: fname, nominal_fname, last_nominal_fname): Mark const. (struct include_hash: name, nshort, control_macro): Mark const. (struct macrodef: symnam): Mark const. (struct if_stack: fname): Mark const. (is_idchar, is_idstart, is_hor_space, trigraph_table): Delete. (IStable): New character-syntax array which encompasses all the old is_foo arrays. (is_idchar, is_numchar, is_idstart, is_numstart, is_hspace, is_space): New macros for interrogating IStable. (check_macro_name): Kill last argument. All callers changed. * cppinit.c (initialize_char_syntax): Delete. (is_idchar, is_idstart, is_hor_space, is_space, trigraph_table): Delete. (IStable): New. Initialize with clever macros to avoid information duplication. (builtin_array): Table of builtins to get rid of explicit list in initialize_builtins. (initialize_builtins): Use builtins_array. (cpp_start_read): Call init_IStable, and set IStable['$'] if opts->dollars_in_ident. * cppexp.c: Change all refs to is_xyz[] arrays to use new is_xyz() macros. (cpp_parse_expr): Avoid 'format string is not constant' warning. Use ISGRAPH to identify printable chars. * cppfiles.c: Change all refs to is_xyz[] arrays to use new is_xyz() macros. (read_and_prescan): Map trigraphs to chars with open-coded if-else-if-... sequence, not a lookup table. * cpphash.c: Change all refs to is_xyz[] arrays to use new is_xyz() macros. * cpplib.c: Change all refs to is_xyz[] arrays to use new is_xyz() macros. Kill SKIP_ALL_WHITE_SPACE (unused). (check_macro_name): Remove ability to report an invalid assertion name, which is never used. (do_line): Constify a couple of char *'s. * cppmain.c (main): Call cpp_cleanup before returning. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30252 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (if_directive_nameo): Add static prototype.ghazi1999-10-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cse.c (cse_insn): Remove unused variable `p'. * except.c (create_rethrow_ref, push_entry, receive_exception_label, new_eh_region_entry, find_func_region, clear_function_eh_region, process_nestinfo): Add static prototypes. (get_reg_for_handler): Hide definition. (process_nestinfo): Initialize variable `extra_handlers'. * expr.h (expand_builtin_longjmp): Add extern prototype. * final.c (final_addr_vec_align, align_fuzz): Add static prototypes. * function.c (prepare_function_start): Likewise. (pop_function_context_from): Mark parameter `context' with ATTRIBUTE_UNUSED. (push_temp_slots_for_block, flush_addressof): Hide definition. * gcov.c (init_arc, reverse_arcs, create_program_flow_graph, solve_program_flow_graph, calculate_branch_probs, function_summary, main, fancy_abort): Add prototypes. * gen-protos.c (add_hash, parse_fn_proto, main): Likewise. (add_hash): Constify a char*. * ggc-common.c (ggc_mark_rtx_ptr, ggc_mark_tree_ptr, ggc_mark_tree_varray_ptr, ggc_mark_tree_hash_table_ptr, ggc_mark_string_ptr, ggc_mark_tree_hash_table_entry): Add prototypes. * integrate.c (expand_inline_function_eh_labelmap): Likewise. * lists.c (free_list, zap_lists): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29783 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (handle_directive): Don't complain about `# NUMBER' ifjason1999-09-231-2/+6
| | | | | | | we're seeing this input for a second time. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29634 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-09-10 22:37 -0700 Zack Weinberg <zack@bitmover.com>zack1999-09-111-22/+51
| | | | | | | | | | | | | | | * cppalloc.c (xstrdup): Use memcpy. * cpperror.c (cpp_print_containing_files): Don't use cpp_notice. * cpplib.c (conditional_skip): Set temp->lineno. (do_endif): Make error message less obscure. (if_directive_name): New function. (cpp_get_token [case EOF]): Unwind the if stack and generate error messages for each unterminated conditional in this file. (parse_string): Do not behave differently if -traditional. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29279 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.in (cppexp.o): Depend on cpphash.h.geoffk1999-09-091-13/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | * cppexp.c (cpp_lex): Handle `defined (xxx)' for poisoned xxx. Include cpphash.h. * cpphash.c (special_symbol): Handle plain `xxx' for poisoned xxx. * cpplib.c (do_define): Generalise to handle poisoned definitions, redefining poisoned identifiers, etc. (do_undef): Don't allow poisoned identifiers to be undefined. (do_pragma): Add #pragma poison. (do_xifdef): Handle `#ifdef xxx' for poisoned xxx. * cccp.c: Add T_POISON node type. (special_symbol): Handle `defined(xxx)' and plain `xxx' for poisoned xxx. (do_define): Generalise to handle poisoned definitions, redefining poisoned identifiers, etc. (do_undef): Don't allow poisoned identifiers to be undefined. (do_pragma): Add #pragma poison. (do_xifdef): Handle `#ifdef xxx' for poisoned xxx. * c-pragma.c (handle_pragma_token): Ignore #pragma poison. * c-pragma.h: Add ps_poison state. We now always have generic pragmas. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29224 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (cpp_push_buffer): Fix order of arguments.law1999-09-081-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29201 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpperror.c (cpp_file_line_for_message): Constify a char*.ghazi1999-09-071-12/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cppexp.c (parse_number, parse_charconst, cpp_lex, cpp_parse_expr): Add static prototypes. (parse_charconst): Don't cast away const-ness. (token): Constify a char*. * cppfiles.c (file_name_list, include_hash, find_include_file, finclude, initialize_input_buffer): Constify a char*. (file_cleanup, find_position): Add static prototypes. * cpphash.c (macro_cleanup, macarg, timestamp, special_symbol, collect_expansion): Add static prototypes. (cpp_install, create_definition, monthnames): Constify a char*. * cpphash.h (cpp_install): Likewise. * cppinit.c (known_suffixes, default_include, dump_special_to_buffer, NAME, cpp_start_read, cpp_finish): Likewise. (base_name, dump_special_to_buffer, initialize_dependency_output): Add static prototypes. * cpplib.c (my_strerror): Constify a char*. (null_underflow, null_cleanup, skip_comment, copy_comment, copy_rest_of_line, handle_directive, pass_thru_directive, get_directive_token, read_line_number, cpp_print_file_and_line, v_cpp_error, v_cpp_warning, v_cpp_error_with_line, v_cpp_warning_with_line, detect_if_not_defined, consider_directive_while_skipping): Add static prototypes. (pass_thru_directive, check_macro_name, cpp_expand_to_buffer, cpp_pedwarn_with_file_and_line): Constify a char*. * cpplib.h (cpp_options, include_hash, progname, definition, cpp_pedwarn_with_file_and_line, cpp_expand_to_buffer, check_macro_name, cpp_pfatal_with_name, cpp_file_line_for_message, find_include_file, deps_output, include_hash): Constify a char*. * cppmain.c (progname): Constify. (main): Add prototype. Use return, not exit. * fix-header.c (fatal, add_symbols, lookup_std_proto, write_lbrac, recognized_macro, check_macro_names, read_scan_file, write_rbrac, inf_skip_spaces, inf_read_upto, inf_scan_ident, inf_scan_ident, check_protection): Add static prototype. (xfree): Remove. (progname, recognized_macrom, recognized_extern): Constify a char*. (main): Add prototype. * gen-protos.c (progname): Constify a char*. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29171 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-08-31 12:44 -0700 Zack Weinberg <zack@bitmover.com>zack1999-08-311-66/+69
| | | | | | | | | | | | | | * cpplib.c (struct directive): Const-ify name pointer and function pointer prototype. (validate_else, do_define, do_line, do_include, do_undef, do_error, do_pragma, do_ident, do_if, do_xifdef, do_else, do_elif, do_endif, do_sccs, do_assert, do_unassert, do_warning): Const-ify second arg. (directive_table): Mark const. Reorder entries by frequency of usage, record statistics. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29009 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-08-25 13:51 -0700 Jim Meyering <meyering@ascend.com>zack1999-08-251-1/+77
| | | | | | | | * cpplib.c (detect_if_not_defined): New function. (do_if): Use it to detect potential once-only headers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28877 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (read_line_number): New fn, split out of...jason1999-08-141-25/+44
| | | | | | | (do_line): Here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28707 138bc75d-0d04-0410-961f-82ee72b054a4
* Warning fixes:ghazi1999-08-041-1/+0
| | | | | | | | | | | | | | | | | * builtins.c (expand_builtin_memcmp, expand_builtin_strcmp): Wrap prototypes in macro HAVE_cmpstrsi. * cpplib.c (cpp_get_token): Remove unused label `op3'. * emit-rtl.c (operand_subword): Remove unused variable `bits_per_word'. * rtl.c (shallow_copy_rtx): Remove unused variable `format_ptr'. * tree.c (chainon): Wrap variable `t2' in macro ENABLE_CHECKING. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28514 138bc75d-0d04-0410-961f-82ee72b054a4
* Wed Aug 4 13:29:23 1999 Zack Weinberg <zack@bitmover.com>zack1999-08-041-16/+38
| | | | | | | | | | | | | | | | | | | * cpphash.c (macroexpand): Delete leading whitespace when arg is concatenated before. (unsafe_chars): Correct test for whether + and - can extend a token. * cppinit.c (cpp_start_read): Do dependencies for -include/-imacros files also. * cpplib.c (cpp_scan_buffer): In no-output mode, don't bother tokenizing non-directive lines. (cpp_expand_to_buffer): Temporarily disable no-output mode. * cppmain.c: In no-output mode, just call cpp_scan_buffer for the input file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28512 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (cpp_get_token): Don't return a CPP_POP if the bufferjason1999-07-261-5/+6
| | | | | | | has manual_pop set. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28275 138bc75d-0d04-0410-961f-82ee72b054a4
* * gcc.c (default_compilers, cpp-output): Pass -fpreprocessed.jason1999-07-201-4/+30
| | | | | | | | | | | | | | | | | * toplev.c (documented_lang_options): Add -fpreprocessed. * cpplib.h (struct cpp_buffer): Add preprocessed. * cppinit.c (cpp_handle_option): Handle -fpreprocessed. (cpp_start_read): Don't expand macros or emit an initial #line directive if -fpreprocessed. * cpplib.h (struct cpp_buffer): Added manual_pop for better C++ tokenization. * cpplib.c (cpp_get_token): Return CPP_EOF if manual_pop. Also, support C++ tokenization for ->*, .*, <?, and >? operators. * c-common.c (cpp_token): Make non-static. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28190 138bc75d-0d04-0410-961f-82ee72b054a4
* Mon Jun 7 13:33:39 1999 Dave Brolley <brolley@cygnus.com>brolley1999-06-071-4/+4
| | | | | | | | | | | | * cpplib.c (do_define): Cast `alloca' return value. (do_include, do_undef, do_pragma): Likewise. * cpphash.c (dump_definition): Cast `xstrdup' and `alloca' return values. * cppfiles.c (initialize_input_buffer): Cast `xmalloc' return values. * gcc/cppspec.c (lang_specific_driver): Cast xmalloc return value. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@27391 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-04-26 19:16 -0400 Zack Weinberg <zack@rabi.columbia.edu>zack1999-04-261-146/+92
| | | | | | | | | | | | | | | | | | | | * cpphash.c (dump_definition): New function. * cpphash.h: Prototype it. * cpplib.c (handle_directive): Don't output anything here. Streamline. (pass_thru_directive): Take a length, not a pointer to the end. All callers changed. (do_define): Handle -dD, -dN, -g3 entirely here. Streamline. (do_include): Handle -dI here. (do_ident): Correct to match cccp. (do_pragma): Copy the pragma through here. (do_assert, do_unassert): Tidy. * cppinit.c (cpp_finish): If -dM was specified, walk the macro hash table and call dump_definition on all the entries. * cppmain.c: cpp_finish may produce output. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26659 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-04-19 14:51 -0400 Zack Weinberg <zack@rabi.columbia.edu>zack1999-04-191-20/+25
| | | | | | | | | | | | * cpplib.c (output_line_command): Drop CONDITIONAL argument. We can omit unnecessary line commands if file_change == same_file and pfile->lineno != 0. All callers changed. (cpp_get_token [case '\n']): Don't bump pfile->lineno if CPP_OPTIONS (pfile)->no_line_commands is set. * cpplib.h: Fix prototype of output_line_command. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26547 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-04-14 12:37 -0400 Zack Weinberg <zack@rabi.columbia.edu>zack1999-04-141-1/+4
| | | | | | | | | | * cpperror.c, cppexp.c, cpplib.c: Never call abort. * cpphash.c: Only call abort when we detect corruption of the malloc arena. * cppmain.c: Don't define fatal or fancy_abort. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26442 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-04-12 14:55 -0400 Zack Weinberg <zack@rabi.columbia.edu>zack1999-04-121-56/+85
| | | | | | | | | | | | | | | | | | * cpphash.c (collect_expansion, macroexpand, push_macro_expansion): Make the escape character in macro buffers '\r', not '@'. Remove code to protect literal occurences of the escape character; '\r' cannot appear in a macro buffer unless we put it there. * cpplib.c (skip_comment, copy_comment, cpp_skip_hspace, copy_rest_of_line, cpp_get_token, parse_string, parse_assertion): '\r' might be a backslash-newline marker, or it might be a macro escape marker, depending on CPP_BUFFER (pfile)->has_escapes. '@' is not a special character. * cpplib.h: Update commentary. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26371 138bc75d-0d04-0410-961f-82ee72b054a4
* Warning fixes:ghazi1999-03-191-12/+12
| | | | | | | | | | | | | | | | | | | | | | | * cccp.c (create_definition): Cast to U_CHAR* when assigning to one. * cppfiles.c (read_and_prescan): Likewise. Start a #define in column 0. * cpplib.c (cpp_define): Cast to U_CHAR* when assigning to one. (cpp_push_buffer): Likewise for cpp_buffer*. (do_include): Change the type of `fbeg' and `fend' to unsigned char*. (do_endif): Cast to char* when assigning to one. (do_assert): Likewise. (do_unassert): Likewise. (cpp_read_check_assertion): Change the type of `name' to U_CHAR*. Don't do unnecessary cast to char* anymore. * genrecog.c (make_insn_sequence): Cast to char** when assigning to one. Cast the first argument of bzero to PTR. * loop.c (strength_reduce): Remove unused variable `note'. * reload1.c (new_insn_chain): Cast to struct insn_chain* when assigning to one. * rtl.c (copy_rtx): Use memcpy instead of bcopy. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25860 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-03-16 16:06 -0500 Zack Weinberg <zack@rabi.columbia.edu>brolley1999-03-161-450/+370
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cppfiles.c (read_and_prescan): Map backslash-newline to '\r' (which cannot otherwise appear in the processed buffer) and move it out of tokens that it appears in the middle of. Improve performance. (find_position): New function. * cpplib.c: \r (one character) indicates backslash newline, not \\\n (two characters). It cannot appear in the middle of a token. Call CPP_BUMP_LINE (pfile) whenever parsing moves past \n or \r. Increment pfile->lineno whenever a \n is placed into token_buffer. Only one mark can exist at a time, and CPP_BUMP_LINE must not be used while it is active. It is automatically cleared by cpp_pop_buffer and parse_goto_mark. \r is not in is_hor_space or is_space. (NEWLINE_FIX, NEWLINE_FIX1, adjust_position, update_position, count_newlines, parse_move_mark): Removed. (parse_string, copy_comment): New functions. (parse_name): Returns void. (parse_set_mark, parse_clear_mark, parse_goto_mark): Take only one argument, a cpp_reader *. Change for new marking scheme. (skip_comment): Handle CHILL line comments too. Second argument is now first character of comment marker; all callers changed. Issue error for unterminated block comment here. (cpp_skip_hspace): Recognize CHILL comments. (copy_rest_of_line): Likewise. Call skip_comment and parse_string directly, don't go through cpp_get_token. Emit "/**/" for block comments if -traditional (create_definition needs this). (do_define): Don't play with put_out_comments. (cpp_push_buffer): Initialize ->mark to -1. (cpp_buf_line_and_col): Just read out the values in the buffer structure. (output_line_command): Use cpp_buf_line_and_col. Fix formatting. Remove stale code. (cpp_get_token): Break out string parsing code to parse_string. Use skip_comment for CHILL comments too. Use copy_comment for put_out_comments instead of dinking with marks. Remove stale code. Don't call output_line_command unless it's necessary. * cpplib.h (parse_marker): Removed. (struct cpp_buffer): line_base is now a unsigned char *; add `mark' [long], remove `marks' [struct parse_marker *]. (parse_set_mark, parse_clear_mark, parse_goto_mark): Update prototypes. (CPP_BUMP_LINE, CPP_BUMP_BUFFER_LINE): New macros. * cppinit.c (is_hor_space, is_space): '\r' is not considered whitespace. * cppexp.c (cpp_parse_expression): Use cpp_skip_hspace, not SKIP_WHITE_SPACE. * cpphash.c (macarg): Disable line commands while expanding. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25802 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-03-15 21:39 -0500 Zack Weinberg <zack@rabi.columbia.edu>zack1999-03-151-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cppinit.c: Instead of one pending list, keep separate lists for each category of pending option: -D/-U, -A, -include, -imacros. Move the four partial include-path lists into the pending block. Use head and tail pointers so we don't ever have to reverse the lists. (cpp_start_read): Break out blocks of code to their own functions: install_predefs and initialize_dependency_output. Use path_include for C_INCLUDE_PATH and friends as well as CPATH. Remove include_defaults gunk. Warn about the combination of -lang-chill and -trigraphs. Optimize string bashing. Walk each pending list once, deallocating as we go. (append_include_chain): Brought over from cppfiles.c. Mark dirs as system include dirs if and only if appending to system include path. If opts->verbose, print a notice when a dir is dropped from the include path because it doesn't exist. Fix memory leak: this function is not supposed to copy its DIR argument. (nreverse_pending, push_pending): Removed. (APPEND): New macro for adding to pending lists. (path_include): Can now add to any partial include path. (base_name): Bring over from cccp.c. (cpp_options_init): Allocate the pending block. (cpp_handle_option): Add --version. Exit after --help. Fix formatting. Order -ifoo options by frequency of usage. (install_predefs): New function, simplified version of code that was in cpp_start_read. (initialize_dependency_output): Likewise. Understand OBJECT_SUFFIX. * cppfiles.c (simplify_pathname): Export. (merge_include_chains): Don't nreverse the lists. If opts->verbose, print a notice when a duplicate dir is detected and dropped from the include path. (finclude): Fix excessive cleverness in setting fp->system_header_p. (actual_directory): Set x->sysp from CPP_BUFFER (pfile)->system_header_p so that one system header may include another with "". (deps_output): Fix double adjustment of deps_size which would cause all dependencies after the first two lines to be lost. * cpplib.c (cpp_unassert): New function. * cpplib.h: Lay out struct cpp_pending here. Adjust prototypes. Add include_prefix_len to struct cpp_options. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25793 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.in (cppmain.o, cpplib.o, cpphash.o, cppalloc.o,ghazi1999-02-251-6/+6
| | | | | | | | | | | | | cpperror.o, cppexp.o, cppfiles.o, cppinit.o, fix-header.o, scan-decls.o): Don't depend on machmode.h. * cppexp.c: Don't define CHAR_BIT or HOST_BITS_PER_WIDE_INT anymore. Replace all instances of HOST_WIDE_INT with HOST_WIDEST_INT. * cppfiles.c: Likewise. * cpplib.c: Likewise. * cpplib.h: Likewise. Also don't include machmode.h anymore. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25446 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-02-25 17:14 -0500 Zack Weinberg <zack@rabi.columbia.edu>zack1999-02-251-5/+5
| | | | | | | | | | | | | | | | | * cpphash.c (install): Rename to cpp_install, add cpp_reader* first argument. All callers changed. (hashtab): Removed. (cpp_lookup, cpp_install): Change all refs to hashtab to pfile->hashtab. (cpp_hash_cleanup): Removed. * cpphash.h: Adjust prototypes. * cpplib.h (struct cpp_reader): Add hashtab pointer. * cppinit.c (cpp_reader_init): Also allocate space for the hashtab. (cpp_cleanup): Delete all macros and free the hashtab. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25441 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-02-18 18:32 -0500 Zack Weinberg <zack@rabi.columbia.edu>zack1999-02-181-2922/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cpplib.c: Kill define of STDC_VALUE. Don't include output.h or prefix.h. Change CPP_IS_MACRO_BUFFER to not refer to macro_cleanup. (GET_ENV_PATH_LIST, PATH_SEPARATOR, STANDARD_INCLUDE_DIR, predefs, SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE, CPP_WCHAR_TYPE, USER_LABEL_PREFIX, REGISTER_PREFIX, struct cpp_pending, version_string, struct default_include, include_defaults_array, path_include, cpp_options_init, dump_special_to_buffer, initialize_builtins, cpp_start_read, cpp_reader_init, nreverse_pending, push_pending, print_help, cpp_handle_option, cpp_handle_options, cpp_finish, cpp_cleanup): Move to cppinit.c. (macro_cleanup, struct arglist, collect_expansion, create_definition, compare_defs, comp_def_part, ARG_BASE, struct argdata, macarg, change_newlines, timestamp, monthnames, special_symbol, unsafe_chars, macroexpand, push_macro_expansion): Move to cpphash.c. (quote_string, check_macro_name, cpp_expand_to_buffer, output_line_command, cpp_undef): Export. (null_underflow, null_cleanup, handle_directive): Make static. * cpplib.h: Prototype now-exported functions. Adjust decls of syntax tables so we can include cpplib.h in cppinit.c. * cpphash.h: Prototype all functions exported by cpphash.c. * cppinit.c: Make syntax tables initialized data if possible (uses GCC designated-initializer extension). * cppexp.c: Make cpp_lex static. * Makefile.in: Move -D switches for the various include dirs from cpplib.o rule to cppinit.o rule. Adjust dependencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25287 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-02-15 16:59 -0500 Zack Weinberg <zack@midnite.ec.rhno.columbia.edu>zack1999-02-151-21/+36
| | | | | | | | | | | | | | | | | | | | | | | | | * c-common.c (UNGETC [USE_CPPLIB=1]): Do nothing if c is EOF. * c-lex.c: Likewise. * cpplib.c (cpp_push_buffer, cpp_pop_buffer): Use a linked list in malloced memory for the buffer stack. (cpp_get_token): Don't pop the last buffer off the stack. Calls after CPP_EOF has been returned produce CPP_EOF with no state change. (cpp_finish): Pop last buffer here. (do_line): Don't free ip->last_nominal_fname if it is equal to ip->fname. (special_symbol): If a T_CONST is the empty string, push a single `@ ' escape instead. (macroexpand): Special symbol buffers have escapes too. * cpplib.h (struct cpp_buffer): Remove unused fields, add prev buffer pointer. (struct cpp_reader): Remove buffer_stack. Add buffer_stack_depth. (CPP_PREV_BUFFER, CPP_NULL_BUFFER): Buffer stack is now a linked list. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25218 138bc75d-0d04-0410-961f-82ee72b054a4
* * cpplib.c (special_symbol): Move IP to be declared in functionbrendan1999-02-091-2/+3
| | | | | | | | scope, rather than individual case statements. fixes building under solaris git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25112 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-02-09 10:30 -0500 Zack Weinberg <zack@rabi.columbia.edu>zack1999-02-091-1/+1
| | | | | | | * cpplib.c (do_define): Allow redefining __STDC__ with -D. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25109 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-02-08 23:25 -0500 Zack Weinberg <zack@midnite.ec.rhno.columbia.edu>zack1999-02-081-184/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | * cpplib.c (special_symbol): Rewrite. Don't copy things multiple times. Handle __STDC__ specially. T_CONST indicates a constant /string/. Don't handle T_*_TYPE and T_SPEC_DEFINED. Use cpp_buf_line_and_col instead of adjust_position. Determine the file buffer only if needed. (initialize_builtins): Handle __SIZE_TYPE__, __PTRDIFF_TYPE__, __WCHAR_TYPE__, __USER_LABEL_PREFIX__, and __REGISTER_PREFIX__ with T_CONST special hashtab entries. Don't provide __OBJC__; the driver does that. Provide __STDC_VERSION__, using T_CONST. Use T_STDC for __STDC__. Give install the length of all symbols defined. (eval_if_expression): Drop code to insert and remove the "defined" special symbol. * cpplib.h: Remove SELF_DIR_DUMMY (no longer used). Remove T_*_TYPE and T_SPEC_DEFINED from enum node_type; add T_STDC. * cpphash.c (install): Drop the `ivalue' parameter. Constify the `value' parameter. All callers changed. * cpphash.h (install): Change prototype to match. (union hashval): Remove `ival' member. * cppexp.c (cpp_lex): Handle `defined' here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25097 138bc75d-0d04-0410-961f-82ee72b054a4
* 1999-02-04 14:33 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu>brolley1999-02-041-370/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | * cpplib.c (initialize_char_syntax): Move to cppinit.c. (cpp_define): Remove redundant syntax checks. (make_assertion): Rename cpp_assert, remove redundant syntax checks, export. (cpp_options_init): Don't init things to zero twice. (cpp_expand_to_buffer): Use memcpy, not a char-by-char loop. (do_include): Kill excessively verbose import warning that snuck back in in the gcc2 merge. (convert_string): Removed. (do_line): Rewrite with simple last-name-used cache instead of private hashtable. (cpp_start_read): Call initialize_char_syntax here, not... (cpp_reader_init): ...here. (cpp_handle_options): Support the -std switch. * cpplib.h (cpp_buffer): Add last_nominal_fname member. (cpp_options): Add c9x flag. Declare all the is_* tables and trigraph table here, as const. Prototype cpp_assert and initialize_char_syntax. * cppinit.c: New file. * cppfiles.c (read_and_prescan): Optimize. * Makefile.in (LIBCPP_OBJS): Add cppinit.o. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25024 138bc75d-0d04-0410-961f-82ee72b054a4
OpenPOWER on IntegriCloud