
On Sun, 2004-05-16 at 02:24, Jens Petersen wrote:
Hi,
I have a problem when processing "vte/vte.h" (from vte-0.11.10) with c2hs-0.12.0 and glibc-2.3.3:
/usr/include/sys/sysmacros.h:43: (column 1) [FATAL]
Syntax error! The symbol `{' does not fit here.
A temporary solution is to pass -C-D_SYS_SYSMACROS_H to c2hs so that cpp will not include the file and so c2hs will not see it. Another problem that I found when trying to run c2hs with vte/vte.h is that this header file contains an #ident directive. I've never seen this before, no other header files on my system have this. It seems to be used for rcs/cvs id info. The annoying thing is that cpp seems to pass it straight through and so c2hs chokes on it. Here's a patch to make c2hs ignore it. It's a diff from the gtk2hs fork so may not apply cleanly to Manuel's main branch but it's a fairly simple change. It follows what c2hs already does with #pragma directives. diff -C2 -r1.3 CLexer.hs *** c/CLexer.hs 3 Nov 2003 14:14:39 -0000 1.3 --- c/CLexer.hs 24 Jul 2004 20:25:52 -0000 *************** *** 46,50 **** -- `__const__', `__inline', `__inline__', `__restrict', and `__restrict__'. -- ! -- * Any line starting with `#pragma' is ignored. -- -- With K&R we refer to ``The C Programming Language'', second edition, Brain --- 46,50 ---- -- `__const__', `__inline', `__inline__', `__restrict', and `__restrict__'. -- ! -- * Any line starting with `#pragma' or '#ident' is ignored. -- -- With K&R we refer to ``The C Programming Language'', second edition, Brain *************** *** 444,447 **** --- 444,448 ---- >||< linedir >||< pragma + >||< rcsId -- whitespace (follows K&R A2.1) *************** *** 494,497 **** --- 495,511 ---- ppwhite = (char ' ' >|< char '\t')`star` epsilon + -- #ident directive + -- + -- * gcc's cpp seems to recognise this directive and it passes it through + -- to us. It seems to be used for cvs/rcs info. We simply ignore it (but + -- take care to update the position information) + -- + rcsId :: CLexer + rcsId = char '#' +> ppwhite +> string "ident" +> anyButNL`star` char '\n' + `lexmeta` \_ pos ns -> (Nothing, retPos pos, ns, Nothing) + where + ppwhite = (char ' ' >|< char '\t')`star` epsilon + + -- identifiers and keywords (follows K&R A2.3 and A2.4) -- Duncan