startuptime: move code to profile.{c,h} + doc

It's a better place to put it. Also slightly documented and reformatted, but
not changed.
startuptime: implement on top of profiling fns

Reuse the profiling functions to implement the startuptime functions.
Decreases our dependency on `gettimeofday()` and thus gets us a little bit
closer to a clean port to Windows.
garray: add necessary includes

The upcoming decoupling of vim.h and globals.h needs this to compile.
globals.h: decouple vim.h and globals.h

Allow globals.h to be included without including vim.h. Another small piece
of the puzzle of dismantling vim.h.

Moving some extra `#define`'s to globals.h is no better than having them in
vim.h. We should, in a later PR, move them to the file where they belong or
to a separate `constants.h` or something.
startuptime: always enable startuptime

Removes the STARTUPTIME define.
startuptime: print vim -> nvim
Merge #962 'Implement startuptime functions on top of profiling functions'
os/time: include time.h in os/time.h

Include what you use, also in the positive direction.
os/time: make os_get_localtime more portable

gettimeofday() doesn't exist on Windows, as reported by @equalsraf. It seems
a call to time() would be sufficient here, as only the seconds since the
UNIX epoch are needed.
os/time: fix os_localtime_r on win + add func_attr

- it makes no sense for these functions to take NULL pointers
- if `localtime()` on Windows returns a NULL pointer, the old code would try
  to dereference it.
Merge #965 'Make os_get_localtime() portable + fix bug on win'
viml: re-add sha256() function

Was removed in #699 but actually doesn't have anything to do with security.
sha256: replace gettimeofday()

gettimeofday() is not portable. I suspect os_hrtime() is also better as a
seed than gettimeofday() or time() were.
term: replace gettimeofday()

gettimeofday() is not portable, replace with os_hrtime() wherever possible.
The new code should behave equivalently to the old implementation.

Because of this, HAVE_GETTIMEOFDAY is no longer necessary To be able to
handle double clicks.
cmake: remove check for gettimeofday

There are no more uses of gettimeofday, so remove the check in CMake.
Statically allocate NameBuff
Change buffer.h #defines to enums so they can be used in tests
Add tests for buffer.c and fileio.c
Merge pull request #904 from war1025/dev/buffer_tests

Add unit tests for buffer.c and fileio.c
func_attr: clang/icc support NONNULL_* attr

Both clang and (apparently) icc support the nonnull attribute. So I'm not
sure why it wasn't enabled in the first place.

- clang: http://clang-analyzer.llvm.org/annotations.html#attr_nonnull
- icc: https://software.intel.com/en-us/forums/topic/280290 (not conclusive
  evidence, but the best I could find, lacking docs)