Commit Graph

31085 Commits

Author SHA1 Message Date
oni-link
f9b5ca8b85 Remove feature HAVE_QSORT
qsort conforms to C99, so we don't need our own version.
2014-03-31 21:24:59 -03:00
Nicolas Hillegeer
7b14caf604 alloc: xmalloc and xrealloc can't return null
With this annotation/function attribute, we can inform gcc that these
functions never return null, which can save a lot of redundant null checks.
2014-03-31 18:42:17 -03:00
Nicolas Hillegeer
22e17e25f1 func-attr: add some extra handy function attrs
The attributes in question are:

- nonnull: specify whether a function argument cannot/may not be null
- returns_nonnull: specify whether a function will not return a null
  pointer (example: xmalloc can't return null, so it should be annotated as
  such). Only available from gcc 4.9 onwards.

Currently these attributes are only supported by gcc.
2014-03-31 18:42:17 -03:00
Nicolas Hillegeer
f5db0d01ba func-attr: clang 3.5 doesn't support alloc_size
The attribute was removed in commit c047507 in the clang repository as it
was never properly implemented anyway. This fixes compiling with clang 3.5.

Fixes issue #429
2014-03-31 18:42:17 -03:00
John Schmidt
5d30654512 Rename ga_init2() to ga_init() 2014-03-31 14:42:11 -03:00
John Schmidt
e02790cad4 Inline ga_init() 2014-03-31 14:42:11 -03:00
Thiago de Arruda
a4c77ab5f0 Fix shell.{c,h} comments to match the style guide 2014-03-31 09:20:24 -03:00
Thiago de Arruda
c7d3e85dc8 Add doxygen comments to the functions in shell.c 2014-03-31 08:34:27 -03:00
Thiago de Arruda
ab61c2caa7 Rewrite show_shell_mess as a ShellOpts flag 2014-03-31 08:07:47 -03:00
Thiago de Arruda
206a38871f Update call_shell signature to use ShellOpts 2014-03-31 08:07:47 -03:00
Thiago de Arruda
0d61b1c470 Refactor SHELL_* defines into enum typedef
The SHELL_* defines are the bitflags that can be passed to `mch_call_shell`.
The enum is defined in 'os/shell.h', where all shell-related functions will
eventually be defined.
2014-03-31 08:07:47 -03:00
Thiago de Arruda
607e1c7ee4 Refactor/cleanup argument parsing functions 2014-03-31 08:07:47 -03:00
Thiago de Arruda
f496d619a9 Extract shell_build_argv from mch_call_shell 2014-03-31 08:07:47 -03:00
Thiago de Arruda
c791922224 Make extra_shell_arg a mch_call_shell parameter 2014-03-31 08:07:46 -03:00
Thiago de Arruda
8a61c27b1e Extract shell_count_argc from mch_call_shell 2014-03-31 08:07:46 -03:00
Thiago de Arruda
2d28251a6e Extract shell_skip_word from mch_call_shell 2014-03-31 08:07:46 -03:00
Thiago de Arruda
1ab6cf47bd Split code for counting and parsing arguments 2014-03-31 08:07:46 -03:00
Thomas Wienecke
54782ecfe0 Add doxygen-style comments to functions from os/fs.c. 2014-03-31 07:36:00 -03:00
Thomas Wienecke
6f681faba7 Add basic Doxyfile. 2014-03-31 07:36:00 -03:00
Felipe Oliveira Carvalho
0e998066b2 xrealloc(): similar to xmalloc()
Replaced all calls to realloc by xrealloc. All `== NULL` tests can be removed
and the code within `!= NULL` tests can be unwrapped.
2014-03-31 07:31:47 -03:00
Felipe Oliveira Carvalho
7bdd1f1898 Document xmalloc() and deprecate lalloc() 2014-03-31 07:31:47 -03:00
Felipe Oliveira Carvalho
5afc1161ca Avoid a seg fault when exiting after OOM error
I'm debugging OOM behavior using http://www.nongnu.org/failmalloc/ on Linux.

gdb environment:

```
set env LD_PRELOAD=libfailmalloc.so
set env FAILMALLOC_SPACE=0xF00000
```

SEGV was happening like this:

```
Starting program: /home/felipe/code/neovim/build/bin/nvim
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Vim: Error: Out of memory.

Program received signal SIGSEGV, Segmentation fault.
0x00000000004d3719 in getout (exitval=1) at
/home/felipe/code/neovim/src/main.c:836
836       if (*p_viminfo != NUL)
(gdb)
```

After the fix it works as expected:

