[C2hs] GNU C __attribute__ lists
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Wed Jan 12 12:39:30 EST 2005
All,
I noticed that the latest version of glib includes a liberal sprinkling
of G_GNUC_MALLOC macros which expands to __attribute__((__malloc__))
Some functions already had an __attribute__, so now they've got a list
of them. It seems that c2hs does not expect more than one __attribute__.
So here's a patch
In CParsers.hs we just change each instance of
optMaybe parseGnuCAttr
to
list parseGnuCAttr
This patch is against the gtk2hs cvs version but it should apply ok to
the main c2hs branch.
Duncan
Index: tools/c2hs/c/CParser.hs
===================================================================
RCS file: /cvsroot/gtk2hs/gtk2hs/tools/c2hs/c/CParser.hs,v
retrieving revision 1.1
diff -C2 -r1.1 CParser.hs
*** tools/c2hs/c/CParser.hs 21 Nov 2004 21:05:27 -0000 1.1
--- tools/c2hs/c/CParser.hs 12 Jan 2005 17:03:50 -0000
***************
*** 347,351 ****
ctoken_ (CTokGnuC GnuCExtTok) `opt` () -- ignore GCC's __extension__
-*> parseCDeclSpec
! *-> optMaybe parseGnuCAttr -- ignore GCC's __attribute__
)*> parseCDeclr
*> list parseCDecl
--- 347,351 ----
ctoken_ (CTokGnuC GnuCExtTok) `opt` () -- ignore GCC's __extension__
-*> parseCDeclSpec
! *-> list parseGnuCAttr -- ignore GCC's __attribute__
)*> parseCDeclr
*> list parseCDecl
***************
*** 490,494 ****
ctoken_ (CTokGnuC GnuCExtTok) `opt` () -- ignore GCC's __extension__
-*> parseCDeclSpec
! *-> optMaybe parseGnuCAttr -- ignore GCC's __attribute__
)*> seplist comma_ parseCInitDecl *-> semic_
`actionAttrs`
--- 490,494 ----
ctoken_ (CTokGnuC GnuCExtTok) `opt` () -- ignore GCC's __extension__
-*> parseCDeclSpec
! *-> list parseGnuCAttr -- ignore GCC's __attribute__
)*> seplist comma_ parseCInitDecl *-> semic_
`actionAttrs`
***************
*** 682,686 ****
*> base
*> many (flip (.)) id (arrayType <|> newStyleFun <|> oldStyleFun)
! *-> optMaybe parseGnuCAttr -- ignore GCC's __attribute__
`action`
\((ptr, base), declrTrans) -> ptr . declrTrans $ base
--- 682,686 ----
*> base
*> many (flip (.)) id (arrayType <|> newStyleFun <|> oldStyleFun)
! *-> list parseGnuCAttr -- ignore GCC's __attribute__
`action`
\((ptr, base), declrTrans) -> ptr . declrTrans $ base
More information about the C2hs
mailing list