view gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

/* Test C2x maybe_unused attribute: duplicates.  */
/* { dg-do compile } */
/* { dg-options "-std=c2x -pedantic-errors" } */

[[maybe_unused, __maybe_unused__]] int a; /* { dg-error "can appear at most once" } */
[[__maybe_unused__, maybe_unused]] int b; /* { dg-error "can appear at most once" } */
int c [[maybe_unused, maybe_unused]]; /* { dg-error "can appear at most once" } */
[[maybe_unused, maybe_unused]]; /* { dg-error "can appear at most once" } */
/* { dg-error "ignored" "ignored" { target *-*-* } .-1 } */

/* Separate attribute lists in the same attribute specifier sequence,
   with the same attribute in them, are OK.  */
[[maybe_unused]] [[maybe_unused]] int d [[maybe_unused]] [[maybe_unused]];