aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Lexer.mll
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2014-09-21 10:35:22 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2014-09-21 10:35:22 +0200
commit55d08b039b9683eedd89e2dee17bc2a347057633 (patch)
tree165694754c9e32e912af0268a58ee28f461cdf33 /cparser/Lexer.mll
parent4414aaa31fe17d0e6bed88e708e134b7d4c09334 (diff)
downloadcompcert-kvx-55d08b039b9683eedd89e2dee17bc2a347057633.tar.gz
compcert-kvx-55d08b039b9683eedd89e2dee17bc2a347057633.zip
Error instead of warning on illegal escape sequences.
The previous behavior for illegal escape sequences (e.g. '\%') in character and string literals was to emit an error, then treat "\x" as "x". As reported by a user, this is dangerous, because the warning can go unnoticed, and other compilers can treat "\x" as "\\x" (backslash followed by 'x'). Better to error out.
Diffstat (limited to 'cparser/Lexer.mll')
-rw-r--r--cparser/Lexer.mll2
1 files changed, 1 insertions, 1 deletions
diff --git a/cparser/Lexer.mll b/cparser/Lexer.mll
index 276aead2..53a27d81 100644
--- a/cparser/Lexer.mll
+++ b/cparser/Lexer.mll
@@ -356,7 +356,7 @@ and char = parse
| simple_escape_sequence
{ convert_escape c }
| '\\' (_ as c)
- { warning lexbuf "incorrect escape sequence '\\%c', treating as '%c'" c c;
+ { error lexbuf "incorrect escape sequence '\\%c'" c;
Int64.of_int (Char.code c) }
| _ as c
{ Int64.of_int (Char.code c) }