on master help sign in
Mangle unicode identifiers in C backend

Unlike clang, GCC doesn't support unicode identifiers. Also set the charset to utf8, not needed for thiis but found while reproducing the issue. Fixes #4698

commit1891190d97be2328027ae4380211f243d80df8cd authorNiklas Larsson <metaniklas@gmail.com> dateTue 7 May 2019, 18:38 (7 years ago) parent62bd431
1 file changed+2−1
src/IRTS/CodegenC.hs+2−1
src/IRTS/CodegenC.hs+2−1
@@ -72,6 +72,7 @@ codegenC' defs out exec incs objs libs flags exports iface dbg
7272 Raw -> writeSource out cout
7373 _ -> do
7474 (tmpn, tmph) <- tempfile ".c"
75+ hSetEncoding tmph utf8
7576 hPutStr tmph cout
7677 hFlush tmph
7778 hClose tmph
@@ -121,7 +122,7 @@ gccDbg _ = []
121122
122123cname :: Name -> String
123124cname n = "_idris_" ++ concatMap cchar (showCG n)
124− where cchar x | isAlpha x || isDigit x = [x]
125+ where cchar x | isAscii x && isAlpha x || isDigit x = [x]
125126 | otherwise = "_" ++ show (fromEnum x) ++ "_"
126127
127128indent :: Int -> String