Add more commented patch numbers to version.c (3) #940

This should help reduce conflicts when merging patches from upstream.
Add cmake platform checks

- Defined CMake checks for all headers in config.h.in
- Removed headers checks that are not used anymore:
  sgtty.h sys/statfs.h libintl.h poll.h
- Added UNIX check
- Add some fatal checks
  + Check for setenv() and fail if it does not exist
    since our os layer just assumes it does
  + lstat is required by os_unix.c
  + sys/wait.h is required in UNIX
- Removed entries for functions that are not being used: getcwd,
  getrlimit, getwd, nanosleep, sigaltstack, getwd, sigstack, fseeko
- Replaced nearly all defines in config.h.in for functions with
  compile time checks
- Add check for symbol FD_CLOEXEC
- Add check for langinfo CODESET
- HAVE_ICONV_H and HAVE_ICONV hold the expected checks but Neovim uses
  USE_ICONV define to actually decide whether to enable it
- Removed checks that are no longer needed
  + USEMEMMOVE
  + _FILE_OFFSET_BITS
  + HAVE_ST_BLKSIZE
  + dlfcn.h
Clean up DEBUG check in config.h.in
Merge #813 'Add platform checks to replace config.h.in hardcoded values'
travis.sh: Fix mixed tabs/whitespace formatting.
travis.sh: Use dependencies from neovim/deps.
travis.sh: Simplify clang/asan build.

* Clang 3.4 now default on Travis CI.
* Introduce config variable to download & use different clang version.
Merge #947 'Remove Clang 3.4 installation in travis.sh.'
assert: add STATIC_ASSERT macro

Can be quite handy, attempt to provide fallbacks for compilers that don't
support _Static_assert (which is technically a C11 feature). Suppress
warnings as best we can (Clang and GCC warn that we're using a C11 feature
while in C99 mode).

Needs to be tested for MSVC still.
os: implement os_hrtime

Just an alias to uv_hrtime. Provides a high-resolution timer.
profiling: implement on top of os_hrtime()

Should be better than gettimeofday() since libuv uses higher resolution
clocks on most UNIX platforms. Libuv also tries to use monotonic clocks,
kernel bugs notwithstanding, which is another win over gettimeofday().

Necessary for Windows, which doesn't have gettimeofday(). In vanilla vim,
Windows uses QueryPerformanceCounter, which is the correct primitive for
this sort of things, but that was removed when slimming up the codebase.
Libuv uses QueryPerformanceCounter to implement uv_hrtime() on Windows so
the behaviour of vim profiling on Windows should now be the same.

The behaviour on Linux should be different (better) though, libuv uses more
accurate primitives than gettimeofday().

Other misc. changes:
- Added function attributes where relevant (const, pure, ...)
- Convert functions to receive scalars: Now that proftime_T is always a
  (uint64_t) scalar (and not a struct), it's clearer to convert the
  functions to receive it as such instead of a pointer to a scalar.
- Extract profiling funcs to profile.c: make everything clearer and reduces
  the size of the "catch-all" ex_cmds2.c
- Add profile.{c,h} to clint and -Wconv:
  - Don't use sprintf, use snprintf
  - Don't use long, use int16_t/int32_t/...
profiling: move static to function scope

It wasn't used anywhere else, our coding guidelines mandate the tightest
scope possible.
profiling: add tests

Some functions are missing:

- profile_self
- profile_get_wait
- profile_set_wait
- profile_sub_wait
Merge pull request #839 from aktau/platform-abstract-time-fn

viml: impl profiling on top of uv_hrtime()
doc: add clang analysis badge to README.md
hashtab.h: don't include vim.h

Including vim.h in another header filer is asking for trouble. Test code
that includes separate header files (e.g.: cimport './src/nvim/buffer.h'),
has a really bad time with this. This is just one piece of the puzzle
though.
vim: move long_u from vim.h to types.h

Seems to make no difference to the main binary, but it helps the tests a bit
further along.
vim: move linenr_T and colnr_T to pos.h

Try to cut down vim.h's size. It's keeping us from testing more things.
vim: move disptick_T from vim.h to syntax_defs.h

Make vim.h smaller, bit by bit.
test/preprocess: always declare EXTERN

Unit tests never need to declare globals, only access them. In the main code
base this is handled by including "vim.h". If a file wants to declare
globals (in the case of neovim that's only main.c), it #define's EXTERN and
includes "vim.h". Otherwise, a file just includes "vim.h" (that's the
majority case). Since we want to be able to run unit tests without including
"vim.h", we predefine "EXTERN" to mean extern. That way, we don't have to
include "vim.h".