diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-01-14 22:00:20 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-01-14 22:00:20 +0000 |
commit | 400023a387aff2324ad72d965bfbf1a3afd2bfea (patch) | |
tree | 50cf96bbdb5a327d25f89c6505861b5c2d979351 /gcc | |
parent | 984ad2c6332bdf6fb4ce651345b20f1473aff23a (diff) | |
download | gcc-400023a387aff2324ad72d965bfbf1a3afd2bfea.zip gcc-400023a387aff2324ad72d965bfbf1a3afd2bfea.tar.gz gcc-400023a387aff2324ad72d965bfbf1a3afd2bfea.tar.bz2 |
c-parse.in (finish_parse): Add comment about cpp_destroy.
* c-parse.in (finish_parse): Add comment about cpp_destroy.
* cp/lex.c (finish_parse): Similarly.
* cppinit.c (cpp_cleanup): Rename cpp_destroy for clarity.
Return the number of errors encountered.
* cpplib.h (cpp_cleanup): Rename cpp_destroy, return int.
* cppmain.c (main): Don't call cpp_destroy.
From-SVN: r39020
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/c-parse.in | 1 | ||||
-rw-r--r-- | gcc/cp/lex.c | 1 | ||||
-rw-r--r-- | gcc/cppinit.c | 14 | ||||
-rw-r--r-- | gcc/cpplib.h | 5 | ||||
-rw-r--r-- | gcc/cppmain.c | 4 |
6 files changed, 26 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e7b0bb64b..7e81eee3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2001-01-14 Neil Booth <neil@daikokuya.demon.co.uk> + + * c-parse.in (finish_parse): Add comment about cpp_destroy. + * cp/lex.c (finish_parse): Similarly. + * cppinit.c (cpp_cleanup): Rename cpp_destroy for clarity. + Return the number of errors encountered. + * cpplib.h (cpp_cleanup): Rename cpp_destroy, return int. + * cppmain.c (main): Don't call cpp_destroy. + 2001-01-14 Joseph S. Myers <jsm28@cam.ac.uk> * configure.in: Require at least perl 5.6.0 to regenerate diff --git a/gcc/c-parse.in b/gcc/c-parse.in index daff75f..30f2551 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -3161,6 +3161,7 @@ void finish_parse () { cpp_finish (parse_in); + /* Call to cpp_destroy () omitted for performance reasons. */ errorcount += cpp_errors (parse_in); } diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index c8d6587..c19d784 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -755,6 +755,7 @@ void finish_parse () { cpp_finish (parse_in); + /* Call to cpp_destroy () omitted for performance reasons. */ errorcount += cpp_errors (parse_in); } diff --git a/gcc/cppinit.c b/gcc/cppinit.c index c3347c9..9250f08 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -557,12 +557,13 @@ cpp_create_reader (lang) return pfile; } -/* Free resources used by PFILE. - This is the cpp_reader 'finalizer' or 'destructor' (in C++ terminology). */ -void -cpp_cleanup (pfile) +/* Free resources used by PFILE. Accessing PFILE after this function + returns leads to undefined behaviour. */ +int +cpp_destroy (pfile) cpp_reader *pfile; { + int result; struct file_name_list *dir, *dirn; cpp_context *context, *contextn; @@ -600,6 +601,11 @@ cpp_cleanup (pfile) contextn = context->next; free (context); } + + result = pfile->errors; + free (pfile); + + return result; } diff --git a/gcc/cpplib.h b/gcc/cpplib.h index e332a27..c109a0f 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -494,6 +494,10 @@ struct cpp_hashnode /* Call this first to get a handle to pass to other functions. */ extern cpp_reader *cpp_create_reader PARAMS ((enum c_lang)); +/* Call this to release the handle. Any use of the handle after this + function returns is invalid. Returns cpp_errors (pfile). */ +extern int cpp_destroy PARAMS ((cpp_reader *)); + /* Call these to get pointers to the options and callback structures for a given reader. These pointers are good until you call cpp_finish on that reader. You can either edit the callbacks @@ -529,7 +533,6 @@ extern void cpp_register_pragma_space PARAMS ((cpp_reader *, const char *)); extern int cpp_start_read PARAMS ((cpp_reader *, const char *)); extern void cpp_finish PARAMS ((cpp_reader *)); -extern void cpp_cleanup PARAMS ((cpp_reader *)); extern int cpp_avoid_paste PARAMS ((cpp_reader *, const cpp_token *, const cpp_token *)); extern enum cpp_ttype cpp_can_paste PARAMS ((cpp_reader *, const cpp_token *, diff --git a/gcc/cppmain.c b/gcc/cppmain.c index c69e9fa..61f4874 100644 --- a/gcc/cppmain.c +++ b/gcc/cppmain.c @@ -79,9 +79,7 @@ main (argc, argv) do_preprocessing (argc, argv); - /* Reader destructor. */ - cpp_cleanup (pfile); - + /* Call to cpp_destroy () omitted for performance reasons. */ if (cpp_errors (pfile)) return FATAL_EXIT_CODE; |