brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · fcf855f Raw
40 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3void foo(void);4void foo(void) __attribute__((unused));5void foo(void) __attribute__((unused));6void foo(void){} // expected-note {{previous definition is here}}7void foo(void) __attribute__((constructor)); // expected-warning {{must precede definition}}8void foo(void);9 10int bar;11extern int bar;12int bar;13int bar __attribute__((weak));14int bar __attribute__((used));15extern int bar __attribute__((weak));16int bar = 0; // expected-note {{previous definition is here}}17int bar __attribute__((weak)); // no warning as it matches the existing18                               // attribute.19int bar __attribute__((used,20                       visibility("hidden"))); // expected-warning {{must precede definition}}21int bar;22 23struct zed {  // expected-note {{previous definition is here}}24};25struct __attribute__((visibility("hidden"))) zed; // expected-warning {{must precede definition}}26 27struct __attribute__((visibility("hidden"))) zed2 {28};29struct __attribute__((visibility("hidden"))) zed2;30 31struct __attribute__((visibility("hidden"))) zed3 {  // expected-note {{previous definition is here}}32};33struct __attribute__((visibility("hidden"),34                     packed  // expected-warning {{must precede definition}}35                     )) zed3;36 37struct __attribute__((visibility("hidden"))) zed4 {  // expected-note {{previous attribute is here}}38};39struct __attribute__((visibility("default"))) zed4; // expected-error {{visibility does not match previous declaration}}40