[PATCH] D46300: [Clang] Implement function attribute no_stack_protector.

Manoj Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 7 12:40:16 PDT 2018


manojgupta added inline comments.


================
Comment at: include/clang/Basic/Attr.td:1494
+def NoStackProtector : InheritableAttr {
+  let Spellings = [GCC<"no_stack_protector">];
+  let Subjects = SubjectList<[Function]>;
----------------
aaron.ballman wrote:
> This is not a GCC attribute, so this should use the Clang spelling.
> 
> However, why spell the attribute this way rather than use the GCC spelling (`optimize("no-stack-protector")`?
Thanks, I have changed it to use Clang spelling.

Regarding __attribute__((optimize("..."))), it is a generic facility in GCC that works for many optimizer flags.
Clang currently does not support this syntax currently instead preferring its own version for some options e.g. -O0. 
e.g.  
```
__attribute__((optimize("O0")))  // clang version is __attribute__((optnone)) 
```
If we want to support the GCC syntax, future expectation would be support more flags under this syntax. Is that the path we want to take (I do not know the history related to previous syntax decisions but better GCC compatibility will be a nice thing to have) 


Repository:
  rC Clang

https://reviews.llvm.org/D46300





More information about the cfe-commits mailing list