Return True if the given variable attribute is supported.
(cmd, attribute)
| 131 | |
| 132 | |
| 133 | def check_gcc_variable_attribute(cmd, attribute): |
| 134 | """Return True if the given variable attribute is supported.""" |
| 135 | cmd._check_compiler() |
| 136 | body = textwrap.dedent(""" |
| 137 | #pragma GCC diagnostic error "-Wattributes" |
| 138 | #pragma clang diagnostic error "-Wattributes" |
| 139 | |
| 140 | int %s foo; |
| 141 | |
| 142 | int |
| 143 | main() |
| 144 | { |
| 145 | return 0; |
| 146 | } |
| 147 | """) % (attribute, ) |
| 148 | return cmd.try_compile(body, None, None) != 0 |
no test coverage detected