cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Timur Tabi <timur@kernel.org>
Cc: cocci <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Fatal exception in spatch when #include file does not exist
Date: Tue, 22 Jan 2019 20:44:00 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.21.1901222040260.2519@hadrien> (raw)
In-Reply-To: <CAOZdJXUhfSskY8+i3Juf8t4-obp9nu=c0CXriNbPBoGj6ZMeVQ@mail.gmail.com>



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
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  reply	other threads:[~2019-01-22 19:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 19:31 [Cocci] Fatal exception in spatch when #include file does not exist Timur Tabi
2019-01-22 19:44 ` Julia Lawall [this message]
2019-01-22 20:39   ` Timur Tabi
2019-01-22 20:48     ` Julia Lawall
2019-01-22 22:06       ` Timur Tabi
     [not found]         ` <b73ba628-ee07-5962-0f17-72cebfa14954@users.sourceforge.net>
2019-01-23 16:14           ` [Cocci] Source code adjustments in header files? Timur Tabi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.1901222040260.2519@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=timur@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).