aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
AgeCommit message (Collapse)AuthorFilesLines
1999-02-18cpplib.c: Kill define of STDC_VALUE.Zack Weinberg1-2922/+14
1999-02-18 18:32 -0500 Zack Weinberg <zack@rabi.columbia.edu> * 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. From-SVN: r25287
1999-02-15c-common.c (UNGETC [USE_CPPLIB=1]): Do nothing if c is EOF.Zack Weinberg1-21/+36
1999-02-15 16:59 -0500 Zack Weinberg <zack@midnite.ec.rhno.columbia.edu> * 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. From-SVN: r25218
1999-02-09cpplib.c (special_symbol): Move IP to be declared in function scope, rather ↵Brendan Kehoe1-2/+3
than individual case statements. * cpplib.c (special_symbol): Move IP to be declared in function scope, rather than individual case statements. fixes building under solaris From-SVN: r25112
1999-02-09cpplib.c (do_define): Allow redefining __STDC__ with -D.Zack Weinberg1-1/+1
1999-02-09 10:30 -0500 Zack Weinberg <zack@rabi.columbia.edu> * cpplib.c (do_define): Allow redefining __STDC__ with -D. From-SVN: r25109
1999-02-08cpplib.c (special_symbol): Rewrite.Zack Weinberg1-184/+103
1999-02-08 23:25 -0500 Zack Weinberg <zack@midnite.ec.rhno.columbia.edu> * 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. From-SVN: r25097
1999-02-04cpplib.c (initialize_char_syntax): Move to cppinit.c.Zack Weinberg1-370/+150
1999-02-04 14:33 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu> * 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. From-SVN: r25024
1999-01-29collect2.c (error): Fix typo in declaration.Kaveh R. Ghazi1-1/+1
* collect2.c (error): Fix typo in declaration. * cpperror.c (cpp_message): Likewise. * cpplib.c (cpp_warning): Likewise. * cpplib.h (cpp_notice): Use PVPROTO not VPROTO, also add ATTRIBUTE_PRINTF_1. * toplev.c (error): Fix typo in declaration. From-SVN: r24904
1999-01-26Merge in gcc2 snapshot 19980929. See gcc/ChangeLog and gcc/FSFChangeLog forJeffrey A Law1-74/+88
details. From-SVN: r24879
1999-01-26cppfiles.c (safe_read): Deleted.Zack Weinberg1-32/+26
1999-01-26 12:11 -0500 Zack Weinberg <zack@midnite.ec.rhno.columbia.edu> * cppfiles.c (safe_read): Deleted. (read_and_prescan): New function, replaces safe_read, converts and/or warns about trigraphs, silently converts odd line terminators (\r, \n\r, \r\n). Warns about no newline at EOF. (finclude): Use read_and_prescan; turn off nonblocking mode on the input descriptor; remove file-size-examination and no-newline-at-EOF gunk which is longer necessary; be more careful about checking that we've been handed a legitimate file to read (only real files, pipes, and ttys are acceptable). * cpplib.h (cpp_options): Rename no_trigraphs flag to `trigraphs' and invert its sense. (trigraph_table): Declare. (cpp_warning_with_line): Prototype. * cpplib.c: Remove all references to trigraph_pcp. Define trigraph_table; initialize it in initialize_char_syntax. Open files in nonblocking mode. s/no_trigraphs/trigraphs/ throughout, and invert sense. Put cpp_warning_with_line back in and export it. From-SVN: r24870
1999-01-25cpplib.c: Don't include signal.h, sys/times.h, or sys/resource.h.Zack Weinberg1-55/+35
1999-01-25 14:10 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.c: Don't include signal.h, sys/times.h, or sys/resource.h. Don't declare localtime. (macroexpand): Handle special symbols here. (push_macro_expansion): Chop off the trailing '@ ' if possible here. (cpp_get_token): Don't do either of the above two things here. Move `string' label just after case '"' so that wide strings don't crash the preprocessor. From-SVN: r24858
1999-01-18cpplib.c (special_symbol): Qualify a char* with the `const' keyword.Kaveh R. Ghazi1-13/+19
* cpplib.c (special_symbol): Qualify a char* with the `const' keyword. Instead of writing to const char *buf directly, use a non-const variable `wbuf' to allocate and write a string, then set buf = wbuf. * cppulp.c (user_label_prefix): Qualify a char* with the `const' keyword. * dyn-string.c (dyn_string_append): Likewise. * dyn-string.h (dyn_string_append): Likewise. * final.c (end_final, output_operand_lossage, asm_fprintf): Likewise. * output.h (end_final, output_operand_lossage, asm_fprintf, named_section, decode_reg_name, make_decl_rtl, user_label_prefix): Likewise. * profile.c (init_branch_prob): Likewise. * toplev.c (set_target_switch, vmessage, v_message_with_file_and_line, v_message_with_decl, v_error_with_file_and_line, v_error_with_decl, v_error_for_asm, verror, vfatal, v_warning_with_file_and_line, v_warning_with_decl, v_warning_for_asm, vwarning, vpedwarn, v_pedwarn_with_decl, v_pedwarn_with_file_and_line, vsorry, v_really_sorry, open_dump_file, dump_rtl, clean_dump_file, print_version, print_single_switch, print_switch_values, dump_base_name, debug_args, lang_independent_options, user_label_prefix, documented_lang_options, target_switches, target_options, print_time, pfatal_with_name, fatal_io_error, fatal_insn, default_print_error_function, print_error_function, report_error_function, error_with_file_and_line, error_with_decl, error_for_asm, error, fatal, warning_with_file_and_line, warning_with_decl, warning_for_asm, warning, pedwarn, pedwarn_with_decl, pedwarn_with_file_and_line, sorry, really_sorry, botch, output_quoted_string, output_file_directive, open_dump_file, rest_of_decl_compilation, display_help, main): Likewise. * toplev.h (print_time, fatal, fatal_io_error, pfatal_with_name, fatal_insn, warning, error, pedwarn, pedwarn_with_file_and_line, warning_with_file_and_line, error_with_file_and_line, sorry, really_sorry, default_print_error_function, report_error_function, rest_of_decl_compilation, pedwarn_with_decl, warning_with_decl, error_with_decl, error_for_asm, warning_for_asm, output_quoted_string, output_file_directive, botch): Likewise. * tree.h (make_decl_rtl): Likewise. * varasm.c (strip_reg_name, named_section, decode_reg_name, make_decl_rtl): Likewise. From-SVN: r24743
1999-01-16cccp.c (print_help): Fix typos.Jeffrey A Law1-2/+2
* cccp.c (print_help): Fix typos. * cpplib.c (print_help): Fix typos. * toplev.c (f_optiosn): Fix typos. (documented_lang_options): Fix typos. From-SVN: r24706
1999-01-06Fix copyright dates.Jeff Law1-1/+1
From-SVN: r24530
1999-01-05Makefile.in (gcc.o, [...]): Depend on prefix.h.Kaveh R. Ghazi1-3/+2
* Makefile.in (gcc.o, prefix.o, cccp.o, cpplib.o): Depend on prefix.h. * cccp.c: Include prefix.h, don't prototype prefix.c functions. (new_include_prefix): Constify char* parameters. * cppfiles.c (read_name_map): Likewise. (append_include_chain): Likewise. Also, use a writable char* copy of parameter `dir' which we then modify, rather than using the parameter itself to store the new writable string. (remap_filename): Constify some variables. Also, use a writable char* to store an allocated string which we will be modifying. * cpplib.c: Include prefix.h, don't prototype prefix.c functions. (cpp_start_read): Constify variable `str'. * cpplib.h (append_include_chain): Constify a char* parameter. * gcc.c Include prefix.h, don't prototype prefix.c functions. (add_prefix, save_string): Constify char* parameters. (fatal, error): Add ATTRIBUTE_PRINTF_1 to prototypes. * prefix.c: Include prefix.h. (get_key_value, translate_name, save_string, update_path, set_std_prefix): Constify various char* parameters and variables. (save_string): Use xmalloc, not malloc. (translate_name): Use a writable temporary variable to create and modify a string before setting it to a const char*. * prefix.h: New file to prototype functions exported from prefix.c. From-SVN: r24498
1999-01-04cpplib.c (skip_if_group): Split out the logic that handles directive ↵Zack Weinberg1-150/+138
recognition to its own function. 1998-12-21 18:03 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.c (skip_if_group): Split out the logic that handles directive recognition to its own function. Don't use parse markers; use a bare pointer into the buffer. Use copy/skip_rest_of_line instead of doing it by hand. Remove `return on any directive' mode which was never used, and take only one argument. (consider_directive_while_skipping): New function, subroutine of skip_if_group. Logic streamlined a bit. (conditional_skip, do_elif, do_else): Call skip_if_group with only one argument. From-SVN: r24485
1999-01-04cpplib.c (do_undef): EOF immediately after '#undef FOO' is not an error.Zack Weinberg1-1/+1
Wed Dec 23 17:30:18 1998 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.c (do_undef): EOF immediately after '#undef FOO' is not an error. From-SVN: r24484
1998-12-16cpplib.c (do_include): Treat #include_next in the primary source file as ↵Zack Weinberg1-7/+19
#include plus warning. 1998-12-16 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.c (do_include): Treat #include_next in the primary source file as #include plus warning. Treat #include_next in a file included by absolute path as an error. fp == CPP_NULL_BUFFER is a fatal inconsistency. From-SVN: r24340
1998-12-16cccp.c: Don't define MIN/MAX anymore.Kaveh R. Ghazi1-6/+0
* cccp.c: Don't define MIN/MAX anymore. * cpplib.c: Likewise. * machmode.h: Likewise. * system.h: Provide definitions for MIN/MAX. From-SVN: r24339
1998-12-15cppalloc.c: Add xstrdup here.Zack Weinberg1-16/+2
1998-12-15 Zack Weinberg <zack@rabi.phys.columbia.edu> * cppalloc.c: Add xstrdup here. * cpplib.h: Remove savestring prototype. * cpplib.c: Remove savestring function. s/savestring/xstrdup/ throughout. * cppfiles.c: s/savestring/xstrdup/ throughout. From-SVN: r24327
1998-12-15cpplib.c: Make all directive handlers read their own arguments.Zack Weinberg1-172/+169
1998-12-14 00:56 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.c: Make all directive handlers read their own arguments. (struct directive): Remove last two arguments from FUNC member prototype. Remove `command_reads_line' member entirely. (directive_table): Remove initializations of command_reads_line flag. Pretty-print. (eval_if_expression, do_define, do_line, do_include, do_undef, do_error, do_pragma, do_ident, do_if, do_xifdef, do_else, do_elif, do_sccs, do_assert, do_unassert, do_warning): Take only two args. (cpp_define): Call do_define with two args and the text to define stuffed into a buffer. (make_assertion): Call do_assert with two args. (handle_directive): Call do_line with two args. Call kt->func with two args. Remove command_reads_line processing. (do_define, do_undef, do_error, do_warning, do_pragma, do_sccs): Read the rest of the line here. (do_ident): Gobble rest of line, as cccp does. (cpp_undef): New function. (cpp_start_read): Call cpp_undef instead of do_undef. From-SVN: r24326
1998-12-15cpphash.h (union hash_value): Remove `keydef' member, add a `struct hashnode ↵Zack Weinberg1-432/+172
*aschain' member for #assert. 1998-12-15 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpphash.h (union hash_value): Remove `keydef' member, add a `struct hashnode *aschain' member for #assert. * cpplib.c (struct tokenlist_list, struct assertion_hashnode): Delete structure definitions. (assertion_install, assertion_lookup, delete_assertion, check_assertion, compare_token_lists, reverse_token_list, read_token_list, free_token_list): Delete functions. (parse_assertion): New function. (cpp_cleanup): Don't destroy the assertion_hashtable. (do_assert): Gut and rewrite. #assert foo (bar) places entries for `#foo' and `#foo(bar)' in the macro hash table, type T_ASSERT. The value union's `aschain' member is used to chain all answers for a given predicate together. (do_unassert): Also rewritten. Take an un-asserted answer off the chain from its predicate and call delete_macro on the hashnode, or walk a predicate chain calling delete_macro on all the entries. (cpp_read_check_assertion): Simply call parse_assertion to get the canonical assertion name, and look that up in the hash table. * cpplib.h (ASSERTION_HASHNODE,ASSERTION_HASHSIZE,assertion_hashtab): Removed. * cpphash.c (install): Use bcopy instead of an explicit loop to copy the macro name. * cppexp.c (cpp_lex): Convert the result of cpp_read_check_assertion to a `struct operation' directly; don't go through parse_number. From-SVN: r24325
1998-12-08cpplib.c (convert_string): Use `0x00ff', not `0x00ffU'.Kaveh R. Ghazi1-1/+1
Tue Dec 8 11:58:51 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * cpplib.c (convert_string): Use `0x00ff', not `0x00ffU'. From-SVN: r24182
1998-12-07cpplib.c (initialize_char_syntax): Use ISALPHA and ISALNUM so it'll work on ↵Zack Weinberg1-21/+21
non-ASCII platforms. 1998-12-07 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.c (initialize_char_syntax): Use ISALPHA and ISALNUM so it'll work on non-ASCII platforms. Always consider $ an identifier character. Take no arguments. (cpp_reader_init): Call initialize_char_syntax with no arguments. (cpp_start_read): Don't call initialize_char_syntax again. Clear is_idchar['$'] and is_idstart['$'] if not opts->dollars_in_ident. * cpplib.h (struct cpp_reader): Replace void *data element by cpp_options *opts. Rearrange elements to make gdb printout less annoying (put buffer stack at end). (CPP_OPTIONS): Get rid of now-unnecessary cast. * cppmain.c: s/data/opts/ when initializing cpp_reader structure. * c-decl.c: Likewise. * objc/objc-act.c: Likewise. * fix-header.c: Likewise. From-SVN: r24154
1998-12-07cpplib.h (struct cpp_buffer): Replace dir and dlen members with a struct ↵Zack Weinberg1-63/+30
file_name_list pointer. 1998-11-26 01:17 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.h (struct cpp_buffer): Replace dir and dlen members with a struct file_name_list pointer. (struct cpp_reader): Add pointer to chain of `actual directory' include searchpath entries. (struct file_name_list): Add *alloc pointer for the sake of the actual-directory chain. Move definition of HOST_WIDE_INT here. (cpp_parse_escape): Change prototype to match changes in cppexp.c. * cppfiles.c (actual_directory): New function. (finclude): Use it to initialize the buffer's actual_dir entry. (find_include_file): We don't need to fix up max_include_len here. * cpplib.c (do_include): Don't allocate a file_name_list on the fly for current directory "" includes, use the one that's been preallocated in pfile->buffer->actual_dir. Hoist out duplicate code from the search_start selection logic. (cpp_reader_init): Initialize pfile->actual_dirs. Remove definition of HOST_WIDE_INT. Change calls to cpp_parse_escape to match changes in cppexp.c (note hardcoded MASK, which is safe since this is the source character set). * cppexp.c: Bring over changes to cpp_parse_escape from cccp.c to handle wide character constants in #if directives. The function now returns a HOST_WIDE_INT, and takes a third argument which is a binary mask for all legal values (0x00ff for 8-bit `char', 0xffff for 16-bit `wchar_t', etc.) Define MAX_CHAR_TYPE_MASK and MAX_WCHAR_TYPE_MASK. Change callers of cpp_parse_escape to match. [Fixes c-torture/execute/widechar-1.c] From-SVN: r24153
1998-12-07[multiple changes]Dave Brolley1-11/+1
Mon Dec 7 15:38:25 1998 Dave Brolley <brolley@cygnus.com> * gcc.c (default_compilers): Fix typo in USE_CPPLIB spec for cc1. Mon Dec 7 15:38:25 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * c-aux-info.c (concat): Wrap function definition in !USE_CPPLIB. * cppalloc.c: Move function `xcalloc' from cpplib.c to here. * cpplib.c: Move function `xcalloc' from here to cppalloc.c. From-SVN: r24152
1998-11-27system.h: Include libiberty.h.Kaveh R. Ghazi1-6/+3
* system.h: Include libiberty.h. * c-aux-info.c: Remove prototypes for concat/concat3. Change function `concat' from fixed parameters to variable parameters, as is done in libiberty. All callers of concat/concat3 changed to use the new `concat' with variable args. * cccp.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. * cexp.y: Likewise. * collect2.c: Likewise. * config/1750a/1750a.h: Likewise. * cppalloc.c: Likewise. * cppexp.c: Likewise. * cppfiles.c: Likewise. * cpphash.c: Likewise. * cpplib.c: Likewise. * dyn-string.c: Likewise. * fix-header.c: Likewise. * gcc.c: Likewise. * gcov.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * gencheck.c: Likewise. * gencodes.c: Likewise. * genconfig.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * gengenrtl.c: Likewise. * genopinit.c: Likewise. * genoutput.c: Likewise. * genpeep.c: Likewise. * genrecog.c: Likewise. * getpwd.c: Likewise. * halfpic.c: Likewise. * hash.c: Likewise. * mips-tdump.c: Likewise. Wrap malloc/realloc/calloc prototypes in NEED_DECLARATION_* macros. * mips-tfile.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. (fatal): Fix const-ification of variable `format' in !ANSI_PROTOTYPES case. * prefix.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. * print-rtl.c: Rename variable `spaces' to `xspaces' to avoid conflicting with function `spaces' from libiberty. * profile.c: Remove things made redundant by libiberty.h and/or conform to libiberty standards. * protoize.c: Likewise. * rtl.h: Likewise. * scan.h: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tree.h: Likewise. From-SVN: r23931
1998-11-25cpplib.h: Delete struct import_file.Zack Weinberg1-453/+305
Wed Nov 25 14:54:46 1998 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.h: Delete struct import_file. Add ihash element to struct cpp_buffer. Delete dont_repeat_files and import_hash_table elements from cpp_reader; change all_include_files to a hash table. Delete all foobar_include / last_foobar_include elements from struct cpp_options; put back four such: quote_include, bracket_include, system_include, after_include. Redo struct file_name_list completely. Add new structure type include_hash. Add prototypes for merge_include_chains and include_hash. Change prototypes for finclude, find_include_file, and append_include_chain to match changes below. * cppfiles.c (simplify_pathname, include_hash, remap_filename, merge_include_chains): New functions. (add_import, lookup_import, open_include_file): Removed. (INO_T_EQ): Define this (copied from cccp.c). (hack_vms_include_specification): Remove all calls and #if 0 out the definition. It was being called incorrectly and at the wrong times. Until a VMSie can look at this, it's better to not pretend to support it. (append_include_chain): Change calling convention; now takes only one directory at a time, and sets up the data structure itself. (redundant_include_p): Rewritten - this is now used for all include redundancy, whether by #ifndef, #import, or #pragma once. Looks up things in the include hash table. (file_cleanup): Decrement pfile->system_include_depth here if it's >0. (find_include_file): Calling convention changed; now passes around a struct include_hash instead of 3 separate parameters. Guts ripped out and replaced with new include_hash mechanism. (finclude): Calling convention changed as for find_include_file. Error exits pulled out-of-line. Reformat. (safe_read): Return a long, not an int. (deps_output): Don't recurse. * cpplib.c (is_system_include): Deleted. (path_include): Fix up call to append_include_chain. (do_include): Fix up calls to find_include_file and finclude. Clean up dependency output a bit. Shorten obnoxiously lengthy #import warning message. Don't decrement pfile->system_include_depth here. (do_pragma): Understand the include_hash structure. Reformat. (do_endif): Correct handling of control macros. Understand the include_hash. (cpp_start_read): Fix up calls to finclude. Call merge_include_chains. (cpp_handle_option): Fix up calls to append_include_chain. Understand the four partial include chains. (cpp_finish): Add debugging code (#if 0-ed out) for the include_hash. (cpp_cleanup): Free the include_hash, not the import hash and the all_include and dont_repeat lists which no longer exist. From-SVN: r23857
1998-11-23cccp.c (S_ISREG, S_ISDIR): Delete defines.Melissa O'Neill1-8/+0
* cccp.c (S_ISREG, S_ISDIR): Delete defines. * cpplib.c, gcc.c: Likewise. * system.h (S_ISREG, S_ISDIR): Define if not already defined. From-SVN: r23785
1998-11-08gansidecl.h: Prepend a "G" to the macro wrapping this file (to distinguish ↵Kaveh R. Ghazi1-14/+14
it from the macro... * gansidecl.h: Prepend a "G" to the macro wrapping this file (to distinguish it from the macro wrapping ansidecl.h.) Include libiberty's ansidecl.h. Remove all redundant definitions. Define the PROTO() style macros in terms of the PARAMS() ones. * calls.c (emit_library_call): Switch on ANSI_PROTOTYPES, not __STDC__, when deciding whether to use ANSI variable args. (emit_library_call_value): Likewise. * cccp.c (error): Likewise. (warning): Likewise. (error_with_line): Likewise. (warning_with_line): Likewise. (pedwarn): Likewise. (pedwarn_with_line): Likewise. (pedwarn_with_file_and_line): Likewise. (fatal): Likewise. * cexp.y (error): Likewise. (pedwarn): Likewise. (warning): Likewise. * collect2.c (fatal_perror): Likewise. (fatal): Likewise. (error): Likewise. * combine.c (gen_rtx_combine): Likewise. * cpperror.c (cpp_message): Likewise. (cpp_fatal): Likewise. * cpplib.c (cpp_error): Likewise. (cpp_warning): Likewise. (cpp_pedwarn): Likewise. (cpp_error_with_line): Likewise. (cpp_warning_with_line): Likewise. (cpp_pedwarn_with_line): Likewise. (cpp_pedwarn_with_file_and_line): Likewise. * cpplib.h: Don't define PARAMS() macro. * demangle.h: Likewise. * doprint.c (checkit): Switch on ANSI_PROTOTYPES, not __STDC__, when deciding whether to use ANSI variable args. * emit-rtl.c (gen_rtx): Likewise. (gen_rtvec): Likewise. * final.c (asm_fprintf): Likewise. * fix-header.c (cpp_message): Likewise. (fatal): Likewise. (cpp_fatal): Likewise. * gcc.c (concat): Likewise. (fatal): Likewise. (error): Likewise. * genattr.c (fatal): Likewise. * genattrtab.c (attr_rtx): Likewise. (attr_printf): Likewise. (fatal): Likewise. * gencodes.c (fatal): Likewise. * genconfig.c (fatal): Likewise. * genemit.c (fatal): Likewise. * genextract.c (fatal): Likewise. * genflags.c (fatal): Likewise. * genopinit.c (fatal): Likewise. * genoutput.c (fatal): Likewise. (error): Likewise. * genpeep.c (fatal): Likewise. * genrecog.c (fatal): Likewise. * halfpic.h: Switch on ANSI_PROTOTYPES, not __STDC__, when deciding whether to declare `tree_node' and `rtx_def'. * hash.h: Don't define stuff we get from gansidecl.h. * mips-tfile.c: Likewise. Define __proto() in terms of PARAMS(). (fatal): Switch on ANSI_PROTOTYPES, not __STDC__, when deciding whether to use ANSI variable args. (error): Likewise. * prefix.c (concat): Likewise. * scan.h: Likewise. * system.h: Likewise. * toplev.c (error_with_file_and_line): Likewise. (error_with_decl): Likewise. (error_for_asm): Likewise. (error): Likewise. (fatal): Likewise. (warning_with_file_and_line): Likewise. (warning_with_decl): Likewise. (warning_for_asm): Likewise. (warning): Likewise. (pedwarn): Likewise. (pedwarn_with_decl): Likewise. (pedwarn_with_file_and_line): Likewise. (sorry): Likewise. (really_sorry): Likewise. * toplev.h: Switch on ANSI_PROTOTYPES, not __STDC__, when deciding whether to declare `tree_node' and `rtx_def'. * tree.c (build): Switch on ANSI_PROTOTYPES, not __STDC__, when deciding whether to use ANSI variable args. (build_nt): Likewise. (build_parse_node): Likewise. From-SVN: r23577
1998-11-07configure.in (host_xm_file, [...]): Arrange to include gansidecl.h in ↵Kaveh R. Ghazi1-1/+0
{ht}config.h & tm.h just before the config/... * configure.in (host_xm_file, build_xm_file, xm_file, tm_file): Arrange to include gansidecl.h in {ht}config.h & tm.h just before the config/ directory headers. (tm_file_list, host_xm_file_list, build_xm_file_list): Handle gansidecl.h in the list of dependencies. * Makefile.in (RTL_BASE_H): Don't depend on gansidecl.h. (TREE_H, DEMANGLE_H, RECOG_H, REGS_H, libgcc2.a, stmp-multilib, mbchar.o, collect2.o, pexecute.o, vfprintf.o, splay-tree.o, gcc.o, gencheck.o, choose-temp.o, mkstemp.o, mkstemp.o, prefix.o, dyn-string.o, cexp.o, cccp.o, cppmain.o, cpplib.o, cpperror.o, cppexp.o, cppfiles.o, cpphash.o, cppalloc.o, scan-decls.o): Likewise. * cccp.c: Don't include gansidecl.h. * cexp.y: Likewise. * collect2.c: Likewise. * config/c4x/c4x.c: Likewise. * config/v850/v850.h: Likewise. * cppalloc.c: Likewise. * cpperror.c: Likewise. * cppexp.c: Likewise. * cppfiles.c: Likewise. * cpphash.c: Likewise. * cpplib.c: Likewise. * cppmain.c: Likewise. * cppulp.c: Likewise. * demangle.h: Likewise. * doprint.c: Likewise. * dyn-string.c: Likewise. * eh-common.h: Likewise. * fix-header.c: Likewise. * frame.c: Likewise. * gcc.c: Likewise. * gcov.c: Likewise. * gen-protos.c: Likewise. * gencheck.c: Likewise. * halfpic.h: Likewise. * hash.c: Likewise. * machmode.h: Likewise. * mbchar.c: Likewise. * prefix.c: Likewise. * protoize.c: Likewise. * recog.h: Likewise. * rtl.h: Likewise. * scan-decls.c: Likewise. * tree.h: Likewise. * varray.h: Likewise. From-SVN: r23558
1998-10-29[multiple changes]Zack Weinberg1-907/+152
1998-10-28 16:10 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu> * c-lang.c: Declare extern char *yy_cur if USE_CPPLIB. (lang_init): Call check_newline always. * c-lex.c (init_parse) [USE_CPPLIB=1]: After calling cpp_start_read, set yy_cur and yy_lim to read from parse_in.token_buffer, so that we'll see the first #line directive. * cpplib.c (cpp_start_read): finclude the main input file before processing -include/-imacros. Process -imacros and -include separately, and handle -include by stacking a buffer for the file in question as if it'd been #included. * toplev.c (documented_lang_options) Recognize -H when USE_CPPLIB is on. 1998-10-28 16:09 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.c: Merge do_once into do_pragma. Break file handling code out of do_include. Move append_include_chain, deps_output, file_cleanup, redundant_include_p, import_hash, lookup_import, add_import, read_filename_string, read_name_map, open_include_file, finclude, safe_read to cppfiles.c. Move prototypes for deps_output, append_include_chain, finclude to cpplib.h. Move definition of struct file_name_list there also. * cppfiles.c: New file. Contains all the above functions broken out of cpplib.c; also hack_vms_include_specification from cccp.c and find_include_file, a new function broken out of do_include. * Makefile.in (cppmain): Depend on cppfiles.o. (fix-header): Likewise. (cppfiles.o): New target. * configure.in (--enable-c-cpplib): Add cppfiles.o to extra_c_objs. Add ../cppfiles.o to extra_cxx_objs. From-SVN: r23424
1998-10-28Makefile.in (cc1): Put C_OBJS, and thence @extra_c_objs@ last.Richard Henderson1-1/+13
* Makefile.in (cc1): Put C_OBJS, and thence @extra_c_objs@ last. (LIBCPP_OBJS): New. Add cppulp.o. (cppmain, fix-header): Depend on and use libcpp.a. * configure.in (extra_c_objs, extra_cxx_objs): Use libcpp.a instead of the individual object files. * objc/Make-lang.in (cc1obj): Put OBJC_OBJS, and thence @extra_c_objs@, last. * cccp.c (user_label_prefix): New. (main): Set it off -f*leading-underscore. (special_symbol): Use it. * cpplib.c (special_symbol): Likewise. (cpp_handle_option): Handle -f*leading-underscore. * cppulp.c: New file. * output.h (user_label_prefix): Declare it. * dwarf2out.c (ASM_NAME_TO_STRING): Prepend user_label_prefix. * toplev.c (f_options, main): Handle -f*leading-underscore. * defaults.h (ASM_OUTPUT_LABELREF): Use asm_fprintf instead of referencing USER_LABEL_PREFIX directly. * config/nextstep.h (ASM_OUTPUT_LABELREF): Likewise. * m32r/m32r.h (ASM_OUTPUT_LABELREF): Likewise. * final.c (asm_fprintf): Use user_label_prefix instead. * arm/thumb.c (thumb_print_operand): Likewise. * gcc.c (default_compilers): Pass -f*leading-underscore on to cpp wherever appropriate. From-SVN: r23415
1998-10-17Warning fixes:Kaveh R. Ghazi1-8/+8
* Makefile.in (flow.o): Depend on recog.h. * cpplib.h (directive_table): Add missing initializiers. (finclude): Change type of variable `bsize' to size_t. * cse.c (rtx_cost): Mark parameter `outer_code' with ATTRIBUTE_UNUSED. * dwarfout.h (dwarfout_label): Wrap prototype in macro RTX_CODE. * fix-header.c (lookup_std_proto): Cast the result of `strlen' to `int' when comparing against one. (cpp_file_line_for_message): Mark parameter `pfile' with ATTRIBUTE_UNUSED. (cpp_fatal): Mark parameter `pfile' with ATTRIBUTE_UNUSED. * flow.c: Include recog.h. (sbitmap_copy): Cast arguments 1 & 2 of `bcopy' to (PTR). * function.c (thread_prologue_and_epilogue_insns): Mark parameter `f' with ATTRIBUTE_UNUSED. (reposition_prologue_and_epilogue_notes): Likewise. * genopinit.c (gen_insn): Cast argument of ctype functions to `unsigned char'. * haifa-sched.c: Include recog.h. (blockage_range): Cast result of UNIT_BLOCKED macro to (int) when comparing against one. * libgcc2.a (__throw): Revert ATTRIBUTE_UNUSED change for now. * mips-tfile.c (parse_end): Cast the argument of ctype function to `unsigned char'. (parse_ent): Likewise. (parse_input): Likewise. * optabs.c (init_libfuncs): Likewise. * protoize.c (find_rightmost_formals_list): Likewise. * recog.h (const_double_operand): Fix typo in prototype. * tlink.c (scan_linker_output): Cast the argument of ctype function to `unsigned char'. * toplev.c (check_lang_option): Cast the result of `strlen' to `int' when comparing against one. From-SVN: r23155
1998-10-16cpplib.c (cpp_get_token): Replace whitespace that occurs between a macro ↵Dave Brolley1-15/+29
name and the next token with a... Fri Oct 16 17:26:10 1998 Dave Brolley <brolley@cygnus.com> * cpplib.c (cpp_get_token): Replace whitespace that occurs between a macro name and the next token with a single blank if that whitespace is in a macro buffer and the next token is not '('. From-SVN: r23139
1998-10-10cppexp.c: When forcing unsigned comparisons, cast both sides of the operation.Zack Weinberg1-3/+3
* cppexp.c: When forcing unsigned comparisons, cast both sides of the operation. * cpphash.h: Move static declaration of hashtab[]... * cpphash.c: ...here. * cpplib.c: Cast difference of two pointers to size_t before comparing it to size_t. Cast signed to unsigned before comparing to size_t. (FIXME: struct argdata should use unsigned buffer sizes.) * cpplib.h (struct cpp_reader): Declare token_buffer_size as unsigned int. (CPP_WRITTEN): Cast return value to size_t. (CPP_RESERVE): Parenthesize N for evaluation order, cast to size_t before comparison. From-SVN: r22980
1998-10-08emit-rtl.c (init_emit_once): Call INIT_EXPANDERS.Jeff Law1-2/+2
* emit-rtl.c (init_emit_once): Call INIT_EXPANDERS. * cpplib.h: Protect from multiple inclusions. * cpplib.c: Fix minor formatting problems. From-SVN: r22937
1998-10-04cpplib.c (macroexpand): Correct off-by-one error in handling of escapes.Zack Weinberg1-4/+4
* cpplib.c (macroexpand): Correct off-by-one error in handling of escapes. From-SVN: r22827
1998-09-30cpplib.c (macroexpand): If arg->raw_before or arg->raw_after...Zack Weinberg1-11/+23
* cpplib.c (macroexpand): If arg->raw_before or arg->raw_after, remove any no-reexpansion escape at the beginning of the pasted token. Correct handling of whitespace markers and no-reexpand markers at the end if arg->raw_after. From-SVN: r22695
1998-09-30toplev.c (documented_lang_options): Recognize -include, -imacros, ↵Zack Weinberg1-37/+37
-iwithprefix, -iwithprefixbefore. * toplev.c (documented_lang_options): Recognize -include, -imacros, -iwithprefix, -iwithprefixbefore. * cpplib.c (cpp_start_read): Process -imacros and -include switches at the same time and in command-line order, after initializing the dependency-output code. Emit properly nested #line directives for them. Emit a #line for the main file before processing these switches, and don't do it again afterward. From-SVN: r22689
1998-09-20c-lex.c (init_lex): Use getenv ("LANG"), not GET_ENVIRONMENT ().Felix Lee1-7/+7
* c-lex.c (init_lex): Use getenv ("LANG"), not GET_ENVIRONMENT (). * cccp.c (main): Likewise. * gcc.c (process_command): Similarly for "GCC_EXEC_PREFIX". * cccp.c, collect2.c, cpplib.c, gcc.c, config/i386/xm-cygwin32.h: Rename GET_ENVIRONMENT to GET_ENV_PATH_LIST, and fix some macro-use bugs. From-SVN: r22511
1998-09-16cpplib.c: removed OLD_GPLUSPLUS_INCLUDE_DIRAlexandre Oliva1-1/+0
* cpplib.c: removed OLD_GPLUSPLUS_INCLUDE_DIR * cccp.c: ditto * Makefile.in (old_gxx_include_dir): removed From-SVN: r22453
1998-08-26system.h: Include stdarg.h/varargs.h...Kaveh R. Ghazi1-5/+0
* system.h: Include stdarg.h/varargs.h, make sure they are ordered correctly with regards to stdio.h. * calls.c: Remove stdarg.h/varargs.h. * cccp.c: Likewise. * cexp.y: Likewise. * combine.c: Likewise. * cpperror.c: Likewise. * cpplib.c: Likewise. * cpplib.h: Likewise. * doprint.c: Likewise. * emit-rtl.c: Likewise. * final.c: Likewise. * fix-header.c: Likewise. * gcc.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * gencodes.c: Likewise. * genconfig.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * genflags.c: Likewise. * genopinit.c: Likewise. * genoutput.c: Likewise. * genpeep.c: Likewise. * genrecog.c: Likewise. * mips-tfile.c: Likewise. * prefix.c: Likewise. * protoize.c: Likewise. * regmove.c: Likewise. * toplev.c: Likewise. * tree.c: Likewise. * cp/errfn.c: Remove stdarg.h/varargs.h. * cp/tree.c: Likewise. From-SVN: r21997
1998-08-20stor-layout.c (layout_type): Compute TYPE_SIZE_UNIT correctly for arrays of ↵Dave Brolley1-0/+6
bits. Thu Aug 20 13:15:11 1998 Dave Brolley <brolley@cygnus.com> * stor-layout.c (layout_type): Compute TYPE_SIZE_UNIT correctly for arrays of bits. * cpplib.c (cpp_define): Handle macros with parameters. From-SVN: r21872
1998-07-20Remove accidental checkin.Jeff Law1-4/+0
From-SVN: r21309
1998-07-13Add --help option.Nick Clifton1-3/+83
From-SVN: r21109
1998-07-06cpplib.c (cpp_options_init): Initialize cplusplus_comments to 1, matching ↵Ian Lance Taylor1-1/+2
July 18, 1995 change to cccp.c. * cpplib.c (cpp_options_init): Initialize cplusplus_comments to 1, matching July 18, 1995 change to cccp.c. If -traditional then disable cplusplus_comments. Co-Authored-By: Jeffrey A Law <law@cygnus.com> From-SVN: r20960
1998-06-29Warning fixes:Kaveh R. Ghazi1-1/+1
* Makefile.in (fix-header): Don't needlessly depend on cpperror.o. * alias.c (CHECK_ALIAS_SETS_FOR_CONSISTENCY): Cast expansion to void since it is evaluated in a comma list. * mips.h (ASM_GENERATE_INTERNAL_LABEL): Always sprintf `NUM' argument as a long and cast `NUM' to long to ensure it is of the proper width. Wrap macro arguments in parens when they appear in the expansion. * sol2.h (ASM_GENERATE_INTERNAL_LABEL): Likewise. * sparc.h (ASM_GENERATE_INTERNAL_LABEL): Likewise. (ASM_DECLARE_RESULT): Fix fprintf format specifier to match function argument return type. (REGNO_OK_FOR_INDEX_P, REGNO_OK_FOR_BASE_P, REGNO_OK_FOR_FP_P, REGNO_OK_FOR_CCFP_P): Use `(unsigned)' not `U'. * cpplib.c (cpp_message_from_errno): Remove unneeded argument to cpp_message. * dbxout.c: Fix the comments after an #endif to reflect the actual condition tested in the preceding #if. * except.c (find_all_handler_type_matches): Switch to old-style function definition. * expr.c (expand_builtin): Remove unused variable `type' twice. * gbl-ctors.h (DO_GLOBAL_CTORS_BODY): Cast -1 before comparing it to an unsigned long. * haifa-sched.c (print_insn_chain): Remove unused function. * objc/objc-act.c (build_msg_pool_reference): Hide prototype and definition. * toplev.c: When testing whether to include dbxout.h, also include it when XCOFF_DEBUGGING_INFO is defined. * unroll.c (unroll_loop): Add parentheses around assignment used as truth value. From-SVN: r20801
1998-06-28Consolidate strerror handling, as well as getcwd/getwd.Kaveh R. Ghazi1-12/+2
* configure.in (GCC_NEED_DECLARATIONS): Add strerror, getcwd and getwd. * acconfig.m4: Add stubs for NEED_DECLARATION_STRERROR, NEED_DECLARATION_GETCWD and NEED_DECLARATION_GETWD. * cccp.c: Remove strerror()/sys_nerr/sys_errlist decls. (my_strerror): Add prototype and make it static. * collect2.c: Likewise. * cpplib.c: Likewise. * gcc.c: Likewise, but keep `my_strerror' extern. * protoize.c: Likewise. * pexecute.c (my_strerror): Add argument to prototype. * system.h: Add prototypes for getcwd, getwd and strerror. Add extern decls for sys_nerr and sys_errlist. Make abort decl explicitly extern. * getpwd.c: Remove decls for getwd and getcwd. From-SVN: r20779
1998-06-23cpplib.c (do_line): Typo broke #line directive.Dave Brolley1-5/+14
Tue Jun 23 16:44:21 1998 Dave Brolley <brolley@cygnus.com> * cpplib.c (do_line): Typo broke #line directive. (cpp_message_from_errno): New function. (cpp_error_from_errno): Call cpp_message_from_errno. * cpplib.h (cpp_message_from_errno): New function. From-SVN: r20675
1998-06-22Warning fixes:Kaveh R. Ghazi1-1/+1
* mips.c (gpr_mode): Don't say `static' twice. * cpplib.c (cpp_handle_option): Don't pass unneeded NULL to cpp_fatal. * objc/objc-act.c (init_selector): Hide prototype and definition. * optabs.c (gen_cond_trap): Remove unused variable `icode'. * regmove.c (copy_src_to_dest): Likewise for `i'. From-SVN: r20652