/* CPP Library - lexical analysis.
- Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include "config.h"
#include "system.h"
if (buffer->notes_used == buffer->notes_cap)
{
buffer->notes_cap = buffer->notes_cap * 2 + 200;
- buffer->notes = xrealloc (buffer->notes,
- buffer->notes_cap * sizeof (_cpp_line_note));
+ buffer->notes = XRESIZEVEC (_cpp_line_note, buffer->notes,
+ buffer->notes_cap);
}
buffer->notes[buffer->notes_used].pos = pos;
{
/* Make sure that the token is printed using UCNs, even
if we'd otherwise happily print UTF-8. */
- unsigned char *buf = xmalloc (cpp_token_len (token));
+ unsigned char *buf = XNEWVEC (unsigned char, cpp_token_len (token));
size_t sz;
sz = cpp_spell_token (pfile, token, buf, false) - buf;
if (NORMALIZE_STATE_RESULT (s) == normalized_C)
cpp_error_with_line (pfile, CPP_DL_WARNING, token->src_loc, 0,
- "`%.*s' is not in NFKC", sz, buf);
+ "`%.*s' is not in NFKC", (int) sz, buf);
else
cpp_error_with_line (pfile, CPP_DL_WARNING, token->src_loc, 0,
- "`%.*s' is not in NFC", sz, buf);
+ "`%.*s' is not in NFC", (int) sz, buf);
}
}
}
/* Is this a syntactically valid UCN? */
- if (*buffer->cur == '\\'
+ if (CPP_OPTION (pfile, extended_identifiers)
+ && *buffer->cur == '\\'
&& (buffer->cur[1] == 'u' || buffer->cur[1] == 'U'))
{
buffer->cur += 2;
/* 6.10.3 p 11: Directives in a list of macro arguments
gives undefined behavior. This implementation
handles the directive as normal. */
- && pfile->state.parsing_args != 1
- && _cpp_handle_directive (pfile, result->flags & PREV_WHITE))
+ && pfile->state.parsing_args != 1)
{
- if (pfile->directive_result.type == CPP_PADDING)
- continue;
- else
+ if (_cpp_handle_directive (pfile, result->flags & PREV_WHITE))
{
+ if (pfile->directive_result.type == CPP_PADDING)
+ continue;
result = &pfile->directive_result;
- break;
}
}
+ else if (pfile->state.in_deferred_pragma)
+ result = &pfile->directive_result;
if (pfile->cb.line_change && !pfile->state.skipping)
pfile->cb.line_change (pfile, result, pfile->state.parsing_args);
}
/* We don't skip tokens in directives. */
- if (pfile->state.in_directive)
+ if (pfile->state.in_directive || pfile->state.in_deferred_pragma)
break;
/* Outside a directive, invalidate controlling macros. At file
buffer = pfile->buffer;
if (buffer->need_line)
{
+ if (pfile->state.in_deferred_pragma)
+ {
+ result->type = CPP_PRAGMA_EOL;
+ pfile->state.in_deferred_pragma = false;
+ if (!pfile->state.pragma_allow_expansion)
+ pfile->state.prevent_expansion--;
+ return result;
+ }
if (!_cpp_get_fresh_line (pfile))
{
result->type = CPP_EOF;
if (result->val.node->flags & NODE_OPERATOR)
{
result->flags |= NAMED_OP;
- result->type = result->val.node->directive_index;
+ result->type = (enum cpp_ttype) result->val.node->directive_index;
}
break;
len = MIN_BUFF_SIZE;
len = CPP_ALIGN (len);
- base = xmalloc (len + sizeof (_cpp_buff));
+ base = XNEWVEC (unsigned char, len + sizeof (_cpp_buff));
result = (_cpp_buff *) (base + len);
result->base = base;
result->cur = base;
else if (tok->type == CPP_PADDING)
return CPP_TOKEN_FLD_SOURCE;
else if (tok->type == CPP_PRAGMA)
- return CPP_TOKEN_FLD_STR;
+ return CPP_TOKEN_FLD_PRAGMA;
/* else fall through */
default:
return CPP_TOKEN_FLD_NONE;