annotate clang/test/Sema/constructor-attribute.c @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 int x __attribute__((constructor)); // expected-warning {{'constructor' attribute only applies to functions}}
anatofuz
parents:
diff changeset
4 int f() __attribute__((constructor));
anatofuz
parents:
diff changeset
5 int f() __attribute__((constructor(1)));
anatofuz
parents:
diff changeset
6 int f() __attribute__((constructor(1,2))); // expected-error {{'constructor' attribute takes no more than 1 argument}}
anatofuz
parents:
diff changeset
7 int f() __attribute__((constructor(1.0))); // expected-error {{'constructor' attribute requires an integer constant}}
anatofuz
parents:
diff changeset
8 int f() __attribute__((constructor(0x100000000))); // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 int x __attribute__((destructor)); // expected-warning {{'destructor' attribute only applies to functions}}
anatofuz
parents:
diff changeset
11 int f() __attribute__((destructor));
anatofuz
parents:
diff changeset
12 int f() __attribute__((destructor(1)));
anatofuz
parents:
diff changeset
13 int f() __attribute__((destructor(1,2))); // expected-error {{'destructor' attribute takes no more than 1 argument}}
anatofuz
parents:
diff changeset
14 int f() __attribute__((destructor(1.0))); // expected-error {{'destructor' attribute requires an integer constant}}
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16