Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiledb parse shell redirect files as if they where gcc arguments #104

Open
f-michaut opened this issue Aug 24, 2020 · 0 comments
Open

Comments

@f-michaut
Copy link

f-michaut commented Aug 24, 2020

I have a Makefile with a build rule similar to this one :

%.o: %.cpp
    $(CC) -o $@ -c $< $(LDFLAGS) $(CFLAGS) 2>>errors_build.txt

I redirect the error output from g++ to a file for parsing purpose by custom tools.

When I invoke compiledb on this Makefile, I end up with someting like the following :

....
 {
  "directory": "/home/bar/foo",
  "arguments": [
   "g++",
   "-o",
   "build/file.o",
   "-c",
   "source/file.cpp",
   "-W",
   "-Wall",
   "-Werror",
   "-Wextra",
   "-I",
   "./include",
   "errors_build.txt"
  ],
  "file": "source/file.cpp"
 },
....

As you can see, the file where the error output from g++ is redirected is added to the argument list.
When my linter call g++ with this argument list, it will obviously get errors.
Since the 'error_build.txt' file isn't really part of the g++ argument list, I was expecting that compiledb wouldn't list it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant