Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Add new option 'g:syntastic_c_cflags_file' for C syntax checker to specify a file with CFLAGS. #215

Closed
wants to merge 1 commit into from

Conversation

ldx
Copy link

@ldx ldx commented Mar 25, 2012

The file specified by this option may contain CFLAGS that will be
added to the compiler. If you e.g. already use clang_complete and
set up a .clang_complete configuration file with compiler flags
that can be used here without any modification.

The file specified by this option may contain CFLAGS that will be
added to the compiler. If you e.g. already use clang_complete and
set up a .clang_complete configuration file with compiler flags
that can be used here without any modification.
@scrooloose
Copy link
Collaborator

@kongo2002 is in charge of the c/c++ syntax checkers, so I will wait for his feedback on this.

I would suggest shifting the parseConfig() function out into autoload/syntastic/c.vim to keep things clean/consistent.

@xuhdev
Copy link
Contributor

xuhdev commented Mar 27, 2012

I think, it would be better if the flag is stored in a file in current directory, such as .syntastic_c_cflags, since usually files in different projects require different flags.

@kongo2002
Copy link
Collaborator

I think I like the idea of a separate configuration file like .syntastic_c_config. Moreover a file like this could be used for other things, like additional include paths as well.

I'll look into this later today.

@xuhdev
Copy link
Contributor

xuhdev commented Mar 27, 2012

I would much prefer it if this could be integrated with clang_complete plugin. Clang_complete reads .clang_complete in the directory or upper directory with the C or C++ source file. I think there should be some way to integrate them.

@Rip-Rip

@@ -68,6 +73,38 @@ if !exists('g:syntastic_c_compiler_options')
let g:syntastic_c_compiler_options = '-std=gnu99'
endif

" This function was stolen from clang_complete
function! s:parseConfig(file)
let l:local_conf = findfile(a:file, getcwd() . ',.;')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To find config file starting the search from the directory of the file opened in vim (instead of cwd):


@ldx
Copy link
Author

ldx commented Mar 27, 2012

@xuhdev that's what the diff does, I just set g:syntastic_c_cflags_file to '.clang_complete'. Perhaps it'd be event better to start the search for the config file from the directory of the source file opened in vim, instead of cwd (see note above).

@xuhdev
Copy link
Contributor

xuhdev commented Mar 27, 2012

@ldx I agree with this. Yes, making g:syntastic_c_cflags_file customizable is enough for me.

But I was wondering whether we could make a fundamental layer for all the plugins requiring a configuration in the directory where the source file locates for vim (and maybe for other editors). I am current working on a project called EditorConfig, which should be proper for this situation. Maybe I could try to do something for this (for both syntastic and clang_complete).

However, a basic configuration as @ldx has done is necessary.

Thank you very much for your patch.

@scrooloose
Copy link
Collaborator

I have merged in #220 which which makes the changes as discussed. Try it out!

Any comments or suggestions can be posted here :)

If configuration files are implemented for another language then I will definitely try to write a general architecture for it in the syntastic core - but lets focus on that when it happens.

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

Successfully merging this pull request may close these issues.

4 participants