```
(gdb) set environment LD_PRELOAD=libfailmalloc.so
(gdb) set environment FAILMALLOC_SPACE=0xF00000
(gdb) r
Starting program: /home/felipe/code/neovim/build/bin/nvim
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Vim: Error: Out of memory.
Vim: Finished.
[Inferior 1 (process 21505) exited with code 01]
(gdb)
```
2014-03-31 07:31:47 -03:00
Felipe Oliveira Carvalho
de1575f3ea xmalloc() that succeeds or gracefully aborts 2014-03-31 07:31:47 -03:00
Justin M. Keyes
a87b73ecb2 update readme: "progress" section; formatting 2014-03-31 07:23:34 -03:00
John Szakmeister
0f6323b8e5 Force the cmake target to re-run the CMake configuration.
This makes it more handy when files are added or removed from the source
tree.  A simple `make cmake` will re-configure and pick up the change.
2014-03-31 04:41:26 -04:00
John Szakmeister
cc9fbd9e55 Use the clang 3.4 release tarball instead of apt for clang 3.4.
It appears the llvm.org/apt/ repository isn't always reliable.  So let's
use the release tarball instead.  Also, make using 3.4 conditional, so
we can use the clang 3.3 if things still manage to go awry in the
future.  Note: using 3.3 means that we won't get leak detection.

I left the logic for using llvm.org/apt/, just in case we want try using
it again sometime.
2014-03-30 21:18:29 -04:00
Justin M. Keyes
d9f5cd6290 Re-integrate FEAT_SIGNS code, close #383
- omit FEAT_NETBEANS_INTG and FEAT_SIGN_ICONS
- omit FEAT_GUI blocks
2014-03-29 20:47:39 -03:00
Nicolas Hillegeer
28b3659955 use function attributes on allocation functions
This should allow gcc/clang/icc to generate better code and clarifies
function intent.
2014-03-29 20:10:06 +01:00
Nicolas Hillegeer
d5708b200a add func_attr.h to be able to use func attribs
Currently enables these for every gnu-like compilers, i.e.: gcc, clang and
icc.
2014-03-29 20:09:57 +01:00
John Schmidt
44e40b02cf Move remove_duplicates to garray.c 2014-03-29 13:29:53 -03:00
John Schmidt
f5154d7451 Extract path.c from misc1.c 2014-03-29 13:29:52 -03:00
John Szakmeister
86180787fa Drop the deb-src for clang.
The llvm.org/apt repo currently has an issue with the source packages,
and we don't need it on Travis anyways.
2014-03-29 10:01:18 -04:00
John Szakmeister
0efc815216 Append to CMAKE_PREFIX_PATH instead setting it outright.
Also, don't set it in the FindXxx cmake scripts--it's unnecessary, and
it resets the value.
2014-03-28 05:09:45 -04:00
Thomas Wienecke
4e29a820b6 Address clint warnings and other style issues.
* Add const.
* Fix conditions (move && from end to start of line).
* Use int32_t instead of long.
* Use //-style comments.
2014-03-27 19:57:55 -03:00
Thomas Wienecke
5762c4e528 Rename mch_* functions to os_* in os module. 2014-03-27 19:57:55 -03:00
Thiago de Arruda
3f7011ab91 Fix prepare watcher teardown in the event loop 2014-03-27 19:22:44 -03:00
Thiago de Arruda
e995b21567 Re-integrate FEAT_FILTERPIPE code
This feature was accidentally removed when doing the initial import from vim. It
makes vim use pipes instead of temporary files for filtering buffers through
shell commands.

I found that this was missing when looking for references of
SHELL_READ/SHELL_WRITE outside mch_call_shell`.

When `mch_call_shell` is reimplemented on top of libuv process management
facilities, pipes will always be used for communication with child processes so
it makes sense to enable the feature permanently.
2014-03-27 17:36:32 -03:00
Thiago de Arruda
1e8eb4e2c6 Make EventType enum private to input.c
This enum doesn't need to be public since `event_poll` is only interested in
user input(but other events may be handled by libuv callbacks).
2014-03-27 17:25:31 -03:00
John Szakmeister
e644f8c2b1 Don't use alias in travis.sh.
We don't want to clobber anyone's make alias when running travis.sh
directly.
2014-03-27 14:43:13 -04:00
Julian Orth
d1ef25728a More cleanup 2014-03-27 14:03:36 -03:00
Julian Orth
380b8048db remove leftover c++ headers 2014-03-27 14:03:36 -03:00
Julian Orth
5a2168a601 remove some leftover function calls 2014-03-27 14:03:35 -03:00
Julian Orth
323e90ee79 remove cpp headers 2014-03-27 14:03:35 -03:00
Julian Orth
f3a77cfd8c remove cpp file extensions 2014-03-27 14:03:35 -03:00
Julian Orth
2b7cd6ebbc remove CleanseRawStrings 2014-03-27 14:03:35 -03:00
Julian Orth
a8e2cab3ef remove C++ only _NestingState parts 2014-03-27 14:03:35 -03:00
Julian Orth
2aadf0daac clean up CheckForNonStandardConstruct
remove C++ stuff and add C types
2014-03-27 14:03:35 -03:00
Julian Orth
23a41ebf8f remove C++ stuff from CheckSpacingForFunctionCall 2014-03-27 14:03:35 -03:00
Julian Orth
95659707a8 remove C++ stuff from CheckSpacing 2014-03-27 14:03:35 -03:00
Julian Orth
ef23bbe6ee remove CheckSectionSpacing
irrelevant
2014-03-27 14:03:35 -03:00