aboutsummaryrefslogtreecommitdiff
path: root/gcc/tradcpp.c
AgeCommit message (Collapse)AuthorFilesLines
2001-05-10cppinit.c (cpp_post_options): Shut off macro expansion if -fpreprocessed.Zack Weinberg1-9/+99
* cppinit.c (cpp_post_options): Shut off macro expansion if -fpreprocessed. * cpplib.c (_cpp_handle_directive): If -fpreprocessed, accept IN_I directives only if the # is in column 1 and the directive name begins in column 2. * cppmain.c (scan_buffer): Insert a space between # and an identifier, when that identifier is a directive name. * tradcpp.c (struct file_buf): Add a pointer to the next entry in the header search path. (enum node_type): Add T_INCLUDE_NEXT. (directive_table): Add entry for include_next. (do_include_next): New function. (process_include): New routine, broken out of do_include. (finclude): Insert 'nhd' argument, to be copied into next_header_dir of the new buffer. (main): Adjust to match. * gsyslimits.h, limity.h: Un-indent #include_next. testsuite: * gcc.dg/cpp/direct2.c: New test. * gcc.dg/cpp/direct2s.c: New test. * gcc.c-torture/execute/920730-1t.c: #undef __GNUC__ at head. From-SVN: r41932
2001-05-02tradcpp.c (do_define): Make sure we don't walk past limit.Jakub Jelinek1-3/+3
* tradcpp.c (do_define): Make sure we don't walk past limit. * gcc.dg/cpp/tr-define.c: New test. From-SVN: r41773
2001-03-28toplev.h (fatal_error): Add ATTRIBUTE_NORETURN.Kaveh R. Ghazi1-1/+1
* toplev.h (fatal_error): Add ATTRIBUTE_NORETURN. * tradcif.y (yyerror): Likewise. Add format specifier in call to `error'. * tradcpp.c (macroexpand): Likewise for call to `error_with_line'. From-SVN: r40939
2001-01-24cppfiles.c (_cpp_read_file): Add to dependencies if requested.Jakub Jelinek1-0/+5
* cppfiles.c (_cpp_read_file): Add to dependencies if requested. * cppinit.c (cpp_start_read): Remove deps_add_dep call. * tradcpp.c (main): Add -imacros or -include'd dependencies for -M*. * cpp.texi (-M, -MM): Document -M -include behaviour. From-SVN: r39240
2001-01-11[multiple changes]Neil Booth1-3/+3
2001-01-11 Neil Booth <neil@daikokuya.demon.co.uk> * cppinit.c (cpp_start_read): If -fpreprocessed, ignore -D, -U and -A, and don't initialize the builtins. * cppmain.c (cb_define, cb_undef): Unconditionally process the callback. * tradcpp.c (main): Fix typo. 2000-01-11 Mark Elbrecht <snowball3@bigfoot.com> * cppfiles.c (cpp_included, find_include_file, _cpp_execute_include) (read_name_map): Use IS_ABSOLUTE_PATH. * tradcpp.c (get_filename): Likewise. From-SVN: r38925
2001-01-10Makefile.in (tradcpp0): Depend on mkdeps.h.Neil Booth1-172/+164
* Makefile.in (tradcpp0): Depend on mkdeps.h. Link mkdeps.o * cppinit.c (cpp_start_read): Update comment, remove unneeded if statement. * tradcpp.c: Include mkdeps.h. (deps, print_deps_phony_targets, deps_append, output_deps, init_dependency_output, output_deps): New. (deps_buffer, deps_allocated_size, deps_size, deps_column, deps_output): Delete. (print_deps_missing_files): Rename deps_missing_files. (inhibit_output): Make global. (main): Delete inhibit_output, deps_stream, deps_target. Use mkdeps functionality in the same way as cpplib. Remove -g3 handling. Handle -MF, -MP, -MQ, -MT. Update handling of -M and -MM. Remove old handling of deps via deps_out, and old reading of environment variables. (get_filename): Update to use deps_add_dep. From-SVN: r38885
2001-01-04tradcpp.c (deps_file, [...]): New variables.Jakub Jelinek1-28/+85
* tradcpp.c (deps_file, print_deps_missing_files): New variables. (main): Handle -MG, -MD, -MMD. Bail out if -MG is given without -M or -MM. (do_include): Handle missing headers like cpp0. * cppfiles.c (_cpp_execute_include): Don't prefix absolute header paths with first include pathname. Don't strcat to uninitialized string. From-SVN: r38683
2001-01-03tradcpp.c (main): Make sure finclude() is called with a valid indepth value ↵Franz Sirl1-1/+3
while handling -include. 2001-01-03 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> * tradcpp.c (main): Make sure finclude() is called with a valid indepth value while handling -include. From-SVN: r38674
2000-12-16tradcpp.c: T_WARNING: New.Neil Booth1-10/+19
* tradcpp.c: T_WARNING: New. (do_warning): New function. (finclude): Skip past the newline and increase the line number before calling output_line_command. (do_line): Skip the new line after output_line_command. Don't pre-decrement the line number. From-SVN: r38305
2000-12-13tradcpp.c (special_symbol): Improve test for definedness, though it is still ↵Neil Booth1-4/+15
not perfect. * tradcpp.c (special_symbol): Improve test for definedness, though it is still not perfect. (do_define): Don't define illegal macro names. From-SVN: r38230
2000-12-12tradcpp.c (do_error): Cast difference of pointers to int for error message.Brad Lucier1-1/+1
* tradcpp.c (do_error): Cast difference of pointers to int for error message. From-SVN: r38212
2000-12-12tradcpp.c (enum node_type): Add T_ERROR.Neil Booth1-0/+13
* tradcpp.c (enum node_type): Add T_ERROR. (do_error): New function. (directive_table): Add #error handler. From-SVN: r38205
2000-12-08* tradcpp.c (do_include): Make pointer differences 64-bit clean.Brad Lucier1-2/+2
From-SVN: r38133
2000-12-08safe-ctype.h: New file.Zack Weinberg1-119/+64
include: * safe-ctype.h: New file. libiberty: * safe-ctype.c: New file. * Makefile.in (CFILES): Add safe-ctype.c. (REQUIRED_OFILES): Add safe-ctype.o. * argv.c: Define ISBLANK and use it, not isspace. * basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c, strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h. Use uppercase ctype macros. Don't test ISUPPER(c)/ISLOWER(c) before calling TOLOWER(c)/TOUPPER(c). gcc: * Makefile.in (HOST_RTL): Add safe-ctype.o. (safe-ctype.o): New rule. * system.h: Include safe-ctype.h, not ctype.h. No need to wrap ctype macros. * cpphash.h: Zap IStable and related macros. Define is_* in terms of safe-ctype.h macros. * cppinit.c: Delete the IStable and all related code. * tradcpp.c: Delete is_idchar, is_idstart, is_hor_space, and is_space arrays. Delete initialize_char_syntax. Change all references to the above arrays to use macros instead. * tradcpp.h: Define is_idchar, is_idstart, is_space, and is_nvspace in terms of safe_ctype.h's macros. * tradcif.y: is_idchar, is_idstart are macros not arrays. * config/i370/i370.c, config/winnt/dirent.c, config/winnt/fixinc-nt.c, config/winnt/ld.c: Use uppercase ctype macros. If we included ctype.h, include safe-ctype.h instead. * fixinc/fixfixes.c: Use uppercase ctype macros. Don't test ISLOWER(c) before calling TOUPPER(c). * fixinc/fixincl.c (extract_quoted_files): Simplify out some gunk. * fixinc/gnu-regex.c: Include safe-ctype.h, not ctype.h. No need to wrap ctype macros. Don't test ISUPPER(x) before calling TOLOWER(x). gcc/ch: * lex.c: Don't bother checking whether ISUPPER(c) before calling TOLOWER(c). Don't bother checking whether isascii(c) before testing ISSPACE(c); ISSPACE(c) includes '\n'. gcc/f: * Make-lang.in: Link f/fini with safe-ctype.o. * bad.c: Don't test ISUPPER(c) || ISLOWER(c) before calling TOUPPER(c). * com.c: Use TOUPPER, not ffesrc_toupper. * fini.c: Don't test ISALPHA(c) before calling TOUPPER(c)/TOLOWER(c). * intrin.c: Don't test IN_CTYPE_DOMAIN(c). * src.c: Delete ffesrc_toupper_ and ffesrc_tolower_ and their initializing code; use TOUPPER and TOLOWER instead of ffesrc_toupper and ffesrc_tolower. * src.h: Don't declare ffesrc_toupper_ or ffesrc_tolower_. Don't define ffesrc_toupper or ffesrc_tolower. gcc/java: * jvgenmain.c: Use ISPRINT not isascii. From-SVN: r38124
2000-12-04tradcif.y: Move lexptr to top of file.Neil Booth1-3/+46
* tradcif.y: Move lexptr to top of file. Add rule to handle assertions in conditional expressions. * tradcpp.c (parse_answer): Assertions do not need to go to end of line in conditional directives. (parse_assertion): Get first character of identifiers correct. (test_assertion): New function. * tradcpp.h (test_assertion): New prototype. From-SVN: r38011
2000-12-02tradcpp.c (struct answer, [...]): New.Neil Booth1-6/+231
* tradcpp.c (struct answer, parse_assertion, parse_answer, canonicalize_text, find_answer): New. (do_assert, do_unassert): Provide appropriate function bodies. (union hashval): New member answers. From-SVN: r37953
2000-11-28tradcpp.c (enum node_type): New hash types T_ASSERT, T_UNASSERT.Neil Booth1-93/+158
* tradcpp.c (enum node_type): New hash types T_ASSERT, T_UNASSERT. (struct directive): Drop 4th argument from handlers. (do_define, do_line, do_include, do_undef, do_else, do_elif, do_endif): Similarly. (do_assert, do_unassert, do_ifdef, do_ifndef): New handlers. (do_ifxdef): Update as common handler of do_ifdef and do_ifndef. (make_definition, make_undef): Take a const char*. (make_assertion): New function. (struct directive_table): Update. (main): Handle -A command line argument. (handle_directive): Drop fourth handler argument. From-SVN: r37820
2000-11-27tradcpp.c (enum pending_dir_t, [...]): New.Neil Booth1-34/+38
* tradcpp.c (enum pending_dir_t, struct pending_dir): New. (main): Allocate a pending directive set of these. Use it. Merge handling of -D and -U. Update handling of pending directives. Free the memory after use. From-SVN: r37803
2000-11-21tradcpp.c (output_line_command): Mark system headers as such in `line' commands.Kaveh R. Ghazi1-0/+2
* tradcpp.c (output_line_command): Mark system headers as such in `line' commands. From-SVN: r37616
2000-11-19Warning fixes:Kaveh R. Ghazi1-5/+5
* builtins.c (c_getstr): Constify variable. * gmon-sol2.c (_mcleanup): Comment out #endif labels. * conflict.c (const_conflict_graph_arc): New typedef. (arc_hash, arc_eq): Avoid needlessly casting away const-ness. * cppmacro.c (builtin_macro): Likewise. * dwarf2out.c (output_comp_unit): Constify variable. * fix-header.c (v_fatal): Add ATTRIBUTE_PRINTF. * protoize.c (IS_SAME_PATH_CHAR): Use TOUPPER, not toupper. * ssa.c (ssa_rename_from_hash_function): Avoid needlessly casting away const-ness. * tradcpp.c (rescan, do_line, macroexpand, macarg): Use ISALNUM/ISDIGIT/ISPRINT, not isalnum/isdigit/isprint. * varasm.c (const_str_htab_hash, const_str_htab_eq, compare_constant_1, record_constant_1): Constify. From-SVN: r37565
2000-11-19Makefile.in (tradcpp.o, tradcif.o): Depend on tradcpp.h.Kaveh R. Ghazi1-193/+201
* Makefile.in (tradcpp.o, tradcif.o): Depend on tradcpp.h. * tradcif.y: Include tradcpp.h. Constify. Make functions static. Move extern function declarations to tradcpp.h. * tradcpp.c: Likewise. * tradcpp.h: New file. From-SVN: r37550
2000-11-14tradcpp.c, tradcif.y: Update FSF mailing address, delete reference to GPLv1.Zack Weinberg1-6/+2
* tradcpp.c, tradcif.y: Update FSF mailing address, delete reference to GPLv1. From-SVN: r37455
2000-11-13diagnostic.c (vbuild_message_string, [...]): Add ATTRIBUTE_PRINTF.Joseph Myers1-6/+9
* diagnostic.c (vbuild_message_string, output_do_printf, vnotice): Add ATTRIBUTE_PRINTF. * tradcpp.c (v_message, warning, error, fatal, error_with_line): Add ATTRIBUTE_PRINTF*. java: * parse.y (issue_warning_error_from_context): Add ATTRIBUTE_PRINTF. From-SVN: r37419
2000-11-06tradcpp.c (special_symbol): Assign an null string rather than writing to an ↵Neil Booth1-1/+1
unallocated buffer. * tradcpp.c (special_symbol): Assign an null string rather than writing to an unallocated buffer. From-SVN: r37278
2000-08-29cpperror.c (print_file_and_line): If line is (unsigned int)-1, print just ↵Zack Weinberg1-5/+2
the filename. * cpperror.c (print_file_and_line): If line is (unsigned int)-1, print just the filename. * cpplex.c (_cpp_run_directive): Add additional argument, the name to give the synthetic buffer. This defaults to translated "<command line>". * cpplib.c (cpp_define, cpp_undef, cpp_assert, cpp_unassert): Adjust to match. (_cpp_define_builtin): New function. * cppinit.c (initialize_builtins): Use _cpp_define_builtin. * cpphash.h: Update prototypes. * tradcpp.c (main): Process -D and -U simultaneously, in the order they appeared on the command line. From-SVN: r36043
2000-08-04cppdefault.h (WINT_TYPE): Define.Joseph Myers1-0/+3
* cppdefault.h (WINT_TYPE): Define. * cppinit.c (builtin_array): Define __WINT_TYPE__. * tradcpp.c (initialize_builtins): Define __WINT_TYPE__. * tm.texi (NO_BUILTIN_WINT_TYPE, WINT_TYPE): Document. From-SVN: r35478
2000-07-24tradcpp.c (main): Update max_include_len for cpp_include_defaults as well.Jakub Jelinek1-0/+2
* tradcpp.c (main): Update max_include_len for cpp_include_defaults as well. From-SVN: r35229
2000-07-21diagnostic.c (trim_filename, [...]): Moved here from rtl.c.Zack Weinberg1-4/+1
* diagnostic.c (trim_filename, fancy_abort): Moved here from rtl.c. (fatal_function, set_fatal_function): Removed. (fatal): Don't prepare for or call the fatal_function. (diagnostic_lock, error_recursion): New. (diagnostic_for_decl, report_diagnostic): Guard against re-entering the error reporting routines. (fancy_abort): Assume function is not NULL. * errors.c (fancy_abort): New. Assume function is not NULL. * tradcpp.c (fancy_abort): Assume function is not NULL. * system.h: Provide default definition of __FUNCTION__. * rtl.h: Use __FUNCTION__ not __PRETTY_FUNCTION__ throughout. Always use __FUNCTION__ in definition of abort. * tree.h: Likewise. * varray.h: Likewise. * toplev.h: Likewise. Don't prototype set_fatal_function. From-SVN: r35170
2000-07-20[multiple changes]Zack Weinberg1-46/+18
2000-07-20 Zack Weinberg <zack@wolery.cumb.org> * tradcpp.c (main): Don't munge -D options. (make_definition): Bring -D handling in line with cpplib. (do_define): Strip all leading whitespace from macro definitions. 2000-07-20 David Billinghurst <David.Billinghurst@riotinto.com.au> * Makefile.in (tradcpp): Depend on intl.o and version.o. From-SVN: r35145
2000-07-19tradcpp.c (rescan): Do not recognize directives when the # is indented.Zack Weinberg1-24/+3
* tradcpp.c (rescan): Do not recognize directives when the # is indented. * gcc.dg/cpp/tr-direct.c: New test. From-SVN: r35139
2000-07-13gcc.c (execute): If a subprocess gets a fatal signal...Zack Weinberg1-14/+0
* gcc.c (execute): If a subprocess gets a fatal signal, report strsignal() of the signal number, and ask for a bug report. Do not do this for SIGPIPE if there's already been an error. * tradcpp.c: Don't include signal.h. Don't catch SIGPIPE. Delete pipe_closed. From-SVN: r35006
2000-07-13* tradcpp.c (main): Rename 'perror' label to 'sys_error'.Zack Weinberg1-7/+7
From-SVN: r35004
2000-07-07tradcpp.c (main): Rename label `include' to `add_include' to avoid conflicts ↵Kaveh R. Ghazi1-2/+2
with variable... * tradcpp.c (main): Rename label `include' to `add_include' to avoid conflicts with variable `include' in traditional C. From-SVN: r34908
2000-07-07tradcpp.c (initialize_builtins): Honor NO_BUILTIN_SIZE_TYPE and friends.Zack Weinberg1-0/+6
* tradcpp.c (initialize_builtins): Honor NO_BUILTIN_SIZE_TYPE and friends. From-SVN: r34905
2000-07-06tradcpp.c: New file.Zack Weinberg1-0/+4831
* tradcpp.c: New file. * tradcif.y: New file. * tradcif.c: New generated file. * Makefile.in: Add rules to build tradcpp.o, tradcif.o, $(srcdir)/tradcif.c. Add tradcpp to STAGESTUFF and dependencies of C. Install tradcpp from install-common, in $(libsubdir). From-SVN: r34893