]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - lexer.c
handling TOKEN_CHARCONST - -Wmultibyte-character
[xonotic/gmqcc.git] / lexer.c
diff --git a/lexer.c b/lexer.c
index 065f60c2dc129cac8a4da4d9ff5ae3ff5eb54e79..6bd47b065eb3f96220c65417e98fab3c4fa7beb2 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -1290,6 +1290,14 @@ int lex_do(lex_file *lex)
         {
              lex->tok.ttype = TOKEN_VECTORCONST;
         }
+        else
+        {
+            if (!lex->flags.preprocessing && strlen(lex->tok.value) > 1) {
+                if (lexwarn(lex, WARN_MULTIBYTE_CHARACTER, "multibyte character: `%s`", lex->tok.value))
+                    return (lex->tok.ttype = TOKEN_ERROR);
+            }
+            lex->tok.constval.i = lex->tok.value[0];
+        }
 
         return lex->tok.ttype;
     }