forked from cartazio/language-c
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse errors when parsing macOS system headers #85
Comments
I'd happily merge a PR implementing support for these (afaict it's just an
alternative to '*' on the syntax).
At the least this could be mentioned in the readme.
Is there some CPP directive you can use to disable these bits perhaps?
…On Wed, 6 Oct 2021, 3:49 am David Young, ***@***.***> wrote:
I have recently noticed the issues in the title. There seem to be some
syntax extensions involved which language-c does not appear to currently
support.
A small example:
Contents of test.c:
#include <dirent.h>
Contents of Test.hs:
{-# LANGUAGE LambdaCase #-}
import Language.C
import Language.C.System.Preprocess
import Language.C.System.GCC
main :: IO ()
main = do
let gcc = newGCC "/usr/bin/gcc"
fileName = "test.c"
runPreprocessor gcc (cppFile fileName) >>= \case
Left err -> putStrLn ("Preprocessor error: " ++ show err)
Right preprocessed ->
case parseC preprocessed (initPos fileName) of
Left err -> putStrLn ("Parse error: " ++ show err)
Right _ -> putStrLn "Success"
This produces the following:
Parse error: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/dirent.h:159: (column 10) [ERROR] >>> Syntax Error !
Syntax error !
The symbol `^' does not fit here.
The relevant line, and surrounding lines, in that header are these:
int scandir_b(const char *, struct dirent ***,
int (^)(const struct dirent *) __scandir_noescape, // **** This is line 159 *****
int (^)(const struct dirent **, const struct dirent **) __scandir_noescape)
__DARWIN_INODE64(scandir_b) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
I think this syntax extension is for blocks
<https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Blocks/Articles/00_Introduction.html>,
but I haven't used that feature before.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#85>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGRJXCM7HKWZ2V3ZCYDZJDUFNJDZANCNFSM5FMPE3QA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have recently noticed the issues in the title. There seem to be some syntax extensions involved which
language-c
does not appear to currently support.A small example:
Contents of
test.c
:Contents of
Test.hs
:Executing
runghc Test.hs
in the same directory astest.c
produces the following:The relevant line, and surrounding lines, in that header are these:
I think this syntax extension is for blocks, but I haven't used that feature before.
The text was updated successfully, but these errors were encountered: