Commit Graph

8 Commits

Author SHA1 Message Date
Marco Hinz
32ecd75a16 test/unit: clean up according to luacheck 2015-11-23 13:57:21 +01:00
Nicolas Hillegeer
522a15f1c0 test: fix formatc.lua oddity on OSX/gcc
The primitive C canonicalizer we use to strip out duplicate header
declarations and keep luajit's ffi happy, didn't work properly in this case.

What happened is this (in /usr/include/ctype.h):

__DARWIN_CTYPE_TOP_inline int
isspecial(int _c)
{
        return (__istype(_c, _CTYPE_T));
}

Gets preprocessed to something like:

__inline int
isspecial(int _c)
{
        return (__istype(_c, _CTYPE_T));
}

On OSX/gcc. The formatter wasn't recognizing this entire function as
something to put on a single line because it naively just checks for
"static" or "inline" for that, but not "__inline".

This error doesn't occur on OSX/clang. Without looking further into it, I
guess that __DARWIN_CTYPE_TOP_inline gets defined to inline on clang, but
__inline on gcc, for some reason.

This helps issue #1572 along.
2015-01-16 21:45:00 +01:00
Justin M. Keyes
f6088e79b0 unit tests: avoid global scope; add missing cimports
temporarily comment out call to vim_deltempdir() to avoid segfault
2014-09-11 05:17:52 +00:00
Thiago de Arruda
7b41fb383a unittest: Remove remaining moonscript references 2014-08-31 14:50:49 +02:00
Nicolas Hillegeer
ad4c1e1954 test/formatc: improve standalone usage
Easier testing.
2014-07-27 14:00:44 -03:00
Nicolas Hillegeer
10479fd233 test/formatc: improve 'inline' function handling
Apple seems to define some functions as `inline` but not `static` in
headers. The ghetto parser wasn't unbelievably happy with this.
2014-07-27 14:00:44 -03:00
Will Stamper
5b3b3fd3ed spelling fixes #827 2014-06-12 20:26:35 -04:00
Nicolas Hillegeer
d699ccfb0c test: fix the cimport method
This commit will hopefully allow the cimport method to be used just as one
would use #inclue <header.h> in C. It follows the following method:

1. create a pseudoheader file that #include's all the requested header files
2. runs the pseudoheader through the C preprocessor (it will try various
   compilers if available on the system).
3. runs the preprocessed file through a C formatter, which attempts to group
   statements on one line. For example, a struct definition that was
   formerly on several lines will take just one line after formatting. This
   is done so that unique declarations can be detected. Duplicates are thus
   easy to remove.
4. remove lines that are too complex for the LuaJIT C parser (such as:
   Objective-C block syntax, crazy enums defined on linux, ...)
5. remove duplicate declarations
6. pass result to ffi.cdef
2014-04-28 16:17:25 -03:00