summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-10 16:40:49 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-07-10 16:40:49 +0000
commitbd285415ef93f51034428c1c2606f100c7887fa5 (patch)
tree0fc3c50dd67f106705eddd814b4b2176bee125ff /libcpp
parentcde06e71cf4b6bf620838e686aceee99252a2746 (diff)
downloadgcc-bd285415ef93f51034428c1c2606f100c7887fa5.tar.gz
PR preprocessor/57757
* lex.c (cpp_avoid_paste): Avoid pasting CPP_{,W,UTF8}STRING or CPP_STRING{16,32} with CPP_NAME or SPELL_LITERAL token that starts if a-zA-Z_. * g++.dg/cpp/paste1.C: New test. * g++.dg/cpp/paste2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200875 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog7
-rw-r--r--libcpp/lex.c9
2 files changed, 16 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 0cf9100cf62..d0c583d8691 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,10 @@
+2013-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/57757
+ * lex.c (cpp_avoid_paste): Avoid pasting CPP_{,W,UTF8}STRING
+ or CPP_STRING{16,32} with CPP_NAME or SPELL_LITERAL token that
+ starts if a-zA-Z_.
+
2013-06-28 Ed Smith-Rowland <3dw4rd@verizon.net>
* lex.c (lex_raw_string(), lex_string()): Constrain suffixes treated
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 022d31016e2..dc7b9c17ddc 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -2767,6 +2767,15 @@ cpp_avoid_paste (cpp_reader *pfile, const cpp_token *token1,
|| (CPP_OPTION (pfile, objc)
&& token1->val.str.text[0] == '@'
&& (b == CPP_NAME || b == CPP_STRING)));
+ case CPP_STRING:
+ case CPP_WSTRING:
+ case CPP_UTF8STRING:
+ case CPP_STRING16:
+ case CPP_STRING32: return (CPP_OPTION (pfile, user_literals)
+ && (b == CPP_NAME
+ || (TOKEN_SPELL (token2) == SPELL_LITERAL
+ && ISIDST (token2->val.str.text[0]))));
+
default: break;
}