OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

sarif message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: example include file path in tool output


Below is the output from gcc that demonstrates a tool showing how a file referenced in a result was included in the compilation unit.

There are three files a.c (that is compilation source file), a.h (included by a.c), and foo.c (that is included by a.h.

Jim



--------------------------------------------------------------------------------
a.c
--------------------------------------------------------------------------------
#include <stdio.h>
#include "a.h"

int main(int argc, char **argv)
{
    foo(argc, argv);
}


--------------------------------------------------------------------------------
a.h
--------------------------------------------------------------------------------
#include "foo.c"


--------------------------------------------------------------------------------
foo.c
--------------------------------------------------------------------------------
void foo(void)
{
    printf("hello world\n");
}


--------------------------------------------------------------------------------
output of running:   gcc -Wall -Wextra a.c
--------------------------------------------------------------------------------
a.c: In function ‘main’:
a.c:6:5: error: too many arguments to function ‘foo’
     foo(argc, argv);
     ^
In file included from a.h:1:0,
                 from a.c:2:
foo.c:1:6: note: declared here
 void foo(void)
      ^



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]