summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog9
-rw-r--r--libcpp/directives.c5
-rw-r--r--libcpp/macro.c4
3 files changed, 14 insertions, 4 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 2dc1190146c..7365c4e7beb 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,12 @@
+2012-05-02 Dodji Seketeli <dodji@redhat.com>
+
+ Properly initialize cpp_context in destringize_and_run
+ * directives.c (destringize_and_run): Properly initialize the new
+ context.
+ * macro.c (_cpp_pop_context): Assert that we shouldn't try to pop
+ the initial base context, which has the same life time as the
+ current instance of cpp_file.
+
2012-04-30 Manuel López-Ibáñez <manu@gcc.gnu.org>
Dodji Seketeli <dodji@seketeli.org>
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 0510c6e3a8e..e46280e46b0 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -1741,10 +1741,7 @@ destringize_and_run (cpp_reader *pfile, const cpp_string *in)
saved_cur_token = pfile->cur_token;
saved_cur_run = pfile->cur_run;
- pfile->context = XNEW (cpp_context);
- pfile->context->c.macro = 0;
- pfile->context->prev = 0;
- pfile->context->next = 0;
+ pfile->context = XCNEW (cpp_context);
/* Inline run_directive, since we need to delay the _cpp_pop_buffer
until we've read all of the tokens that we want. */
diff --git a/libcpp/macro.c b/libcpp/macro.c
index ab3e8f641dc..c4e2a23c56b 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -2152,6 +2152,10 @@ _cpp_pop_context (cpp_reader *pfile)
{
cpp_context *context = pfile->context;
+ /* We should not be popping the base context. */
+ if (context == &pfile->base_context)
+ abort ();
+
if (context->c.macro)
{
cpp_hashnode *macro;