aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/assert.h
Commit message (Collapse)AuthorAge
* viml/profile: switch to uv_gettimeofday() #10356Justin M. Keyes2019-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Performance of high-resolution time (clock_gettime via uv_hrtime) is expensive on some systems. For profiling VimL, syntax, etc., we don't care about nanosecond-precision and monotonicity edge-cases, so avoid uv_hrtime(). closes #10328 From the uv__hrtime() source: https://github.com/libuv/libuv/blob/0cdb4a5b4b706d0e09413d9270da28f9a88dc083/src/unix/linux-core.c#L442-L462 /* Prefer CLOCK_MONOTONIC_COARSE if available but only when it has * millisecond granularity or better. CLOCK_MONOTONIC_COARSE is * serviced entirely from the vDSO, whereas CLOCK_MONOTONIC may * decide to make a costly system call. */ This micro-benchmark (Debug build) shows negligible differences on my system: #include <sys/time.h> ... proftime_T tm = profile_start(); int trials = 999999; int64_t t = 0; struct timeval tv; for (int i = 0; i < trials; i++) { t += gettimeofday(&tv,NULL); } tm = profile_end(tm); ILOG("%d trials of gettimeofday: %s", trials, profile_msg(tm)); tm = profile_start(); for (int i = 0; i < trials; i++) { t += os_hrtime(); } tm = profile_end(tm); ILOG("%d trials of os_hrtime: %s", trials, profile_msg(tm)); tm = profile_start(); for (int i = 0; i < trials; i++) { t += os_utime(); } tm = profile_end(tm); ILOG("%d trials of os_utime: %s", trials, profile_msg(tm)); ILOG("%zu", t);
* build: PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPESJustin M. Keyes2019-02-04
| | | | | | | | | | | | On Travis CI, -Wmissing-prototypes gives strange error: In file included from ../src/nvim/eval.c:5965: /home/travis/build/neovim/neovim/build/src/nvim/auto/funcs.generated.h.gperf:215:1: error: conflicting types for 'find_internal_func_gperf' find_internal_func_gperf (register const char *str, register unsigned int len) ^ ../src/nvim/eval.c:5962:20: note: previous declaration is here const VimLFuncDef *find_internal_func_gperf(register const char *str, ^
* PVS/V1028 (rework): cast operands, not the result #9531Justin M. Keyes2019-01-21
| | | closes #9522
* STRICT_ADD, STRICT_SUB: Log error before abortJustin M. Keyes2019-01-20
|
* build: include auto/config.h explicitlyJustin M. Keyes2019-01-20
| | | | | Otherwise the symbols defined in config/config.h.in may not be defined, depending on include-order.
* CMake: Feature-detect __builtin_{add,sub}_overflowJustin M. Keyes2019-01-09
|
* PVS/V1028: cast operands, not the resultJustin M. Keyes2019-01-09
|
* assert.h: Check overflow with STRICT_ADD, STRICT_SUBJustin M. Keyes2019-01-09
|
* Fix warnings with gcc 6.1Björn Linse2016-05-19
| | | | The intentional behavior of do_sub was checked in vim
* MSVC: Avoid variadic macro bug in STATIC_ASSERTRui Abreu Ferreira2016-04-30
| | | | | | | | | | | | MSVC does not handle __VA_ARGS__ as expected in STATIC_ASSERT, avoid its use to work around it since we don't need it. The underlying issue seems to be one of https://connect.microsoft.com/VisualStudio/Feedback/Details/1232378 https://connect.microsoft.com/VisualStudio/Feedback/Details/1099052 The bug only seems to manifest when using multiple variadic macros that call each other.
* eval: Do not break when VimVarIndex and vimvars order mismatchesZyX2016-04-18
| | | | Also makes sure that compiler will error out when new name is longer then vv_filler.
* assert: add STATIC_ASSERT macroNicolas Hillegeer2014-07-16
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.