Commits

Armin Rigo committed 3bb5d49

Allow '[...]' when declaring a global array, and interpret it like '[]'.

Comments (0)

Files changed (2)

                                     decl)
             #
             if decl.name:
-                tp = self._get_type(node)
+                tp = self._get_type(node, partial_length_ok=True)
                 if self._is_constant_declaration(node):
                     self._declare('constant ' + decl.name, tp)
                 else:

testing/test_verify.py

     result = posix.read(fdr, 256)
     posix.close(fdr)
     assert result == b"Xhello, 42!\n"
+
+def test_global_array_with_missing_length():
+    ffi = FFI()
+    ffi.cdef("int fooarray[];")
+    lib = ffi.verify("int fooarray[50];")
+    assert repr(lib.fooarray).startswith("<cdata 'int *'")
+
+def test_global_array_with_dotdotdot_length():
+    ffi = FFI()
+    ffi.cdef("int fooarray[...];")
+    lib = ffi.verify("int fooarray[50];")
+    assert repr(lib.fooarray).startswith("<cdata 'int *'")