This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Add -iquote support


We need a way for a user to be able to use a conflicting header file in their project, as well as on the system and #include <> to get the system one, and #include "" to get their local one. Normally -I- does this just fine, but, it has one small problem. This disables looking in the containing directory for additional #includes. In trivial projects that only have headers at the top level, one can put in a -I. at just the right spot and pick them up, but in less trivial software, putting in -Idir for all the places is, well, annoying.

So, the solutions that come to mind, would be to add a flag that allows one to not turn off searching in the local directory when -I- is used, or another flag to take the place of -I- that does what it does, but does not turn off searching in local directories, or add an option like -iquote, which would be the same as adding the directory to the end of the quote chain.

-iquote dir1 -iquote dir2

== -I dir1 -I dir2 -I- (without turning off searching in the containing directory)


Which option do people like best? All of them are trivial enough to implement, as all the required semantics are in the existing code, just no way to select those semantics.


See split_quote_chain where we do quote_ignores_source_dir = true; for the semantic I want to avoid.

Another option, if people want this to be target dependent would be to add an -m option that sets pfile->quote_ignore_source_dir to false; though, I don't think I prefer that one.


The one we like best is -iquote, as it directly controls what we want to control. It allows people to avoid -I- which is good as -I- makes the -I options more position dependent then is reasonable.


Ok?

Attachment: iquote.diffs.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]