]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgfortran/caf/libcaf.h
Update copyright years in libgfortran.
[thirdparty/gcc.git] / libgfortran / caf / libcaf.h
CommitLineData
5092eb96 1/* Common declarations for all of GNU Fortran libcaf implementations.
e3c063ce 2 Copyright (C) 2011-2013 Free Software Foundation, Inc.
5092eb96
TB
3 Contributed by Tobias Burnus <burnus@net-b.de>
4
5This file is part of the GNU Fortran Coarray Runtime Library (libcaf).
6
7Libcaf is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12Libcaf is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24<http://www.gnu.org/licenses/>. */
25
26#ifndef LIBCAF_H
27#define LIBCAF_H
28
cc9ae24c
TB
29#include <stdint.h> /* For int32_t. */
30#include <stddef.h> /* For ptrdiff_t. */
31
4054bc52
TB
32#ifndef __GNUC__
33#define __attribute__(x)
34#define likely(x) (x)
35#define unlikely(x) (x)
36#else
37#define likely(x) __builtin_expect(!!(x), 1)
38#define unlikely(x) __builtin_expect(!!(x), 0)
39#endif
5092eb96
TB
40
41/* Definitions of the Fortran 2008 standard; need to kept in sync with
42 ISO_FORTRAN_ENV, cf. libgfortran.h. */
43#define STAT_UNLOCKED 0
44#define STAT_LOCKED 1
45#define STAT_LOCKED_OTHER_IMAGE 2
5d81ddd0 46#define STAT_STOPPED_IMAGE 6000
5092eb96 47
4054bc52
TB
48/* Describes what type of array we are registerring. Keep in sync with
49 gcc/fortran/trans.h. */
cc9ae24c 50typedef enum caf_register_t {
0a1138af
DC
51 CAF_REGTYPE_COARRAY_STATIC,
52 CAF_REGTYPE_COARRAY_ALLOC,
cc9ae24c 53 CAF_REGTYPE_LOCK,
0a1138af 54 CAF_REGTYPE_LOCK_COMP
cc9ae24c
TB
55}
56caf_register_t;
57
0a1138af
DC
58/* Linked list of static coarrays registered. */
59typedef struct caf_static_t {
60 void **token;
61 struct caf_static_t *prev;
62}
63caf_static_t;
64
cc9ae24c 65
5092eb96
TB
66void _gfortran_caf_init (int *, char ***, int *, int *);
67void _gfortran_caf_finalize (void);
68
5d81ddd0 69void * _gfortran_caf_register (ptrdiff_t, caf_register_t, void ***, int *,
4054bc52 70 char *, int);
5d81ddd0 71void _gfortran_caf_deregister (void ***, int *, char *, int);
cc9ae24c
TB
72
73
f5c01f5b
DC
74void _gfortran_caf_sync_all (int *, char *, int);
75void _gfortran_caf_sync_images (int, int[], int *, char *, int);
cc9ae24c
TB
76
77/* FIXME: The CRITICAL functions should be removed;
78 the functionality is better represented using Coarray's lock feature. */
79void _gfortran_caf_critical (void) { }
80void _gfortran_caf_end_critical (void) { }
5092eb96 81
5092eb96 82
cc9ae24c
TB
83void _gfortran_caf_error_stop_str (const char *, int32_t)
84 __attribute__ ((noreturn));
5092eb96
TB
85void _gfortran_caf_error_stop (int32_t) __attribute__ ((noreturn));
86
87#endif /* LIBCAF_H */