Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / native_client / tests / toolchain / initfini_attributes.c
1 /*
2  * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7 #include <stdio.h>
8
9
10 __attribute__((constructor))
11 static void init_func(void) {
12   printf("init_func with default priority\n");
13 }
14
15 __attribute__((constructor(200)))
16 static void init_func200(void) {
17   printf("init_func with priority 200\n");
18 }
19
20 __attribute__((constructor(300)))
21 static void init_func300(void) {
22   printf("init_func with priority 300\n");
23 }
24
25 __attribute__((destructor))
26 static void fini_func(void) {
27   printf("fini_func with default priority\n");
28 }
29
30 __attribute__((destructor(200)))
31 static void fini_func200(void) {
32   printf("fini_func with priority 200\n");
33 }
34
35 __attribute__((destructor(300)))
36 static void fini_func300(void) {
37   printf("fini_func with priority 300\n");
38 }
39
40 int main(void) {
41   printf("in main()\n");
42   return 0;
43 }