Bug 12139 - SDT V3 fails with structs that are only declared
Summary: SDT V3 fails with structs that are only declared
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-20 02:35 UTC by Josh Stone
Modified: 2011-03-01 22:53 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Josh Stone 2010-10-20 02:35:24 UTC
Using gcc version 4.4.4 20100630 (Red Hat 4.4.4-10) (GCC)

$ cat declared-struct.c
#include <sys/sdt.h>
struct foo;
int main()
{
    struct foo* p = 0;
    STAP_PROBE1(test, foo, p);
    return 0;
}

$ gcc -c declared-struct.c 
declared-struct.c: In function ‘main’:
declared-struct.c:6: error: invalid use of undefined type ‘struct foo’
declared-struct.c:6: error: invalid use of undefined type ‘struct foo’
declared-struct.c:6: error: invalid use of undefined type ‘struct foo’
declared-struct.c:6: error: invalid use of undefined type ‘struct foo’


I think it's complaining about the "+ 0" math on the argument.  If I cast "p" to a void*, it compiles fine.
Comment 1 Josh Stone 2010-10-21 00:02:03 UTC
(In reply to comment #0)
> If I cast "p" to a void*, it compiles fine.
... unless we're -pedantic, and then:

$ gcc -c declared-struct.c -pedantic
declared-struct.c: In function ‘main’:
declared-struct.c:6: warning: pointer of type ‘void *’ used in arithmetic
declared-struct.c:6: warning: pointer of type ‘void *’ used in arithmetic
declared-struct.c:6: warning: pointer of type ‘void *’ used in arithmetic
declared-struct.c:6: warning: pointer of type ‘void *’ used in arithmetic

When cast as char*, int*, etc., it works even with -pedantic.
Comment 2 Josh Stone 2011-03-01 22:53:20 UTC
The sdt.h shipped with 1.4 works fine.