View | Details | Raw Unified | Return to bug 18462 | Differences between
and this patch

Collapse All | Expand All

(-)a/parse.cxx (-3 / +26 lines)
Lines 121-126 private: Link Here
121
  vector<pp1_activation*> pp1_state;
121
  vector<pp1_activation*> pp1_state;
122
  const token* next_pp1 ();
122
  const token* next_pp1 ();
123
  const token* scan_pp1 ();
123
  const token* scan_pp1 ();
124
  const token* scan_pp1_temp ();
124
  const token* slurp_pp1_param (vector<const token*>& param);
125
  const token* slurp_pp1_param (vector<const token*>& param);
125
  const token* slurp_pp1_body (vector<const token*>& body);
126
  const token* slurp_pp1_body (vector<const token*>& body);
126
127
Lines 425-430 parser::next_pp1 () Link Here
425
}
426
}
426
427
427
const token*
428
const token*
429
parser::scan_pp1_temp ()
430
{
431
  while (true)
432
    {
433
      const token* t = next_pp1 ();
434
      if (t == 0) // EOF or end of macro body
435
        {
436
          if (pp1_state.empty()) // actual EOF
437
            return 0;
438
439
          // Exit macro and loop around to look for the next token.
440
          pp1_activation* act = pp1_state.back();
441
          pp1_state.pop_back(); delete act;
442
          continue;
443
        }
444
445
      // Otherwise, we have an ordinary token.
446
      return t;
447
    }
448
}
449
450
const token*
428
parser::scan_pp1 ()
451
parser::scan_pp1 ()
429
{
452
{
430
  while (true)
453
  while (true)
Lines 718-724 parser::parse_library_macros () Link Here
718
741
719
  try
742
  try
720
    {
743
    {
721
      const token* t = scan_pp1 ();
744
      const token* t = scan_pp ();
722
745
723
      // Currently we only take objection to macro invocations if they
746
      // Currently we only take objection to macro invocations if they
724
      // produce a non-whitespace token after being expanded.
747
      // produce a non-whitespace token after being expanded.
Lines 726-732 parser::parse_library_macros () Link Here
726
      // XXX should we prevent macro invocations even if they expand to empty??
749
      // XXX should we prevent macro invocations even if they expand to empty??
727
750
728
      if (t != 0)
751
      if (t != 0)
729
        throw PARSE_ERROR (_F("library macro file '%s' contains non-@define construct", input_name.c_str()), t);
752
        throw PARSE_ERROR (_F("XXX library macro file '%s' contains non-@define construct", input_name.c_str()), t);
730
753
731
      // We need to first check whether *any* of the macros are duplicates,
754
      // We need to first check whether *any* of the macros are duplicates,
732
      // then commit to including the entire file in the global namespace
755
      // then commit to including the entire file in the global namespace
Lines 1149-1155 parser::skip_pp () Link Here
1149
    {
1172
    {
1150
      try
1173
      try
1151
        {
1174
        {
1152
          t = scan_pp1 ();
1175
          t = scan_pp1_temp ();
1153
        }
1176
        }
1154
      catch (const parse_error &e)
1177
      catch (const parse_error &e)
1155
        {
1178
        {

Return to bug 18462