summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-27 17:29:29 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-27 17:29:29 +0000
commita095c1b560cd722cac898454150f94c438e7ef4c (patch)
tree8688154b1cf993240030405dd70e878caba25ee8 /libcpp
parent16d1038ecfe2e30bd34c35ec707ae368d61a8315 (diff)
downloadgcc-a095c1b560cd722cac898454150f94c438e7ef4c.tar.gz
PR 18075
* directives.c (do_pragma): Do not defer pragmas which are unknown. (cpp_handle_deferred_pragma): Add cast to silence warning. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89693 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog6
-rw-r--r--libcpp/directives.c66
2 files changed, 41 insertions, 31 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 77f1dc08b80..48f65270ac9 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,9 @@
+2004-10-27 Zack Weinberg <zack@codesourcery.com>
+
+ PR 18075
+ * directives.c (do_pragma): Do not defer pragmas which are unknown.
+ (cpp_handle_deferred_pragma): Add cast to silence warning.
+
2004-10-14 Joseph S. Myers <jsm@polyomino.org.uk>
* errors.c (_cpp_begin_message): Print "error: " for errors.
diff --git a/libcpp/directives.c b/libcpp/directives.c
index b60b7bca800..10d080bee44 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -1167,37 +1167,41 @@ do_pragma (cpp_reader *pfile)
}
}
- if (p && (p->is_internal || !CPP_OPTION (pfile, defer_pragmas)))
- {
- /* Since the handler below doesn't get the line number, that it
- might need for diagnostics, make sure it has the right
- numbers in place. */
- if (pfile->cb.line_change)
- (*pfile->cb.line_change) (pfile, pragma_token, false);
- (*p->u.handler) (pfile);
- }
- else if (CPP_OPTION (pfile, defer_pragmas))
+ if (p)
{
- /* Squirrel away the pragma text. Pragmas are newline-terminated. */
- const uchar *line_end;
- uchar *s;
- cpp_string body;
- cpp_token *ptok;
-
- line_end = ustrchr (line_start, '\n');
-
- body.len = (line_end - line_start) + 1;
- s = _cpp_unaligned_alloc (pfile, body.len + 1);
- memcpy (s, line_start, body.len);
- s[body.len] = '\0';
- body.text = s;
-
- /* Create a CPP_PRAGMA token. */
- ptok = &pfile->directive_result;
- ptok->src_loc = pragma_token->src_loc;
- ptok->type = CPP_PRAGMA;
- ptok->flags = pragma_token->flags | NO_EXPAND;
- ptok->val.str = body;
+ if (p->is_internal || !CPP_OPTION (pfile, defer_pragmas))
+ {
+ /* Since the handler below doesn't get the line number, that it
+ might need for diagnostics, make sure it has the right
+ numbers in place. */
+ if (pfile->cb.line_change)
+ (*pfile->cb.line_change) (pfile, pragma_token, false);
+ (*p->u.handler) (pfile);
+ }
+ else
+ {
+ /* Squirrel away the pragma text. Pragmas are
+ newline-terminated. */
+ const uchar *line_end;
+ uchar *s;
+ cpp_string body;
+ cpp_token *ptok;
+
+ line_end = ustrchr (line_start, '\n');
+
+ body.len = (line_end - line_start) + 1;
+ s = _cpp_unaligned_alloc (pfile, body.len + 1);
+ memcpy (s, line_start, body.len);
+ s[body.len] = '\0';
+ body.text = s;
+
+ /* Create a CPP_PRAGMA token. */
+ ptok = &pfile->directive_result;
+ ptok->src_loc = pragma_token->src_loc;
+ ptok->type = CPP_PRAGMA;
+ ptok->flags = pragma_token->flags | NO_EXPAND;
+ ptok->val.str = body;
+ }
}
else if (pfile->cb.def_pragma)
{
@@ -1428,7 +1432,7 @@ cpp_handle_deferred_pragma (cpp_reader *pfile, const cpp_string *s)
pfile->cb.line_change = NULL;
CPP_OPTION (pfile, defer_pragmas) = false;
- run_directive (pfile, T_PRAGMA, s->text, s->len);
+ run_directive (pfile, T_PRAGMA, (const char *)s->text, s->len);
XDELETE (pfile->context);
pfile->context = saved_context;