Fix enum cross-compilation support
authorIan Lynagh <igloo@earth.li>
Wed, 23 Mar 2011 23:02:37 +0000 (23:02 +0000)
committerIan Lynagh <igloo@earth.li>
Wed, 23 Mar 2011 23:02:37 +0000 (23:02 +0000)
commit8768b05c1c2ed89a95da65f9d1a63f1f8a92fc18
tree4f6408313741e240eb0c9311f15890567bf83206
parent3cd50bf0580e32fa727b0020323f580e46469e7a
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 ‘test_array’ with no linkage

We now wrap each
    static int test_array[( EPOLL_CTL_ADD) > 0 ? 2 : 1];
    (void)test_array;
in { ... }
CrossCodegen.hs