titan-lang / titan

The Titan programming language
http://titan-lang.org
MIT License
406 stars 13 forks source link

fix header parser for OS X #244

Closed mascarenhas closed 6 years ago

mascarenhas commented 6 years ago

OS X system headers have a bunch of custom attributes that do not mimic exactly the syntax of GCC attributes in the Linux headers, so make the parser more permissive to get around that (the parser ignores attributes anyway).

One of the OS X headers also uses #include "..." expecting the include file to be found in the same search path as the regular #include <...>, we work around that (probably not in the best way).

Finally, one of the OS X system headers has a function that takes a block, we now accept that and treat it just as a regular function pointer.

hishamhm commented 6 years ago

Great, thanks for digging this stuff! I adjusted the indentation level in some blocks and added a comment about the system-include location path in case we need to remember this in the future.