Commit graph

26 commits

Author SHA1 Message Date
w0rp
9fe7b1fe6a
Close #2281 - Separate cwd commands from commands
Working directories are now set seperately from the commands so they
can later be swapped out when running linters over projects is
supported, and also better support filename mapping for running linters
on other machines in future.
2021-03-01 20:11:10 +00:00
Hugo Musso Gualandi
ae916d49fd Add test case for gnumakefile detection 2021-02-05 20:48:52 -03:00
Manoel Brunnen
02255dd967 Add tests for -imacros C flag 2020-12-21 15:07:11 +01:00
w0rp
7e0cdb53ec
Fix #3247 - Use --always-make for make -n by default 2020-08-29 16:05:49 +01:00
w0rp
7545b18ba1
Fix #3318 - Escape macros when parsing C flags 2020-08-27 21:17:24 +01:00
w0rp
6d843715f3
Fix C flag parsing and tests on Windows 2020-08-27 20:18:13 +01:00
w0rp
af177d7825
#3318 Refactor C flag parsing to set up for quoting arguments 2020-08-27 19:33:43 +01:00
w0rp
571cff932d
Label the test cases more clearly 2020-08-27 13:15:04 +01:00
w0rp
17605777d6
Fix #3317 - Parse -include from C flags 2020-08-27 13:05:50 +01:00
w0rp
f5aa0e8457
Fix #3307 - Handle compile_commands paths better
ALE now converts paths from compile_commands.json files into absolute
paths and prefers matching against absolute file and directory names for
determining which flags to use for files. As a result, parsing
compile_commands.json to determine flags should work for a lot more C
and C++ projects.
2020-08-27 11:44:35 +01:00
awang
4d42ebc160
Keep -iframework if present in parsed C/C++ flags (#3057)
* Keep -iframework if present in parsed C/C++ flags
* Add test to make sure -iframework is parsed

Co-authored-by: Alex Wang <ts826848@gmail.com>
2020-08-20 00:09:02 +01:00
w0rp
361027eac6
Fix #3200 - Do not use -fstack-usage from parsed flags 2020-08-19 01:04:08 +01:00
Stephen Robinson
b209315714 Fixes #3092 - Implement loading @file c arguments 2020-05-20 18:15:52 -07:00
fx-carton
b62e306222 Fix cflags parsing (#2510, #2265) (#2590)
* Parse CFLAGS that can be passed using a whitelist

I went through GCC's man page and selected flags that can safely be
passed to GCC and that can be useful to syntax checking. These include:

- -I/-i* include flags
- preprocessor flags such as -D
- -W* warning flags
- -O* optimization flags
- most -f options
- -m arch dependent options

* Fix CFLAGS tests: -Idir is now parsed to -I dir
* Added two tests for flags we want or don't want to pass.
* Also check for / in addition to s:sep
2019-08-17 19:08:14 +01:00
w0rp
23a8208498
#782 - Use compile commands for matching source files for headers 2019-04-15 21:38:11 +01:00
w0rp
20b9dfdb4a
Fix #2195 - Handle the command key being missing 2019-01-27 09:12:59 +00:00
Louis Xu
8037f472ef Parse more C/C++ compiler options 2019-01-24 09:44:52 +08:00
w0rp
d8a53cc7a5
Merge pull request #2191 from davidvandebunte/fixCompDbDir
bugfix: c.vim: Pull build directory from compilation database
2019-01-10 18:59:13 +00:00
François-Xavier Carton
7e7447bb93 Cflags: added a test case 2019-01-09 16:53:45 +01:00
David VandeBunte
4f72023e16 bugfix: c.vim: Pull build directory from compilation database
The LLVM compiler database JSON already includes a directory where the
build was performed:
https://clang.llvm.org/docs/JSONCompilationDatabase.html

Prefer this directory for fixing relative paths in compiler include
arguments in ale#c#ParseCFlags.

Without this change, users cannot create a symlink to their compilation
database as suggested in the LLVM tooling setup instructions:
https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
2019-01-08 19:09:02 -06:00
Jacob Segal
cb0a5c7a36 Improve perf for compile dbs in large projects
When using a compilation database (compile_commands.json) in very large
projects, significant delays would occur when changing files --
particularly those that happened to be far down the db. Rather than
iterating over the whole list every time, we now build up a lookup table
based on the tail of the filename (and tail of the directory for
widening searches) and iterate over the much smaller list of compile
commands for files with the given name.

Test metrics (from compile_database_perf/test.sh) show a 90% performance
improvement -- from 25 seconds to 2.5 seconds per run.
2019-01-06 00:41:57 -08:00
François-Xavier Carton
e5f33c6598 Add a test for cflags merging bug 2018-12-29 12:16:22 +01:00
Jacob Segal
1b3fa9828c Fix bug where last c flag was ignored
There is currently a check that tries to prevent c-flags that contain
'-' in them from being unintentionally split and included in the list of
commands. For example, we wouldn't want "-fno-exceptions " to appear as
"-fno" and "-exceptions ". The way this check was done was by making sure
the last character of the split string was a space.

This meant that the very last option to appear in the compile command
was ignored (as it doesn't end with a space). This fix explicitly skips
the ends-with-space check on the last option in the command-line.

This isn't the best fix. Really we should be using the same
argument-processing rules as a shell would rather than just splitting on
'-'. That's a much larger and more complicated change though.
2018-11-17 04:04:39 -08:00
James Ye
3c067941f1 add test for arguments with '--' 2018-09-18 10:59:26 +10:00
w0rp
1e6b1d9be2
Try to fix the C parsing test on Windows 2018-07-29 19:30:12 +01:00
w0rp
ac4bac8ea4
Add support for parsing compile_commands.json files for C compilers 2018-07-29 19:24:27 +01:00