[PATCH] Begin implementing Plan 9 C extensions.

Alex alexchandel at gmail.com
Thu Oct 2 23:34:51 PDT 2014


There are a few other extensions that should be supported. Plan9-style C also supports accessing anonymous structure and union members by type name iff they are declared using a typedef name. For example, `p.Point` in:
```
typedef struct Point
{
    int x, y;
} Point;

struct
{
    int type;
    Point;
} p;

void take(Point* point);
```

It also supports using the address of the parent struct without a cast anywhere that the address of the anonymous member is used, as in `take(p)`. The compiler should automatically promote the type, adjust the address, and suppress the otherwise germane `[-Wincompatible-pointer-types]` warning.

I'm not sure whether these two extensions are leveraged in the Go 1.3 compiler, but they are frequently used in Plan 9 itself, and are necessary for compiling it.

http://reviews.llvm.org/D3853






More information about the cfe-commits mailing list