| 1 |
/* { dg-do compile } |
| 2 |
{ dg-options "-Wall -Wattributes -ftrack-macro-expansion=0" } */ |
| 3 |
|
| 4 |
#define ATTR(attrlist) __attribute__ (attrlist) |
| 5 |
|
| 6 |
/* Exercise the handling of the mutually exclusive attributes |
| 7 |
aligned and packed on a type definition. */ |
| 8 |
|
| 9 |
/* Pointless but benign. */ |
| 10 |
struct ATTR ((aligned, aligned)) |
| 11 |
AlignedAligned { int i; }; |
| 12 |
|
| 13 |
/* Aligned followed by packed on a type and vice versa has a valid use: |
| 14 |
to decrease the alignment of a type to the specified boundary. */ |
| 15 |
struct ATTR ((aligned, packed)) |
| 16 |
AlignedPacked { int i; }; |
| 17 |
|
| 18 |
struct ATTR ((packed, aligned)) |
| 19 |
PackedAligned { int i; }; |
| 20 |
|
| 21 |
struct ATTR ((aligned (2))) |
| 22 |
AlignedMemberPacked |
| 23 |
{ |
| 24 |
int ATTR ((packed)) i; // { dg-warning "attribute ignored" "" { target default_packed } } |
| 25 |
}; |
| 26 |
|
| 27 |
struct ATTR ((packed)) |
| 28 |
PackedMemberAligned |
| 29 |
{ |
| 30 |
int ATTR ((aligned (2))) i; |
| 31 |
}; |
| 32 |
|
| 33 |
/* Silly but benign. */ |
| 34 |
struct ATTR ((packed, packed)) |
| 35 |
PackedPacked { int i; }; |
| 36 |
|
| 37 |
|
| 38 |
/* Exercise the handling of the mutually exclusive attributes |
| 39 |
aligned and packed on a function declaration. */ |
| 40 |
|
| 41 |
void ATTR ((aligned (8), packed)) |
| 42 |
faligned8_1 (void); /* { dg-warning "ignoring attribute .packed. because it conflicts with attribute .aligned." } */ |
| 43 |
|
| 44 |
void ATTR ((aligned (8))) |
| 45 |
faligned8_2 (void); /* { dg-message "previous declaration here" } */ |
| 46 |
|
| 47 |
void ATTR ((packed)) |
| 48 |
faligned8_2 (void); /* { dg-warning "ignoring attribute .packed. because it conflicts with attribute .aligned." } */ |
| 49 |
|
| 50 |
/* Exercise the handling of the mutually exclusive attributes |
| 51 |
always_inline and noinline (in that order). */ |
| 52 |
|
| 53 |
inline void ATTR ((always_inline)) |
| 54 |
falways_inline1 (void); |
| 55 |
|
| 56 |
inline void ATTR ((__always_inline__)) |
| 57 |
falways_inline1 (void); |
| 58 |
|
| 59 |
/* Verify that repeating attribute always_inline on the same declaration |
| 60 |
doesn't trigger a warning. */ |
| 61 |
inline void ATTR ((always_inline, __always_inline__)) |
| 62 |
falways_inline1 (void); |
| 63 |
|
| 64 |
/* Verify that repeating attribute always_inline on a distinct declaration |
| 65 |
doesn't trigger a warning. */ |
| 66 |
inline void ATTR ((always_inline)) |
| 67 |
falways_inline1 (void); /* { dg-message "previous declaration here" } */ |
| 68 |
|
| 69 |
/* Verify a warning for noinline conflict. */ |
| 70 |
void ATTR ((noinline)) |
| 71 |
falways_inline1 (void) { } /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */ |
| 72 |
|
| 73 |
/* And again. */ |
| 74 |
void ATTR ((always_inline)) |
| 75 |
falways_inline1 (void); |
| 76 |
|
| 77 |
|
| 78 |
/* Exercise the handling of the mutually exclusive attributes |
| 79 |
noinline and always_inline (in that order). */ |
| 80 |
|
| 81 |
void ATTR ((noinline)) |
| 82 |
fnoinline1 (void); |
| 83 |
|
| 84 |
void ATTR ((__noinline__)) |
| 85 |
fnoinline1 (void); |
| 86 |
|
| 87 |
/* Verify that repeating attribute noinline on the same declaration |
| 88 |
doesn't trigger a warning. */ |
| 89 |
void ATTR ((noinline, __noinline__)) |
| 90 |
fnoinline1 (void); |
| 91 |
|
| 92 |
/* Verify that repeating attribute noinline on a distinct declaration |
| 93 |
doesn't trigger a warning. */ |
| 94 |
void ATTR ((noinline)) |
| 95 |
fnoinline1 (void); /* { dg-message "previous declaration here" } */ |
| 96 |
|
| 97 |
/* Verify a warning for always_inline conflict. */ |
| 98 |
void ATTR ((always_inline)) |
| 99 |
fnoinline1 (void) { } /* { dg-warning "ignoring attribute .always_inline. because it conflicts with attribute .noinline." } */ |
| 100 |
/* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ |
| 101 |
/* { dg-note "previous definition" "" { target *-*-* } .-2 } */ |
| 102 |
|
| 103 |
/* Verify a warning for gnu_inline conflict. */ |
| 104 |
inline void ATTR ((gnu_inline)) |
| 105 |
fnoinline1 (void); /* { dg-warning "ignoring attribute .gnu_inline. because it conflicts with attribute .noinline." } */ |
| 106 |
/* { dg-warning "follows declaration with attribute .noinline." "inline noinline" { target *-*-* } .-1 } */ |
| 107 |
|
| 108 |
/* And again. */ |
| 109 |
void ATTR ((noinline)) |
| 110 |
fnoinline1 (void); /* { dg-warning "follows inline declaration" } */ |
| 111 |
|
| 112 |
|
| 113 |
/* Exercise the handling of the mutually exclusive attributes |
| 114 |
noreturn and warn_unused_result. */ |
| 115 |
|
| 116 |
int ATTR ((__noreturn__)) |
| 117 |
fnoret1 (void); |
| 118 |
|
| 119 |
int ATTR ((noreturn)) |
| 120 |
fnoret1 (void); /* { dg-message "previous declaration here" } */ |
| 121 |
|
| 122 |
int ATTR ((warn_unused_result)) |
| 123 |
fnoret1 (void); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */ |
| 124 |
|
| 125 |
/* Verify that repeating attribute noreturn doesn't trigger a warning. */ |
| 126 |
int ATTR ((noreturn)) fnoret1 (void); |
| 127 |
|
| 128 |
int call_noret1 (void) |
| 129 |
{ |
| 130 |
/* Verify that attribute warn_unused_result was, in fact, ignored |
| 131 |
on the second declaration of fnoret1. */ |
| 132 |
fnoret1 (); |
| 133 |
} |
| 134 |
|
| 135 |
int ATTR ((noreturn, warn_unused_result)) |
| 136 |
fnoret2 (void); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */ |
| 137 |
|
| 138 |
/* Verify that repeating attribute noreturn doesn't trigger a warning. */ |
| 139 |
int ATTR ((noreturn)) fnoret2 (void); |
| 140 |
|
| 141 |
int call_noret2 (void) |
| 142 |
{ |
| 143 |
/* Verify that attribute warn_unused_result was, in fact, ignored |
| 144 |
on the second declaration of fnoret2. */ |
| 145 |
fnoret2 (); |
| 146 |
} |
| 147 |
|
| 148 |
/* Verify that attribute noreturn isn't diagnosed on a declaration |
| 149 |
that was previously declared warn_unused_result and that attribute |
| 150 |
was dropped (because the function returs void). */ |
| 151 |
|
| 152 |
void ATTR ((warn_unused_result)) |
| 153 |
fnorety6 (void); /* { dg-warning ".warn_unused_result. attribute ignored" } */ |
| 154 |
|
| 155 |
void ATTR ((noreturn)) |
| 156 |
fnoret6 (void); |
| 157 |
|
| 158 |
|
| 159 |
/* Exercise the handling of the mutually exclusive attributes |
| 160 |
noreturn and alloc_align. */ |
| 161 |
|
| 162 |
void* ATTR ((noreturn)) |
| 163 |
fnoret_alloc_align1 (int); /* { dg-message "previous declaration here" } */ |
| 164 |
|
| 165 |
void* ATTR ((alloc_align (1))) |
| 166 |
fnoret_alloc_align1 (int); /* { dg-warning "ignoring attribute .alloc_align. because it conflicts with attribute .noreturn." } */ |
| 167 |
|
| 168 |
void* ATTR ((noreturn, alloc_align (1))) |
| 169 |
fnoret_alloc_align2 (int); /* { dg-warning "ignoring attribute .alloc_align. because it conflicts with attribute .noreturn." } */ |
| 170 |
|
| 171 |
|
| 172 |
void* ATTR ((noreturn)) ATTR ((alloc_align (1))) |
| 173 |
fnoret_alloc_align3 (int); /* { dg-warning "ignoring attribute .alloc_align. because it conflicts with attribute .noreturn." } */ |
| 174 |
|
| 175 |
|
| 176 |
void* ATTR ((alloc_align (1))) |
| 177 |
falloc_align_noret1 (int); /* { dg-message "previous declaration here" } */ |
| 178 |
|
| 179 |
void* ATTR ((noreturn)) |
| 180 |
falloc_align_noret1 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .alloc_align." } */ |
| 181 |
|
| 182 |
|
| 183 |
void* ATTR ((alloc_align (1), noreturn)) |
| 184 |
falloc_align_noret2 (int); /* { dg-warning "ignoring attribute .(noreturn|alloc_align). because it conflicts with attribute .(alloc_align|noreturn)." } */ |
| 185 |
|
| 186 |
void* ATTR ((alloc_align (1))) ATTR ((noreturn)) |
| 187 |
falloc_align_noret3 (int); /* { dg-warning "ignoring attribute .(noreturn|alloc_align). because it conflicts with attribute .(noreturn|alloc_align)." } */ |
| 188 |
|
| 189 |
|
| 190 |
/* Exercise the handling of the mutually exclusive attributes |
| 191 |
noreturn and alloc_size. */ |
| 192 |
|
| 193 |
void* ATTR ((noreturn)) |
| 194 |
fnoret_alloc_size1 (int); /* { dg-message "previous declaration here" } */ |
| 195 |
|
| 196 |
void* ATTR ((alloc_size (1))) |
| 197 |
fnoret_alloc_size1 (int); /* { dg-warning "ignoring attribute .alloc_size. because it conflicts with attribute .noreturn." } */ |
| 198 |
|
| 199 |
void* ATTR ((noreturn, alloc_size (1))) |
| 200 |
fnoret_alloc_size2 (int); /* { dg-warning "ignoring attribute .alloc_size. because it conflicts with attribute .noreturn." } */ |
| 201 |
|
| 202 |
|
| 203 |
void* ATTR ((noreturn)) ATTR ((alloc_size (1))) |
| 204 |
fnoret_alloc_size3 (int); /* { dg-warning "ignoring attribute .alloc_size. because it conflicts with attribute .noreturn." } */ |
| 205 |
|
| 206 |
|
| 207 |
void* ATTR ((alloc_size (1))) |
| 208 |
falloc_size_noret1 (int); /* { dg-message "previous declaration here" } */ |
| 209 |
|
| 210 |
void* ATTR ((noreturn)) |
| 211 |
falloc_size_noret1 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .alloc_size." } */ |
| 212 |
|
| 213 |
|
| 214 |
void* ATTR ((alloc_size (1), noreturn)) |
| 215 |
falloc_size_noret2 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .alloc_size." } */ |
| 216 |
|
| 217 |
void* ATTR ((alloc_size (1))) ATTR ((noreturn)) |
| 218 |
falloc_size_noret3 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .alloc_size." } */ |
| 219 |
|
| 220 |
|
| 221 |
/* Exercise the handling of the mutually exclusive attributes |
| 222 |
noreturn and const. */ |
| 223 |
|
| 224 |
int ATTR ((noreturn)) |
| 225 |
fnoret_const1 (int); /* { dg-message "previous declaration here" } */ |
| 226 |
|
| 227 |
int ATTR ((const)) |
| 228 |
fnoret_const1 (int); /* { dg-warning "ignoring attribute .const. because it conflicts with attribute .noreturn." } */ |
| 229 |
|
| 230 |
/* Unfortunately, attributes on a single declarations may not be processed |
| 231 |
in the same order as specified... */ |
| 232 |
int ATTR ((noreturn, const)) |
| 233 |
fnoret_const2 (int); /* { dg-warning "ignoring attribute .const. because it conflicts with attribute .noreturn." } */ |
| 234 |
|
| 235 |
|
| 236 |
int ATTR ((noreturn)) ATTR ((const)) |
| 237 |
fnoret_const3 (int); /* { dg-warning "ignoring attribute .const. because it conflicts with attribute .noreturn." } */ |
| 238 |
|
| 239 |
|
| 240 |
int ATTR ((const)) |
| 241 |
fconst_noret1 (int); /* { dg-message "previous declaration here" } */ |
| 242 |
|
| 243 |
int ATTR ((noreturn)) |
| 244 |
fconst_noret1 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .const." } */ |
| 245 |
|
| 246 |
|
| 247 |
int ATTR ((const, noreturn)) |
| 248 |
fconst_noret2 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .const." } */ |
| 249 |
|
| 250 |
int ATTR ((const)) ATTR ((noreturn)) |
| 251 |
fconst_noret3 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .const." } */ |
| 252 |
|
| 253 |
|
| 254 |
/* Exercise the handling of the mutually exclusive attributes |
| 255 |
noreturn and malloc. */ |
| 256 |
|
| 257 |
void* ATTR ((noreturn)) |
| 258 |
fnoret_malloc1 (int); /* { dg-message "previous declaration here" } */ |
| 259 |
|
| 260 |
void* ATTR ((malloc)) |
| 261 |
fnoret_malloc1 (int); /* { dg-warning "ignoring attribute .malloc. because it conflicts with attribute .noreturn." } */ |
| 262 |
|
| 263 |
/* Unfortunately, attributes on a single declarations may not be processed |
| 264 |
in the same order as specified... */ |
| 265 |
void* ATTR ((noreturn, malloc)) |
| 266 |
fnoret_malloc2 (int); /* { dg-warning "ignoring attribute .malloc. because it conflicts with attribute .noreturn." } */ |
| 267 |
|
| 268 |
|
| 269 |
void* ATTR ((noreturn)) ATTR ((malloc)) |
| 270 |
fnoret_malloc3 (int); /* { dg-warning "ignoring attribute .malloc. because it conflicts with attribute .noreturn." } */ |
| 271 |
|
| 272 |
|
| 273 |
void* ATTR ((__malloc__)) |
| 274 |
fmalloc_noret1 (int); |
| 275 |
|
| 276 |
void* ATTR ((malloc)) |
| 277 |
fmalloc_noret1 (int); /* { dg-message "previous declaration here" } */ |
| 278 |
|
| 279 |
void* ATTR ((noreturn)) |
| 280 |
fmalloc_noret1 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .malloc." } */ |
| 281 |
|
| 282 |
|
| 283 |
void* ATTR ((malloc, noreturn)) |
| 284 |
fmalloc_noret2 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .malloc." } */ |
| 285 |
|
| 286 |
void* ATTR ((malloc)) ATTR ((noreturn)) |
| 287 |
fmalloc_noret3 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .malloc." } */ |
| 288 |
|
| 289 |
|
| 290 |
/* Exercise the handling of the mutually exclusive attributes |
| 291 |
noreturn and pure. */ |
| 292 |
|
| 293 |
int ATTR ((noreturn)) |
| 294 |
fnoret_pure1 (int); /* { dg-message "previous declaration here" } */ |
| 295 |
|
| 296 |
int ATTR ((pure)) |
| 297 |
fnoret_pure1 (int); /* { dg-warning "ignoring attribute .pure. because it conflicts with attribute .noreturn." } */ |
| 298 |
|
| 299 |
/* Unfortunately, attributes on a single declarations may not be processed |
| 300 |
in the same order as specified... */ |
| 301 |
int ATTR ((noreturn, pure)) |
| 302 |
fnoret_pure2 (int); /* { dg-warning "ignoring attribute .pure. because it conflicts with attribute .noreturn." } */ |
| 303 |
|
| 304 |
|
| 305 |
int ATTR ((noreturn)) ATTR ((pure)) |
| 306 |
fnoret_pure3 (int); /* { dg-warning "ignoring attribute .pure. because it conflicts with attribute .noreturn." } */ |
| 307 |
|
| 308 |
|
| 309 |
int ATTR ((__pure__)) |
| 310 |
fpure_noret1 (int); |
| 311 |
|
| 312 |
int ATTR ((pure)) |
| 313 |
fpure_noret1 (int); /* { dg-message "previous declaration here" } */ |
| 314 |
|
| 315 |
int ATTR ((noreturn)) |
| 316 |
fpure_noret1 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .pure." } */ |
| 317 |
|
| 318 |
|
| 319 |
int ATTR ((pure, noreturn)) |
| 320 |
fpure_noret2 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .pur." } */ |
| 321 |
|
| 322 |
int ATTR ((pure)) ATTR ((noreturn)) |
| 323 |
fpure_noret3 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .pure." } */ |
| 324 |
|
| 325 |
|
| 326 |
/* Exercise the handling of the mutually exclusive attributes |
| 327 |
noreturn and returns_twice. */ |
| 328 |
|
| 329 |
int ATTR ((noreturn)) |
| 330 |
fnoret_returns_twice1 (int); /* { dg-message "previous declaration here" } */ |
| 331 |
|
| 332 |
int ATTR ((returns_twice)) |
| 333 |
fnoret_returns_twice1 (int); /* { dg-warning "ignoring attribute .returns_twice. because it conflicts with attribute .noreturn." } */ |
| 334 |
|
| 335 |
/* Unfortunately, attributes on a single declarations may not be processed |
| 336 |
in the same order as specified... */ |
| 337 |
int ATTR ((noreturn, returns_twice)) |
| 338 |
fnoret_returns_twice2 (int); /* { dg-warning "ignoring attribute .returns_twice. because it conflicts with attribute .noreturn." } */ |
| 339 |
|
| 340 |
|
| 341 |
int ATTR ((noreturn)) ATTR ((returns_twice)) |
| 342 |
fnoret_returns_twice3 (int); /* { dg-warning "ignoring attribute .returns_twice. because it conflicts with attribute .noreturn." } */ |
| 343 |
|
| 344 |
|
| 345 |
int ATTR ((returns_twice)) |
| 346 |
freturns_twice_noret1 (int); /* { dg-message "previous declaration here" } */ |
| 347 |
|
| 348 |
int ATTR ((noreturn)) |
| 349 |
freturns_twice_noret1 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .returns_twice." } */ |
| 350 |
|
| 351 |
|
| 352 |
int ATTR ((returns_twice, noreturn)) |
| 353 |
freturns_twice_noret2 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .returns_twice." } */ |
| 354 |
|
| 355 |
int ATTR ((returns_twice)) ATTR ((noreturn)) |
| 356 |
freturns_twice_noret3 (int); /* { dg-warning "ignoring attribute .noreturn. because it conflicts with attribute .returns_twice." } */ |
| 357 |
|
| 358 |
|
| 359 |
/* Exercise the interaction of multiple combinations of mutually |
| 360 |
exclusive attributes specified on distinct declarations. */ |
| 361 |
|
| 362 |
inline int ATTR ((always_inline)) |
| 363 |
finline_cold_noreturn (int); |
| 364 |
|
| 365 |
inline int ATTR ((cold)) |
| 366 |
finline_cold_noreturn (int); |
| 367 |
|
| 368 |
inline int ATTR ((noreturn)) |
| 369 |
finline_cold_noreturn (int); /* { dg-note "previous declaration here" } */ |
| 370 |
|
| 371 |
inline int ATTR ((noinline)) |
| 372 |
finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */ |
| 373 |
/* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ |
| 374 |
|
| 375 |
inline int ATTR ((hot)) |
| 376 |
finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .hot. because it conflicts with attribute .cold." } */ |
| 377 |
/* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ |
| 378 |
|
| 379 |
inline int ATTR ((warn_unused_result)) |
| 380 |
finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */ |
| 381 |
|
| 382 |
inline int ATTR ((always_inline)) |
| 383 |
finline_cold_noreturn (int); |
| 384 |
|
| 385 |
/* Expect no warning for the missing return statement below because |
| 386 |
the function is noreturn. */ |
| 387 |
inline int ATTR ((noreturn)) |
| 388 |
finline_cold_noreturn (int i) { (void)&i; __builtin_abort (); } |
| 389 |
|
| 390 |
|
| 391 |
/* Exercise the interaction of multiple combinations of mutually |
| 392 |
exclusive attributes with some specified on the same declaration |
| 393 |
and some on distinct declarations. */ |
| 394 |
|
| 395 |
inline int ATTR ((always_inline, hot)) |
| 396 |
finline_hot_noret_align (int); /* { dg-note "previous declaration here" } */ |
| 397 |
|
| 398 |
inline int ATTR ((noreturn, noinline)) |
| 399 |
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */ |
| 400 |
/* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ |
| 401 |
|
| 402 |
inline int ATTR ((cold, aligned (8))) |
| 403 |
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .cold. because it conflicts with attribute .hot." } */ |
| 404 |
/* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ |
| 405 |
|
| 406 |
inline int ATTR ((warn_unused_result)) |
| 407 |
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */ |
| 408 |
/* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ |
| 409 |
|
| 410 |
inline int ATTR ((aligned (4))) |
| 411 |
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(8\\)." "" } */ |
| 412 |
|
| 413 |
inline int ATTR ((aligned (8))) |
| 414 |
finline_hot_noret_align (int); /* { dg-note "previous declaration here" } */ |
| 415 |
|
| 416 |
inline int ATTR ((const)) |
| 417 |
finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .const. because it conflicts with attribute .noreturn." } */ |
| 418 |
|
| 419 |
/* Expect no warning for the missing return statement below because |
| 420 |
the function is noreturn. */ |
| 421 |
inline int ATTR ((noreturn)) |
| 422 |
finline_hot_noret_align (int i) { (void)&i; __builtin_abort (); } |
| 423 |
|
| 424 |
|
| 425 |
/* Expect a warning about conflicting alignment but without |
| 426 |
other declarations inbetween. */ |
| 427 |
inline int ATTR ((aligned (32))) |
| 428 |
finline_align (int); /* { dg-note "previous declaration here" } */ |
| 429 |
|
| 430 |
inline int ATTR ((aligned (4))) |
| 431 |
finline_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(32\\)." "" } */ |
| 432 |
|
| 433 |
inline int ATTR ((noreturn)) |
| 434 |
finline_align (int i) { (void)&i; __builtin_abort (); } |
| 435 |
|
| 436 |
|
| 437 |
/* Expect no note that would refer to the same declaration. */ |
| 438 |
inline int ATTR ((aligned (32), aligned (4))) |
| 439 |
finline_double_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(32\\)." } */ |
| 440 |
|
| 441 |
inline int ATTR ((noreturn)) |
| 442 |
finline_double_align (int i) { (void)&i; __builtin_abort (); } |
| 443 |
|
| 444 |
|
| 445 |
/* Exercise variable attributes. */ |
| 446 |
|
| 447 |
extern int ATTR ((common)) |
| 448 |
decl_common1; /* { dg-message "previous declaration here" } */ |
| 449 |
|
| 450 |
extern int ATTR ((nocommon)) |
| 451 |
decl_common1; /* { dg-warning "ignoring attribute .nocommon. because it conflicts with attribute .common." } */ |
| 452 |
|
| 453 |
|
| 454 |
extern int ATTR ((nocommon)) |
| 455 |
decl_common2; /* { dg-message "previous declaration here" } */ |
| 456 |
|
| 457 |
extern int ATTR ((common)) |
| 458 |
decl_common2; /* { dg-warning "ignoring attribute .common. because it conflicts with attribute .nocommon." } */ |
| 459 |
|
| 460 |
|
| 461 |
extern int ATTR ((common, nocommon)) |
| 462 |
decl_common3; /* { dg-warning "ignoring attribute .nocommon. because it conflicts with attribute .common." } */ |
| 463 |
|
| 464 |
|
| 465 |
extern int ATTR ((common, nocommon)) |
| 466 |
decl_common4; /* { dg-warning "ignoring attribute .nocommon. because it conflicts with attribute .common." } */ |