flycheck/flycheck — pull request #283 by mitchty (2013-12-19 14:08:26+00:00)
Title: Have a way to specify optional extensions to clang for C11

So, not sure how to go about this so I'll ask in an issue. But in C11, anonymous structs/unions aren't actually included when you specify -std=c11. However, much like gcc you can enable them rather easily for use.

Now the warning bit aka -Wno-microsoft is easy enough to add right now, but is there a way I could specify the -fms-extensions?

Example C:
https://gist.github.com/7864888

Compiling with just -std=c11, clang (rightfully) complains about this.
```
clang -lm -g -Wall -std=c11 -o /tmp/test /tmp/c11_anonymous_struct_union.c
/tmp/c11_anonymous_struct_union.c:20:46: error: no member named 'x' in
'point3d_s'
double length3d(point3d_s p) { return sqrt(p.x * p.x + p.y * p.y + p.z * p.z); }
~ ^
/tmp/c11_anonymous_struct_union.c:20:52: error: no member named 'x' in
'point3d_s'
double length3d(point3d_s p) { return sqrt(p.x * p.x + p.y * p.y + p.z * p.z); }
~ ^
/tmp/c11_anonymous_struct_union.c:20:58: error: no member named 'y' in
'point3d_s'
double length3d(point3d_s p) { return sqrt(p.x * p.x + p.y * p.y + p.z * p.z); }
~ ^
/tmp/c11_anonymous_struct_union.c:20:64: error: no member named 'y' in
'point3d_s'
double length3d(point3d_s p) { return sqrt(p.x * p.x + p.y * p.y + p.z * p.z); }
~ ^
/tmp/c11_anonymous_struct_union.c:23:23: error: field designator 'x' does not
refer to any field in type 'point3d_s'
point3d_s demo = { .x = 3, .y = 0, .z = 4 };
^
/tmp/c11_anonymous_struct_union.c:23:31: error: field designator 'y' does not
refer to any field in type 'point3d_s'
point3d_s demo = { .x = 3, .y = 0, .z = 4 };
^
6 errors generated.
```

But when you compile it with the correct feature flag no worries:
```
clang -lm -g -Wall -std=c11 -o /tmp/test /tmp/c11_anonymous_struct_union.c -fms-extensions -Wno-microsoft && /tmp/test
distance from the origin is 5
projection onto a 2d plan is 3 from origin
```

I looked at the definition and don't think there is currently a method for optionally specifying -f flags (even if they might be really really bad to add, i understand the rabbit hole this might cause). Could this particular flag be optional much like the rtti flag?

If anythings unclear let me know, especially if I missed where the -f flags can be added to thanks!

Flycheck is great by the way, makes writing c with clang so much nicer. (well that and clang-format but thats all clang really).

Tshuß!