aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Lex/Lexer.cpp3
-rw-r--r--test/Lexer/c90.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index 91c4f66403..3e3aaae5f5 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -2710,7 +2710,8 @@ uint32_t Lexer::tryReadUCN(const char *&StartPtr, const char *SlashLoc,
return 0;
if (!LangOpts.CPlusPlus && !LangOpts.C99) {
- Diag(SlashLoc, diag::warn_ucn_not_valid_in_c89);
+ if (Result && !isLexingRawMode())
+ Diag(SlashLoc, diag::warn_ucn_not_valid_in_c89);
return 0;
}
diff --git a/test/Lexer/c90.c b/test/Lexer/c90.c
index 826d910b29..649173d71d 100644
--- a/test/Lexer/c90.c
+++ b/test/Lexer/c90.c
@@ -41,3 +41,6 @@ int test4() {
}
#define MY_UCN \u00FC // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}}
+#define NOT_A_UCN \h // no-warning
+
+extern int idWithUCN\u00FC; // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}} expected-error {{expected ';'}}