aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/indent_c.c
Commit message (Collapse)AuthorAge
* indent_c: pvs/v1071Jan Edmund Lazo2021-06-05
| | | | "void" cast unused return value of find_last_paren().
* vim-patch:8.1.0874: using old style comments in new fileJan Edmund Lazo2021-03-29
| | | | | | Problem: Using old style comments in new file. Solution: Convert to // comments in new file. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/9c46efd7dc57c1a8eae5137d05c7e67c4f82c3d7
* vim-patch:8.2.0864: pragmas are indented all the way to the leftJan Edmund Lazo2020-11-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Pragmas are indented all the way to the left. Solution: Add an option to indent progmas like normal code. (Max Rumpf, closes vim/vim#5468) https://github.com/vim/vim/commit/d881b516da0184052d2f9d33c3f72c5c014316bd N/A patches for version.c: vim-patch:8.1.2030: tests fail when build with normal features and terminal Problem: Tests fail when build with normal features and terminal. (Dominique Pelle) Solution: Disable tests that won't work. (closes vim/vim#4932) https://github.com/vim/vim/commit/997d42427eaab889058eb047e08d55de9e4a968a vim-patch:8.1.2063: some tests fail when +balloon_eval_term is missing Problem: Some tests fail when +balloon_eval_term is missing but _balloon_eval is present. (Dominique Pelle) Solution: Check the right feature in the test. (closes vim/vim#4962) https://github.com/vim/vim/commit/1e82a784ace6d2c4dce594dd6156bcb0028bba9e vim-patch:8.2.1938: wiping out a terminal buffer makes some tests fail Problem: Wiping out a terminal buffer makes some tests fail. Solution: Do not wipe out the terminal buffer unless wanted. https://github.com/vim/vim/commit/a46765a79745ff27b4a44659fb8389519c961977
* pvs/v1048: variable was assigned same valueJan Edmund Lazo2020-03-01
|
* vim-patch:8.2.0112: illegal memory access when using 'cindent'Jan Edmund Lazo2020-01-17
| | | | | | Problem: Illegal memory access when using 'cindent'. Solution: Check for NUL byte. (Dominique Pelle, closes vim/vim#5470) https://github.com/vim/vim/commit/02ad46394e8f887b60fda994f8a5da2ac1937b23
* lintJustin M. Keyes2019-09-13
|
* getdigits: introduce `strict`, `def` parametersJustin M. Keyes2019-09-13
| | | | | | | | | | | | Problem: During a refactor long ago, we changed the `getdigits_*` familiy of functions to abort on overflow. But this is often wrong, because many of these codepaths are handling user input. Solution: Decide at each call-site whether to use "strict" mode. fix #5555
* Remove excess <stdint.h>Jan Edmund Lazo2019-09-11
|
* lintJan Edmund Lazo2018-08-23
|
* vim-patch:8.0.0999: indenting raw C++ strings is wrongJan Edmund Lazo2018-08-23
| | | | | | Problem: Indenting raw C++ strings is wrong. Solution: Add special handling of raw strings. (Christian Brabandt) https://github.com/vim/vim/commit/dde81312b031211752d1fcb8539d79f90f324a2e
* vim-patch:8.0.0431 (#7908)KunMing Xie2018-01-25
| | | | | | | vim-patch:8.0.0431: 'cinoptions' cannot set indent for extern block Problem: 'cinoptions' cannot set indent for extern block. Solution: Add the "E" flag in 'cinoptions'. (Hirohito Higashi) https://github.com/vim/vim/commit/7720ba8599162fbbb8f7fc034f674a2ccd3ca7f1
* vim-patch:8.0.0423: changing 'cinoptions' does not always workckelsel2018-01-20
| | | | | | | | Problem: The effect of adding "vim/vim#" to 'cinoptions' is not always removed. (David Briscoe) Solution: Reset b_ind_hash_comment. (Christian Brabandt, closes vim/vim#1475) https://github.com/vim/vim/commit/6b64394f346594404cffb9591d71ac693040679f
* vim-patch:8.0.0148 #7344ckelsel2017-10-07
| | | | | | | | | Problem: When a C preprocessor statement has two line continuations the following line does not have the right indent. (Ken Takata) Solution: Add the indent of the previous continuation line. (Hirohito Higashi) https://github.com/vim/vim/commit/c6aa475a27e3ed1645446b014c32ebf68d005d49
* vim-patch:8.0.0092Lech Lorens2017-08-21
| | | | | | | | Problem: C indenting does not support nested namespaces that C++ 17 has. Solution: Add check that passes double colon inside a name. (Pauli, closes vim/vim#1214) https://github.com/vim/vim/commit/ca8b8d6956dd881de6446fc32c38e817a364a6cc
* vim-patch:7.4.2360Michael Ennen2017-06-08
| | | | | | | Problem: Invalid memory access when formatting. (Dominique Pelle) Solution: Make sure cursor line and column are associated. https://github.com/vim/vim/commit/80c3fd7c559c7d329d57afe10db9bfb0adf10e46
* *: Add comment to all C filesZyX2017-04-19
|
* refactor: pos_T macros to functions (#6496)Felipe Oliveira Carvalho2017-04-11
|
* *: Fix some Windows-specific warningsZyX2017-03-29
| | | | Also fixed an error in path_fnamecmp().
* win: fix warningsJustin M. Keyes2017-01-19
|
* refactor: eliminate misc2.cJustin M. Keyes2016-09-13
| | | | | | | | | | move `call_shell` to misc1.c Move some fns to state.c Move some fns to option.c Move some fns to memline.c Move `vim_chdir*` fns to file_search.c Move some fns to new module, bytes.c Move some fns to fileio.c
* *: Fix new linter errorsZyX2016-05-01
| | | | Originally there were 128 new errors, so I thought this is a good idea to fix all of them. Of course, this commit also fixes many suppressed errors.
* vim-patch:7.4.912watiko2016-02-15
| | | | | | | Problem: Wrong indenting for C++ constructor. Solution: Recognize ::. (Anhong) https://github.com/vim/vim/commit/e01f4f86cef7bed3cb99b26f9f57d86f6eb5fe1a
* vim-patch:7.4.893watiko2016-02-15
| | | | | | | | Problem: C indenting is wrong below a "case (foo):" because it is recognized as a C++ base class construct. Issue #38. Solution: Check for the case keyword. https://github.com/vim/vim/commit/d1b15dec4d00d7ed5e92ff4e0fb7fc2e0818e479
* vim-patch:7.4.891watiko2016-02-15
| | | | | | | | Problem: Indentation of array initializer is wrong. Solution: Avoid that calling find_start_rawstring() changes the position returned by find_start_comment(), add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/089af18d1fd0961ff504ee72db0156bbfe509cdf
* Fix linting errors.Johan Klokkhammer Helsing2015-12-13
|
* Solve warnings.Johan Klokkhammer Helsing2015-12-13
|
* vim-patch:7.4.803Johan Klokkhammer Helsing2015-12-13
| | | | | | | Problem: C indent does not support C11 raw strings. (Mark Lodato) Solution: Do not change indent inside the raw string. https://github.com/vim/vim/commit/f7bb86dc593913d055e4cce16cec43f6271adda3
* Appease clint.Johan Klokkhammer Helsing2015-12-13
|
* vim-patch:7.4.723Johan Klokkhammer Helsing2015-12-13
| | | | | | | Problem: For indenting, finding the C++ baseclass can be slow. Solution: Cache the result. (Hirohito Higashi) https://github.com/vim/vim/commit/4032cfdf17c1c744d0f87219924870378b86a1c4
* vim-patch:7.4.670Johan Klokkhammer Helsing2015-12-13
| | | | | | | Problem: Using 'cindent' for Javascript is less than perfect. Solution: Improve indenting of continuation lines. (Hirohito Higashi) https://github.com/vim/vim/commit/dcefba993456263100785f18d21d780cf531f2dc
* Replace VIM_ISDIGIT() and vim_isdigit() with ascii_isdigit() defined in ascii.hFelipe Oliveira Carvalho2015-04-24
|
* Replace vim_iswhite with ascii_iswhite() defined in ascii.hFelipe Oliveira Carvalho2015-04-24
|
* memory: Add `free` wrapper and refactor project to use itThiago de Arruda2015-04-13
| | | | | | We already use wrappers for allocation, the new `xfree` function is the equivalent for deallocation and provides a way to fully replace the malloc implementation used by Neovim.
* Enable -Wconversion: fold.c.Eliseo Martínez2015-04-07
| | | | | | | | | | | | Refactor summary: - foldinfo_T.fi_lnum: int --> linenr_T Reorder field for optimal packing. - foldAddMarker(..., markerlen): int --> size_t * foldstartmarkerlen: int --> size_t - foldDelMarker(..., markerlen): int --> size_t * foldendmarkerlen: int --> size_t Helped-by: oni-link <knil.ino@gmail.com>
* Remove nonnullret deadcode: vim_strsave.Eliseo Martínez2015-01-27
|
* coverity/102151: initialize `our_paren_pos`Jack Danger Canty2015-01-18
| | | | | | | | | | | This hoists the initialization of `our_paren_pos` outside a conditional so it can be safely referenced further down in this function. Originally broken in: https://code.google.com/p/vim/source/diff?spec=svndc8197342755fda6ca4d6619dac228406867a7ce&old=01583c79d5f4d3f29d4c33dd10dd29efd349cad0&r=dc8197342755fda6ca4d6619dac228406867a7ce&format=unidiff&path=%2Fsrc%2Fmisc1.c This fixes CID #102151 https://scan8.coverity.com/reports.htm#v22612/p10672/fileInstanceId=3625174&defectInstanceId=1525719&mergedDefectId=102151
* Cleanup: Rename getdigits() family functions.Eliseo Martínez2015-01-11
|
* Cleanup: Refactor getdigits().Eliseo Martínez2015-01-11
| | | | | | | | | | | | | | | | Problem : getdigits() currently returns a long, but at most places, return value is casted (unsafely) into an int. Making casts safe would introduce a lot of fuss in the form of assertions checking for limits. Note : We cannot just change return type to int, because, at some places, legitimate long values are used. For example, in diff.c, for line numbers. Solution : Introduce new functions: - get_digits() : Gets an intmax_t from a string. - get_int_digits() : Wrapper for ints. - get_long_digits() : Wrapper for longs. And replace getdigits() invocations by the appropiate wrapper invocations.
* vim-patch:7.4.395Florian Walch2014-12-23
| | | | | | | | Problem: C indent is wrong below an if with wrapped condition followed by curly braces. (Trevor Powell) Solution: Make a copy of tryposBrace. https://code.google.com/p/vim/source/detail?r=v7-4-395
* vim-patch:7.4.355Scott Prager2014-12-19
| | | | | | | Problem: Several problems with Javascript indenting. Solution: Improve Javascript indenting. https://code.google.com/p/vim/source/detail?r=v7-4-355
* vim-patch:7.4.350Scott Prager2014-12-19
| | | | | | | | | Problem: Using C indenting for Javascript does not work well for a {} block inside parenthesis. Solution: When looking for a matching paren ignore one that is before the start of a {} block. https://code.google.com/p/vim/source/detail?r=v7-4-350
* Doxygen find_match_paren().Scott Prager2014-12-19
|
* Define and use the ARRAY_SIZE macroFelipe Oliveira Carvalho2014-12-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A similar macro is defined in the Linux kernel [1]. To refactor the code I used a slightly modified Coccinelle script I found in [2]. ```diff // Use the macro ARRAY_SIZE when possible // // Confidence: High // Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU. GPLv2. // URL: http://www.emn.fr/x-info/coccinelle/rules/array.html // Options: -I ... -all_includes can give more complete results @@ type T; T[] E; @@ - (sizeof(E)/sizeof(*E)) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(E[...])) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(T)) + ARRAY_SIZE(E) @n@ identifier AS,E; @@ - #define AS(E) ARRAY_SIZE(E) @@ expression E; identifier n.AS; @@ - AS(E) + ARRAY_SIZE(E) ``` `spatch --in-place --sp-file array_size.cocci -I src/ -I build/include/ -I build/src/nvim/auto/ src/nvim/*.c` [1] http://lxr.free-electrons.com/source/include/linux/kernel.h#L54 [2] http://www.emn.fr/z-info/coccinelle/rules/#macros
* Simple refatorings that didn't fit the pattern of the last commitFelipe Oliveira Carvalho2014-12-13
|
* Reduce indentation level by early returning or continuing loopFelipe Oliveira Carvalho2014-12-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace code like this ```c func() { if (cond) { ... ... ... } return ret; } ``` ```c for (...) { if (cond) { ... ... ... } } ``` with ```c func() { if (!cond) { return ret; } ... ... ... } ``` ```c for (...) { if (!cond) { continue; } ... ... ... } ```
* Wconversion: Fix warnings in indent_c.c.Florian Walch2014-11-27
|
* vim-patch:7.4.348André Twupack2014-09-11
| | | | | | | Problem: When using "J1" in 'cinoptions' a line below a continuation line gets too much indent. Solution: Fix parenthesis in condition. https://code.google.com/p/vim/source/detail?r=v7-4-348
* move <inttypes.h> include out of vim.hBrandon Coleman2014-07-09
|
* move ascii.h include out of vim.hBrandon Coleman2014-07-09
|
* spelling fixes #827Will Stamper2014-06-12
|