aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-07-05 05:33:57 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-07-05 05:33:57 +0000
commitc71f835b2549f6b787732b5e326c5c23dbb1f66b (patch)
tree0faabdcd2aa742b82e58d484b96722dd2b861e6e /gcc/cppinit.c
parent1bbee75bcc0d3948fb1e55da6a3547cddeb000a0 (diff)
downloadgcc-c71f835b2549f6b787732b5e326c5c23dbb1f66b.zip
gcc-c71f835b2549f6b787732b5e326c5c23dbb1f66b.tar.gz
gcc-c71f835b2549f6b787732b5e326c5c23dbb1f66b.tar.bz2
cpplex.c: Don't include sys/mman.h.
toplevel: * cpplex.c: Don't include sys/mman.h. (cpp_push_buffer, cpp_pop_buffer): Moved to cpplib.c. * cpplib.c: Include sys/mman.h and obstack.h. (cpp_push_buffer): Moved from cpplex.c; allocate buffers on an obstack. (cpp_pop_buffer): Moved from cpplex.c; free buffers from an obstack. (_cpp_unwind_if_stack): Now static, unwind_if_stack. Don't bother freeing if stack entries (they will be freed with their buffer). (do_endif): Free if stack entries from the buffer obstack. (push_conditional): Allocate if stack entries from the buffer obstack. (find_answer): Rename to _cpp_find_answer. (do_assert, do_unassert): Update. * cpphash.h: Update prototypes. (xobnew): New convenience macro. * cpplib.h (struct cpp_reader): Add hash_ob and buffer_ob fields. Update comments. (struct cpp_hashnode): Remove disabled field. * cppinit.c: Don't include hashtab.h or splay-tree.h. (report_missing_guard): Moved to cppfiles.c. (cpp_reader_init): Call cpp_init_stacks, cpp_init_macros, cpp_init_includes. (cpp_cleanup): Call cpp_cleanup_stacks, cpp_cleanup_macros, cpp_cleanup_includes. Don't destroy hashtab or all_include_files here. (cpp_finish): Use _cpp_report_missing_guards. * cppfiles.c (report_missing_guard): Moved from cppinit.c. (_cpp_init_include_table): Rename _cpp_init_includes. (_cpp_cleanup_includes, _cpp_report_missing_guards): New. * cppexp.c (parse_assertion): Update for new name of find_answer. * Makefile.in (cpplib.o, cpphash.o, cppinit.o): Update deps. * cpplib.c (do_ident): s/VSPACE/EOF/ testsuite: * gcc.dg/cpp/ident.c: New test. From-SVN: r34870
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c40
1 files changed, 7 insertions, 33 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index f50bcc1f..c60db8b 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -21,8 +21,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
-#include "hashtab.h"
-#include "splay-tree.h"
#include "cpplib.h"
#include "cpphash.h"
#include "output.h"
@@ -225,7 +223,6 @@ static int opt_comp PARAMS ((const void *, const void *));
#endif
static int parse_option PARAMS ((const char *));
static int handle_option PARAMS ((cpp_reader *, int, char **));
-static int report_missing_guard PARAMS ((splay_tree_node, void *));
/* Fourth argument to append_include_chain: chain to use */
enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
@@ -533,8 +530,9 @@ cpp_reader_init (pfile)
CPP_OPTION (pfile, pending) =
(struct cpp_pending *) xcalloc (1, sizeof (struct cpp_pending));
- _cpp_init_macro_hash (pfile);
- _cpp_init_include_table (pfile);
+ _cpp_init_stacks (pfile);
+ _cpp_init_macros (pfile);
+ _cpp_init_includes (pfile);
}
/* Initialize a cpp_printer structure. As a side effect, open the
@@ -580,8 +578,9 @@ cpp_cleanup (pfile)
if (pfile->deps)
deps_free (pfile->deps);
- htab_delete (pfile->hashtab);
- splay_tree_delete (pfile->all_include_files);
+ _cpp_cleanup_stacks (pfile);
+ _cpp_cleanup_macros (pfile);
+ _cpp_cleanup_includes (pfile);
_cpp_free_temp_tokens (pfile);
}
@@ -1009,27 +1008,6 @@ cpp_start_read (pfile, print, fname)
return 1;
}
-static int
-report_missing_guard (n, b)
- splay_tree_node n;
- void *b;
-{
- struct include_file *f = (struct include_file *) n->value;
- int *bannerp = (int *)b;
-
- if (f && f->cmacro == 0 && f->include_count == 1)
- {
- if (*bannerp == 0)
- {
- fputs (_("Multiple include guards may be useful for:\n"), stderr);
- *bannerp = 1;
- }
- fputs (f->name, stderr);
- putc ('\n', stderr);
- }
- return 0;
-}
-
/* This is called at the end of preprocessing. It pops the
last buffer and writes dependency output. It should also
clear macro definitions, such that you could call cpp_start_read
@@ -1085,11 +1063,7 @@ cpp_finish (pfile, print)
/* Report on headers that could use multiple include guards. */
if (CPP_OPTION (pfile, print_include_names))
- {
- int banner = 0;
- splay_tree_foreach (pfile->all_include_files, report_missing_guard,
- (void *) &banner);
- }
+ _cpp_report_missing_guards (pfile);
}
static void