Project

General

Profile

Bug #454

cpp replacement fails to search paths given with -I for #include <foo/bar.itp>

Added by Teemu Murtola over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
mdrun
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

With git master, if a topology file contains a line like
#include <foo/bar.itp>
it only works if foo is in the current directory, or in the directory given with GMXLIB, but not if foo is in a directory given with -I. In 4.0.7, it worked if foo is in the current directory, and kind of worked (due to fortunate cancellation of errors, and if bar.itp didn't include anything) also if foo was in a directory given with -I, but not with GMXLIB.

Most of the code to handle all these cases is already there in src/gmxlib/gmxcpp.c, but it's called in the wrong order (gmxlibfn gives a fatal error if it doesn't find the directory before the code even checks for the -I paths). Some additional code would be needed to correctly handle cases where bar.itp is in a -I path and includes other files.

I can try to get this working. I think the best way would be to search the current directory first, then all the paths given with -I, and finally the GMXLIB path. With some additional work, we could perhaps also support the difference between <> and "" as cpp does, but that's probably less important. Any comments?

History

#1 Updated by Teemu Murtola over 9 years ago

I fixed the search order in the gmxcpp code, but didn't test it very thoroughly, but some additional testing might be in order. I'll mark the bug fixed, but there might be things to improve in the new code as well.

Also available in: Atom PDF