patch applied (hsc2hs): Fix enum cross-compilation support

Ian Lynagh <[email protected]> Wed, 23 Mar 2011 17:51:58 -0700
Newsgroups gmane.comp.lang.haskell.cvs.other
Message-ID <[email protected]>
Wed Mar 23 16:02:37 PDT 2011  Ian Lynagh <[email protected]>
  * Fix enum cross-compilation support
  For:
      #{enum ControlOp, ControlOp
       , controlOpAdd    = EPOLL_CTL_ADD
       , controlOpModify = EPOLL_CTL_MOD
       , controlOpDelete = EPOLL_CTL_DEL
       }
  we were generating something like:
      void _hsc2hs_test19()
      {
          static int test_array[( EPOLL_CTL_ADD) > 0 ? 2 : 1];
          (void)test_array;
          static int test_array[( EPOLL_CTL_MOD) > 0 ? 2 : 1];
          (void)test_array;
          static int test_array[( EPOLL_CTL_DEL) > 0 ? 2 : 1];
          (void)test_array;
      }
  which gave errors like:
      EPoll.hsc:136: error: redeclaration of [_\e2_][_\80_][_\98_]test_array[_\e2_][_\80_][_\99_] with no linkage
  
  We now wrap each
      static int test_array[( EPOLL_CTL_ADD) > 0 ? 2 : 1];
      (void)test_array;
  in { ... }

    M ./CrossCodegen.hs -1 +1

View patch online:
http://darcs.haskell.org/cgi-bin/darcsweb.cgi?r=hsc2hs;a=darcs_commitdiff;h=20110323230237-3fd76-2e9599256917e47c405927ca087ec60e6c961acc.gz