On Tue, 22 Jan 2019, Timur Tabi wrote:

> Let's say I have these files:
>
> dir1/dir2/dir3/file1.h
> dir1/dir2/dir4/dir5/file2.c
>
> In file2.c, I have this include statement:
>
> #include "../../dir3/file1.h"
>
> This works if I compile the file when I'm in the dir5 directory.
>
> However, if I am in the dir4 directory and do this:
>
> spatch ... ./dir5/file2.c
>
> I will get this error:
>
> Fatal error: exception Sys_error("../../dir3/file1.h": No such file or
> directory")
>
> which is technically true, but so what?  Does spatch actually try to
> read the contents of file1.h?  If not, why does it care whether the
> file exists?  And why doesn't it just ignore the #include line?

If you get such a message, it means that the options were such that it
wants to read the header file.  By default, the option is --local-includes
which includes things mentioned with " " and headers with the same name as
the .c file.

I guess that it is not interpreting the ../ properly, at least when you
specify a path to a specific file.

If you want all the header files to be ignored, just give the argument
--no-includes.  If you give the argument --include-headers and give spatch
the name of a directory or of a .h file, it will process individually the
.h files as well as the .c files

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to