On 2 August 2014 14:54, Artur Skawina via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > + > +enum noinline = attribute("noinline"); > +enum inline = attribute("forceinline"); > +enum flatten = attribute("flatten"); > > But I'm not sure if exposing `attribute` like that would be > a good idea (until now I was always using a static import, so > name clashes were not a problem); I'd probably rename it to > `__attribute__`. >
This can be done, we can deprecate attribute in favour of __attribute__ and add new enums for shortcut paths to access the internal attributes. One way could be as above, alternatively if name clashing is a problem, then we can always prefix with GNU_ --- enum GNU_forceinline = __attribute__("forceinline"); /* etc... */ auto GNU_target(A...)(A args) if(A.length > 0 && is(A[0] == string)) { return __attribute__("target", args); } --- Then in user code: --- import gcc.attribute; @GNU_forceinline int foobar(); @GNU_target("sse3") float4 mySSE3Func(); --- Regards Iain.