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

Compiler options such as -MMD confuse header path reload #6

Open
harveyt opened this issue Oct 14, 2015 · 2 comments
Open

Compiler options such as -MMD confuse header path reload #6

harveyt opened this issue Oct 14, 2015 · 2 comments

Comments

@harveyt
Copy link

harveyt commented Oct 14, 2015

I fixed this by pruning such options as follows:

  (defun company-irony-c-headers--clean-compiler-options (options)
    (cond ((null options)
       nil)
      ((or (string-equal "-MF" (car options))
           (string-equal "-MT" (car options))
           (string-equal "-MQ" (car options)))
       (company-irony-c-headers--clean-compiler-options (cddr options)))
      ((string-prefix-p "-M" (car options))
       (company-irony-c-headers--clean-compiler-options (cdr options)))
      (t
       (cons (car options)
         (company-irony-c-headers--clean-compiler-options (cdr options))))))

  (defun company-irony-c-headers--user-compiler-options ()
    "Get compiler options."
    (company-irony-c-headers--clean-compiler-options irony--compile-options))
@hotpxl
Copy link
Owner

hotpxl commented Oct 18, 2015

I don't quite like the idea of add specific filtering options since it will eventually put burden on maintenance. But if this is a prevalent problem with compiler options, I could add a customizable filter function, and it will default to id but you could set it if you want. How does that sound to you?

@harveyt
Copy link
Author

harveyt commented Oct 19, 2015

It was easy enough to override the function as shown above, so I don't mind personally - reporting it here may just be useful if anyone else sees this problem.

I found bear which uses compilation databases/flags filter out just these flags:

https://github.com/rizsotto/Bear/blob/master/bear/main.py.in

Feel free to do what makes sense to you. I'm just glad you wrote this and saved me time.

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

2 participants