[erlang-patches] fix include path behaviour in epp

Henrik Nord <>
Tue Jun 14 17:00:36 CEST 2011

On 06/14/2011 04:18 PM, Richard Carlsson wrote:
> I thought include files were working, after I submitted a patch back 
> in the R11 days, but it turns out I'm an idiot and I had only fixed 
> the most important special case involving include_lib.
> The following patch makes the Erlang preprocessor behave as is 
> expected of a C-style preprocessor, which is to always look for 
> include files relative to the parent file first, also when includes 
> are nested:
> git fetch git://github.com/richcarl/otp.git epp-include-path-fix
> For example, suppose src/foo.erl contains -include("stuff/foo.hrl"), 
> and the preprocessor manages to open src/stuff/foo.hrl (even though 
> this subdirectory is not in the include path passed to the compiler). 
> This works today, because the directory of the source file ("src" in 
> this case) is always passed to the preprocessor.
> However, suppose src/stuff/foo.hrl contains -include("bar.hrl") and 
> src/stuff/bar.hrl exists. Without this patch, the preprocessor does 
> not know to look for bar.hrl in the directory of foo.hrl, even though 
> that is the first place it _ought_ to look (at least in C programming 
> tradition), so the user has to make sure to explicitly pass 
> "src/stuff" as part of the include path. In some build systems, this 
> can be a royal pain. The patch fixes this, and should arguably not 
> break any build that is not already broken by definition.
> (It also means that the compiler no longer needs to pass the directory 
> of the main source file as part of the include path, since that is now 
> handled automatically, but that is not part of this patch.)
>    /Richard
> _______________________________________________
> erlang-patches mailing list
> http://erlang.org/mailman/listinfo/erlang-patches

Thank you. I have included your patch into 'pu',
after rewording the commit message. Please see:

* Imperative form
* Line break the message
* No trailing dot on the summary line

/Henrik Nord Erlang/OTP

More information about the erlang-patches mailing list