cpplib: initialization overhaul
Dave Brolley
brolley@cygnus.com
Thu Mar 4 13:41:00 GMT 1999
Sorry to be so long in looking at this. I have a question and a comment.
Question: Does the use of separate lists for -D. -U, etc change the order in
which they are processed? Hopefully not.
Comment: I think you need to be more specific in the ChangeLog when you say
"fix memory leaks and streamline code". Which functions did you fix leaks in?
Which functions and/or declarations did you move/delete/create when
streamlining the code?
Dave
Zack Weinberg wrote:
> This patch overhauls the initialization code for cpplib. Several bugs
> are fixed, the important one being that system-header-ness wasn't kept
> track of properly, causing many regressions in the C++ testsuite. It
> should be faster (the difference isn't significant) and it shouldn't
> leak memory anymore.
>
> Note to the warnings police: If a function is documented to modify
> its string argument in place, don't change it to make a copy and
> modify that.
>
> Tested to bootstrap successfully on x86, no additional regressions.
> With a patch for the testsuite (see other post), it fixes many
> regressions in g++.old-deja.
>
> zw
>
> 1999-02-26 09:18 -0500 Zack Weinberg <zack@rabi.columbia.edu>
>
> * 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. Bring over `base_name' function from cccp.c.
> If opts->verbose, print details on directories dropped from the
> include path. Fix several memory leaks and streamline code.
> (nreverse_pending, push_pending): Removed.
> (path_include): Can now add to any partial include path.
> (append_include_chain): Brought over from cppfiles.c. Mark
> dirs as system include dirs if and only if appending to
> system include path.
> (cpp_options_init): Allocate the pending block.
> (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.
> (cpp_handle_option): Add --version. Exit after --help.
>
> * cppfiles.c (simplify_pathname): Export.
> (merge_include_chains): Don't nreverse the lists. If
> opts->verbose, print details on dirs 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 "".
>
> * cpplib.c (cpp_unassert): New function.
> * cpplib.h: Lay out struct cpp_pending here. Adjust
> prototypes.
More information about the Gcc-patches
mailing list