aboutsummaryrefslogtreecommitdiff
path: root/libcpp/macro.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r--libcpp/macro.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 729ea06..7718334 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -109,10 +109,8 @@ static const char * const monthnames[] =
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
-/* Handle builtin macros like __FILE__, and push the resulting token
- on the context stack. Also handles _Pragma, for which no new token
- is created. Returns 1 if it generates a new token context, 0 to
- return the token to the caller. */
+/* Helper function for builtin_macro. Returns the text generated by
+ a builtin macro. */
const uchar *
_cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
{
@@ -245,8 +243,8 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
}
/* Convert builtin macros like __FILE__ to a token and push it on the
- context stack. Also handles _Pragma, for which no new token is
- created. Returns 1 if it generates a new token context, 0 to
+ context stack. Also handles _Pragma, for which a new token may not
+ be created. Returns 1 if it generates a new token context, 0 to
return the token to the caller. */
static int
builtin_macro (cpp_reader *pfile, cpp_hashnode *node)
@@ -263,6 +261,13 @@ builtin_macro (cpp_reader *pfile, cpp_hashnode *node)
return 0;
_cpp_do__Pragma (pfile);
+ if (pfile->directive_result.type == CPP_PRAGMA)
+ {
+ cpp_token *tok = _cpp_temp_token (pfile);
+ *tok = pfile->directive_result;
+ push_token_context (pfile, NULL, tok, 1);
+ }
+
return 1;
}