Accept any non-space characters in a header file (#3624)
authorSimon Marlow <marlowsd@gmail.com>
Fri, 6 Nov 2009 10:23:19 +0000 (10:23 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Fri, 6 Nov 2009 10:23:19 +0000 (10:23 +0000)
The FFI spec doesn't say exactly which characters may occur in a
header file, so to be on the safe side we'll accept anything that
isn't a space.

compiler/parser/RdrHsSyn.lhs

index c785c22..5b7269a 100644 (file)
@@ -1012,7 +1012,9 @@ parseCImport cconv safety nm str =
 
    mk = CImport cconv safety
 
-   hdr_char c = isAscii c && (isAlphaNum c || c `elem` "._-")
+   hdr_char c = not (isSpace c) -- header files are filenames, which can contain
+                                -- pretty much any char (depending on the platform),
+                                -- so just accept any non-space character
    id_char  c = isAlphaNum c || c == '_'
 
    cimp nm = (ReadP.char '&' >> skipSpaces >> CLabel <$> cid)