view gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
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]];