X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=libgfortran%2Flibgfortran.h;h=8c539e0898b7b965b728dcb63e99b6fb662698c3;hb=324276ff9b1aa5128e5cb9f5d43182d1ebab0752;hp=6e47a25b22c9e762c7aa483c7486c7cd55726069;hpb=b2ef02df5312169ffd4b0cfce00de2e01a5ff508;p=gcc.git diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 6e47a25b22c..8c539e0898b 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -1,10 +1,9 @@ /* Common declarations for all of libgfortran. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 - Free Software Foundation, Inc. + Copyright (C) 2002-2020 Free Software Foundation, Inc. Contributed by Paul Brook , and Andy Vaught -This file is part of the GNU Fortran 95 runtime library (libgfortran). +This file is part of the GNU Fortran runtime library (libgfortran). Libgfortran is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,10 +40,26 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include -#include +#include #include #include #include +#include + +#if HAVE_COMPLEX_H +/* Must appear before math.h on VMS systems. */ +# include +#else +#define complex __complex__ +#endif + +#include + +/* If we're support quad-precision floating-point type, include the + header to our support library. */ +#ifdef HAVE_FLOAT128 +# include "quadmath_weak.h" +#endif #ifdef __MINGW32__ extern float __strtof (const char *, char **); @@ -59,12 +74,6 @@ extern long double __strtold (const char *, char **); #define gfc_strtold strtold #endif -#if HAVE_COMPLEX_H -# include -#else -#define complex __complex__ -#endif - #include "../gcc/fortran/libgfortran.h" #include "c99_protos.h" @@ -79,6 +88,10 @@ extern long double __strtold (const char *, char **); #include #endif +#ifdef HAVE_SYS_UIO_H +#include +#endif + #ifdef __MINGW32__ typedef off64_t gfc_offset; #else @@ -89,48 +102,30 @@ typedef off_t gfc_offset; #define NULL (void *) 0 #endif -#ifndef __GNUC__ -#define __attribute__(x) -#define likely(x) (x) -#define unlikely(x) (x) -#else + +/* The following macros can be used to annotate conditions which are likely or + unlikely to be true. Avoid using them when a condition is only slightly + more likely/less unlikely than average to avoid the performance penalties of + branch misprediction. In addition, as __builtin_expect overrides the compiler + heuristic, do not use in conditions where one of the branches ends with a + call to a function with __attribute__((noreturn)): the compiler internal + heuristic will mark this branch as much less likely as unlikely() would + do. */ + #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) -#endif +/* This macro can be used to annotate conditions which we know to + be true, so that the compiler can optimize based on the condition. */ -/* We use intptr_t and uintptr_t, which may not be always defined in - system headers. */ +#define GFC_ASSERT(EXPR) \ + ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0)) -#ifndef HAVE_INTPTR_T -#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ -#define intptr_t long -#elif __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__ -#define intptr_t long long -#elif __SIZEOF_POINTER__ == __SIZEOF_INT__ -#define intptr_t int -#elif __SIZEOF_POINTER__ == __SIZEOF_SHORT__ -#define intptr_t short -#else -#error "Pointer type with unexpected size" -#endif +/* Make sure we have ptrdiff_t. */ +#ifndef HAVE_PTRDIFF_T +typedef intptr_t ptrdiff_t; #endif -#ifndef HAVE_UINTPTR_T -#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ -#define uintptr_t unsigned long -#elif __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__ -#define uintptr_t unsigned long long -#elif __SIZEOF_POINTER__ == __SIZEOF_INT__ -#define uintptr_t unsigned int -#elif __SIZEOF_POINTER__ == __SIZEOF_SHORT__ -#define uintptr_t unsigned short -#else -#error "Pointer type with unexpected size" -#endif -#endif - - /* On mingw, work around the buggy Windows snprintf() by using the one mingw provides, __mingw_snprintf(). We also provide a prototype for __mingw_snprintf(), because the mingw headers currently don't have one. */ @@ -139,6 +134,10 @@ extern int __mingw_snprintf (char *, size_t, const char *, ...) __attribute__ ((format (gnu_printf, 3, 4))); #undef snprintf #define snprintf __mingw_snprintf +/* Fallback to sprintf if target does not have snprintf. */ +#elif !defined(HAVE_SNPRINTF) +#undef snprintf +#define snprintf(str, size, ...) sprintf (str, __VA_ARGS__) #endif @@ -203,7 +202,7 @@ extern int __mingw_snprintf (char *, size_t, const char *, ...) # define iexport(x) iexport1(x, IPREFIX(x)) # define iexport1(x,y) iexport2(x,y) # define iexport2(x,y) \ - extern __typeof(x) PREFIX(x) __attribute__((__alias__(#y))) + extern __typeof(x) PREFIX(x) __attribute__((__alias__(#y), __copy__ (x))) #else # define export_proto(x) sym_rename(x, PREFIX(x)) # define export_proto_np(x) extern char swallow_semicolon @@ -221,47 +220,24 @@ extern int __mingw_snprintf (char *, size_t, const char *, ...) #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER) #endif -/* The isfinite macro is only available with C99, but some non-C99 - systems still provide fpclassify, and there is a `finite' function - in BSD. - - Also, isfinite is broken on Cygwin. +/* The C99 classification macros isfinite, isinf, isnan, isnormal + and signbit are broken or inconsistent on quite a few targets. + So, we use GCC's builtins instead. - When isfinite is not available, try to use one of the - alternatives, or bail out. */ + Another advantage for GCC's builtins for these type-generic macros + is that it handles floating-point types that the system headers + may not support (like __float128). */ -#if defined(HAVE_BROKEN_ISFINITE) || defined(__CYGWIN__) -#undef isfinite -#endif - -#if defined(HAVE_BROKEN_ISNAN) #undef isnan -#endif - -#if defined(HAVE_BROKEN_FPCLASSIFY) -#undef fpclassify -#endif - -#if !defined(isfinite) -#if !defined(fpclassify) -#define isfinite(x) ((x) - (x) == 0) -#else -#define isfinite(x) (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE) -#endif /* !defined(fpclassify) */ -#endif /* !defined(isfinite) */ - -#if !defined(isnan) -#if !defined(fpclassify) -#define isnan(x) ((x) != (x)) -#else -#define isnan(x) (fpclassify(x) == FP_NAN) -#endif /* !defined(fpclassify) */ -#endif /* !defined(isfinite) */ - -/* TODO: find the C99 version of these an move into above ifdef. */ -#define REALPART(z) (__real__(z)) -#define IMAGPART(z) (__imag__(z)) -#define COMPLEX_ASSIGN(z_, r_, i_) {__real__(z_) = (r_); __imag__(z_) = (i_);} +#define isnan(x) __builtin_isnan(x) +#undef isfinite +#define isfinite(x) __builtin_isfinite(x) +#undef isinf +#define isinf(x) __builtin_isinf(x) +#undef isnormal +#define isnormal(x) __builtin_isnormal(x) +#undef signbit +#define signbit(x) __builtin_signbit(x) #include "kinds.h" @@ -280,10 +256,10 @@ typedef GFC_INTEGER_4 GFC_IO_INT; /* The following two definitions must be consistent with the types used by the compiler. */ /* The type used of array indices, amongst other things. */ -typedef ssize_t index_type; +typedef ptrdiff_t index_type; /* The type used for the lengths of character variables. */ -typedef GFC_INTEGER_4 gfc_charlen_type; +typedef size_t gfc_charlen_type; /* Definitions of CHARACTER data types: - CHARACTER(KIND=1) corresponds to the C char type, @@ -294,12 +270,8 @@ typedef GFC_UINTEGER_4 gfc_char4_t; simply equal to the kind parameter itself. */ #define GFC_SIZE_OF_CHAR_KIND(kind) (kind) -/* This will be 0 on little-endian machines and one on big-endian machines. */ -extern int big_endian; -internal_proto(big_endian); - #define GFOR_POINTER_TO_L1(p, kind) \ - (big_endian * (kind - 1) + (GFC_LOGICAL_1 *)(p)) + ((__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ? 1: 0) * (kind - 1) + (GFC_LOGICAL_1 *)(p)) #define GFC_INTEGER_1_HUGE \ (GFC_INTEGER_1)((((GFC_UINTEGER_1)1) << 7) - 1) @@ -327,7 +299,11 @@ internal_proto(big_endian); # define GFC_REAL_10_INFINITY __builtin_infl () # endif # ifdef HAVE_GFC_REAL_16 -# define GFC_REAL_16_INFINITY __builtin_infl () +# ifdef GFC_REAL_16_IS_LONG_DOUBLE +# define GFC_REAL_16_INFINITY __builtin_infl () +# else +# define GFC_REAL_16_INFINITY __builtin_infq () +# endif # endif #endif #ifdef __FLT_HAS_QUIET_NAN__ @@ -341,86 +317,116 @@ internal_proto(big_endian); # define GFC_REAL_10_QUIET_NAN __builtin_nanl ("") # endif # ifdef HAVE_GFC_REAL_16 -# define GFC_REAL_16_QUIET_NAN __builtin_nanl ("") +# ifdef GFC_REAL_16_IS_LONG_DOUBLE +# define GFC_REAL_16_QUIET_NAN __builtin_nanl ("") +# else +# define GFC_REAL_16_QUIET_NAN nanq ("") +# endif # endif #endif typedef struct descriptor_dimension { index_type _stride; - index_type _lbound; + index_type lower_bound; index_type _ubound; } - descriptor_dimension; -#define GFC_ARRAY_DESCRIPTOR(r, type) \ +typedef struct dtype_type +{ + size_t elem_len; + int version; + signed char rank; + signed char type; + signed short attribute; +} +dtype_type; + +#define GFC_ARRAY_DESCRIPTOR(type) \ struct {\ - type *data;\ + type *base_addr;\ size_t offset;\ - index_type dtype;\ - descriptor_dimension dim[r];\ + dtype_type dtype;\ + index_type span;\ + descriptor_dimension dim[];\ } /* Commonly used array descriptor types. */ -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) gfc_array_void; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, char) gfc_array_char; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_1) gfc_array_i1; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_2) gfc_array_i2; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_4) gfc_array_i4; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_8) gfc_array_i8; +typedef GFC_ARRAY_DESCRIPTOR (void) gfc_array_void; +typedef GFC_ARRAY_DESCRIPTOR (char) gfc_array_char; +typedef GFC_ARRAY_DESCRIPTOR (GFC_INTEGER_1) gfc_array_i1; +typedef GFC_ARRAY_DESCRIPTOR (GFC_INTEGER_2) gfc_array_i2; +typedef GFC_ARRAY_DESCRIPTOR (GFC_INTEGER_4) gfc_array_i4; +typedef GFC_ARRAY_DESCRIPTOR (GFC_INTEGER_8) gfc_array_i8; +typedef GFC_ARRAY_DESCRIPTOR (index_type) gfc_array_index_type; #ifdef HAVE_GFC_INTEGER_16 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_16) gfc_array_i16; +typedef GFC_ARRAY_DESCRIPTOR (GFC_INTEGER_16) gfc_array_i16; #endif -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_4) gfc_array_r4; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_8) gfc_array_r8; +typedef GFC_ARRAY_DESCRIPTOR (GFC_REAL_4) gfc_array_r4; +typedef GFC_ARRAY_DESCRIPTOR (GFC_REAL_8) gfc_array_r8; #ifdef HAVE_GFC_REAL_10 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_10) gfc_array_r10; +typedef GFC_ARRAY_DESCRIPTOR (GFC_REAL_10) gfc_array_r10; #endif #ifdef HAVE_GFC_REAL_16 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_16) gfc_array_r16; +typedef GFC_ARRAY_DESCRIPTOR (GFC_REAL_16) gfc_array_r16; #endif -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_4) gfc_array_c4; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_8) gfc_array_c8; +typedef GFC_ARRAY_DESCRIPTOR (GFC_COMPLEX_4) gfc_array_c4; +typedef GFC_ARRAY_DESCRIPTOR (GFC_COMPLEX_8) gfc_array_c8; #ifdef HAVE_GFC_COMPLEX_10 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_10) gfc_array_c10; +typedef GFC_ARRAY_DESCRIPTOR (GFC_COMPLEX_10) gfc_array_c10; #endif #ifdef HAVE_GFC_COMPLEX_16 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_16) gfc_array_c16; +typedef GFC_ARRAY_DESCRIPTOR (GFC_COMPLEX_16) gfc_array_c16; #endif -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_1) gfc_array_l1; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_2) gfc_array_l2; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_4) gfc_array_l4; -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_8) gfc_array_l8; +typedef GFC_ARRAY_DESCRIPTOR (GFC_LOGICAL_1) gfc_array_l1; +typedef GFC_ARRAY_DESCRIPTOR (GFC_LOGICAL_2) gfc_array_l2; +typedef GFC_ARRAY_DESCRIPTOR (GFC_LOGICAL_4) gfc_array_l4; +typedef GFC_ARRAY_DESCRIPTOR (GFC_LOGICAL_8) gfc_array_l8; #ifdef HAVE_GFC_LOGICAL_16 -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16; +typedef GFC_ARRAY_DESCRIPTOR (GFC_LOGICAL_16) gfc_array_l16; #endif +typedef GFC_ARRAY_DESCRIPTOR (GFC_UINTEGER_1) gfc_array_s1; +typedef GFC_ARRAY_DESCRIPTOR (GFC_UINTEGER_4) gfc_array_s4; + +/* These are for when you actually want to declare a descriptor, as + opposed to a pointer to it. */ -#define GFC_DESCRIPTOR_RANK(desc) ((desc)->dtype & GFC_DTYPE_RANK_MASK) -#define GFC_DESCRIPTOR_TYPE(desc) (((desc)->dtype & GFC_DTYPE_TYPE_MASK) \ - >> GFC_DTYPE_TYPE_SHIFT) -#define GFC_DESCRIPTOR_SIZE(desc) ((desc)->dtype >> GFC_DTYPE_SIZE_SHIFT) -#define GFC_DESCRIPTOR_DATA(desc) ((desc)->data) +#define GFC_FULL_ARRAY_DESCRIPTOR(r, type) \ +struct {\ + type *base_addr;\ + size_t offset;\ + dtype_type dtype;\ + index_type span;\ + descriptor_dimension dim[r];\ +} + +typedef GFC_FULL_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_4) gfc_full_array_i4; + +#define GFC_DESCRIPTOR_RANK(desc) ((desc)->dtype.rank) +#define GFC_DESCRIPTOR_TYPE(desc) ((desc)->dtype.type) +#define GFC_DESCRIPTOR_SIZE(desc) ((desc)->dtype.elem_len) +#define GFC_DESCRIPTOR_DATA(desc) ((desc)->base_addr) #define GFC_DESCRIPTOR_DTYPE(desc) ((desc)->dtype) -#define GFC_DIMENSION_LBOUND(dim) ((dim)._lbound) +#define GFC_DIMENSION_LBOUND(dim) ((dim).lower_bound) #define GFC_DIMENSION_UBOUND(dim) ((dim)._ubound) #define GFC_DIMENSION_STRIDE(dim) ((dim)._stride) -#define GFC_DIMENSION_EXTENT(dim) ((dim)._ubound + 1 - (dim)._lbound) +#define GFC_DIMENSION_EXTENT(dim) ((dim)._ubound + 1 - (dim).lower_bound) #define GFC_DIMENSION_SET(dim,lb,ub,str) \ do \ { \ - (dim)._lbound = lb; \ + (dim).lower_bound = lb; \ (dim)._ubound = ub; \ (dim)._stride = str; \ } while (0) -#define GFC_DESCRIPTOR_LBOUND(desc,i) ((desc)->dim[i]._lbound) +#define GFC_DESCRIPTOR_LBOUND(desc,i) ((desc)->dim[i].lower_bound) #define GFC_DESCRIPTOR_UBOUND(desc,i) ((desc)->dim[i]._ubound) #define GFC_DESCRIPTOR_EXTENT(desc,i) ((desc)->dim[i]._ubound + 1 \ - - (desc)->dim[i]._lbound) + - (desc)->dim[i].lower_bound) #define GFC_DESCRIPTOR_EXTENT_BYTES(desc,i) \ (GFC_DESCRIPTOR_EXTENT(desc,i) * GFC_DESCRIPTOR_SIZE(desc)) @@ -430,77 +436,75 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16; /* Macros to get both the size and the type with a single masking operation */ -#define GFC_DTYPE_SIZE_MASK \ - ((~((index_type) 0) >> GFC_DTYPE_SIZE_SHIFT) << GFC_DTYPE_SIZE_SHIFT) +#define GFC_DTYPE_SIZE_MASK (-((index_type) 1 << GFC_DTYPE_SIZE_SHIFT)) #define GFC_DTYPE_TYPE_SIZE_MASK (GFC_DTYPE_SIZE_MASK | GFC_DTYPE_TYPE_MASK) -#define GFC_DTYPE_TYPE_SIZE(desc) ((desc)->dtype & GFC_DTYPE_TYPE_SIZE_MASK) +#define GFC_DTYPE_TYPE_SIZE(desc) (( ((desc)->dtype.type << GFC_DTYPE_TYPE_SHIFT) \ + | ((desc)->dtype.elem_len << GFC_DTYPE_SIZE_SHIFT) ) & GFC_DTYPE_TYPE_SIZE_MASK) + +/* Macros to set size and type information. */ -#define GFC_DTYPE_INTEGER_1 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_COPY(a,b) do { (a)->dtype = (b)->dtype; } while(0) +#define GFC_DTYPE_IS_UNSET(a) (unlikely((a)->dtype.elem_len == 0)) +#define GFC_DTYPE_CLEAR(a) do { (a)->dtype.elem_len = 0; \ + (a)->dtype.version = 0; \ + (a)->dtype.rank = 0; \ + (a)->dtype.type = 0; \ + (a)->dtype.attribute = 0; \ +} while(0) + +#define GFC_DTYPE_INTEGER_1 ((BT_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_INTEGER_1) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_INTEGER_2 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_INTEGER_2 ((BT_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_INTEGER_2) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_INTEGER_4 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_INTEGER_4 ((BT_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_INTEGER_4) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_INTEGER_8 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_INTEGER_8 ((BT_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_INTEGER_8) << GFC_DTYPE_SIZE_SHIFT)) #ifdef HAVE_GFC_INTEGER_16 -#define GFC_DTYPE_INTEGER_16 ((GFC_DTYPE_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_INTEGER_16 ((BT_INTEGER << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_INTEGER_16) << GFC_DTYPE_SIZE_SHIFT)) #endif -#define GFC_DTYPE_LOGICAL_1 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_LOGICAL_1 ((BT_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_LOGICAL_1) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_LOGICAL_2 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_LOGICAL_2 ((BT_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_LOGICAL_2) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_LOGICAL_4 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_LOGICAL_4 ((BT_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_LOGICAL_4) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_LOGICAL_8 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_LOGICAL_8 ((BT_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_LOGICAL_8) << GFC_DTYPE_SIZE_SHIFT)) #ifdef HAVE_GFC_LOGICAL_16 -#define GFC_DTYPE_LOGICAL_16 ((GFC_DTYPE_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_LOGICAL_16 ((BT_LOGICAL << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_LOGICAL_16) << GFC_DTYPE_SIZE_SHIFT)) #endif -#define GFC_DTYPE_REAL_4 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_REAL_4 ((BT_REAL << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_REAL_4) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_REAL_8 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_REAL_8 ((BT_REAL << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_REAL_8) << GFC_DTYPE_SIZE_SHIFT)) #ifdef HAVE_GFC_REAL_10 -#define GFC_DTYPE_REAL_10 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_REAL_10 ((BT_REAL << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_REAL_10) << GFC_DTYPE_SIZE_SHIFT)) #endif #ifdef HAVE_GFC_REAL_16 -#define GFC_DTYPE_REAL_16 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_REAL_16 ((BT_REAL << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_REAL_16) << GFC_DTYPE_SIZE_SHIFT)) #endif -#define GFC_DTYPE_COMPLEX_4 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_COMPLEX_4 ((BT_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_COMPLEX_4) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_COMPLEX_8 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_COMPLEX_8 ((BT_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_COMPLEX_8) << GFC_DTYPE_SIZE_SHIFT)) #ifdef HAVE_GFC_COMPLEX_10 -#define GFC_DTYPE_COMPLEX_10 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_COMPLEX_10 ((BT_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_COMPLEX_10) << GFC_DTYPE_SIZE_SHIFT)) #endif #ifdef HAVE_GFC_COMPLEX_16 -#define GFC_DTYPE_COMPLEX_16 ((GFC_DTYPE_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ +#define GFC_DTYPE_COMPLEX_16 ((BT_COMPLEX << GFC_DTYPE_TYPE_SHIFT) \ | (sizeof(GFC_COMPLEX_16) << GFC_DTYPE_SIZE_SHIFT)) #endif -#define GFC_DTYPE_DERIVED_1 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \ - | (sizeof(GFC_INTEGER_1) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_DERIVED_2 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \ - | (sizeof(GFC_INTEGER_2) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_DERIVED_4 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \ - | (sizeof(GFC_INTEGER_4) << GFC_DTYPE_SIZE_SHIFT)) -#define GFC_DTYPE_DERIVED_8 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \ - | (sizeof(GFC_INTEGER_8) << GFC_DTYPE_SIZE_SHIFT)) -#ifdef HAVE_GFC_INTEGER_16 -#define GFC_DTYPE_DERIVED_16 ((GFC_DTYPE_DERIVED << GFC_DTYPE_TYPE_SHIFT) \ - | (sizeof(GFC_INTEGER_16) << GFC_DTYPE_SIZE_SHIFT)) -#endif - /* Macros to determine the alignment of pointers. */ #define GFC_UNALIGNED_2(x) (((uintptr_t)(x)) & \ @@ -534,16 +538,17 @@ typedef struct int separator_len; const char *separator; - int use_stderr, all_unbuffered, unbuffered_preconnected, default_recl; - int fpe, dump_core, backtrace; + int all_unbuffered, unbuffered_preconnected; + int fpe, backtrace; + int unformatted_buffer_size, formatted_buffer_size; } options_t; extern options_t options; internal_proto(options); -extern void handler (int); -internal_proto(handler); +extern void backtrace_handler (int); +internal_proto(backtrace_handler); /* Compile-time options that will influence the library. */ @@ -554,13 +559,12 @@ typedef struct int allow_std; int pedantic; int convert; - int dump_core; int backtrace; int sign_zero; size_t record_marker; int max_subrecord_length; int bounds_check; - int range_check; + int fpe_summary; } compile_options_t; @@ -589,10 +593,6 @@ typedef enum { NOTIFICATION_SILENT, NOTIFICATION_WARNING, NOTIFICATION_ERROR } notification; -/* This is returned by notify_std and several io functions. */ -typedef enum -{ SUCCESS = 1, FAILURE } -try; /* The filename and line number don't go inside the globals structure. They are set by the rest of the program and must be linked to. */ @@ -604,20 +604,6 @@ iexport_data_proto(line); extern char *filename; iexport_data_proto(filename); -/* Avoid conflicting prototypes of alloca() in system headers by using - GCC's builtin alloca(). */ -#define gfc_alloca(x) __builtin_alloca(x) - - -/* Directory for creating temporary files. Only used when none of the - following environment variables exist: GFORTRAN_TMPDIR, TMP and TEMP. */ -#define DEFAULT_TEMPDIR "/tmp" - -/* The default value of record length for preconnected units is defined - here. This value can be overriden by an environment variable. - Default value is 1 Gb. */ -#define DEFAULT_RECL 1073741824 - #define CHARACTER2(name) \ gfc_charlen_type name ## _len; \ @@ -649,6 +635,7 @@ st_parameter_common; #define IOPARM_COMMON_MASK ((1 << 7) - 1) +/* Make sure to keep in sync with io/io.h (st_parameter_open). */ #define IOPARM_OPEN_HAS_RECL_IN (1 << 7) #define IOPARM_OPEN_HAS_FILE (1 << 8) #define IOPARM_OPEN_HAS_STATUS (1 << 9) @@ -666,6 +653,9 @@ st_parameter_common; #define IOPARM_OPEN_HAS_SIGN (1 << 21) #define IOPARM_OPEN_HAS_ASYNCHRONOUS (1 << 22) #define IOPARM_OPEN_HAS_NEWUNIT (1 << 23) +#define IOPARM_OPEN_HAS_READONLY (1 << 24) +#define IOPARM_OPEN_HAS_CC (1 << 25) +#define IOPARM_OPEN_HAS_SHARE (1 << 26) /* library start function and end macro. These can be expanded if needed in the future. cmp is st_parameter_common *cmp */ @@ -686,17 +676,12 @@ iexport_proto(set_args); extern void get_args (int *, char ***); internal_proto(get_args); -extern void store_exe_path (const char *); -export_proto(store_exe_path); - -extern char * full_exe_path (void); -internal_proto(full_exe_path); - /* backtrace.c */ -extern void show_backtrace (void); +extern void show_backtrace (bool); internal_proto(show_backtrace); + /* error.c */ #if defined(HAVE_GFC_REAL_16) @@ -714,79 +699,159 @@ internal_proto(show_backtrace); #define GFC_OTOA_BUF_SIZE (GFC_LARGEST_BUF * 3 + 1) #define GFC_BTOA_BUF_SIZE (GFC_LARGEST_BUF * 8 + 1) -extern void sys_exit (int) __attribute__ ((noreturn)); -internal_proto(sys_exit); +extern _Noreturn void sys_abort (void); +internal_proto(sys_abort); + +extern _Noreturn void exit_error (int); +internal_proto(exit_error); + +extern ssize_t estr_write (const char *); +internal_proto(estr_write); + +#if !defined(HAVE_WRITEV) && !defined(HAVE_SYS_UIO_H) +struct iovec { + void *iov_base; /* Starting address */ + size_t iov_len; /* Number of bytes to transfer */ +}; +#endif + +extern ssize_t estr_writev (const struct iovec *iov, int iovcnt); +internal_proto(estr_writev); + +extern int st_printf (const char *, ...) + __attribute__((format (gfc_printf, 1, 2))); +internal_proto(st_printf); extern const char *gfc_xtoa (GFC_UINTEGER_LARGEST, char *, size_t); internal_proto(gfc_xtoa); -extern void os_error (const char *) __attribute__ ((noreturn)); +extern _Noreturn void os_error (const char *); iexport_proto(os_error); +extern _Noreturn void os_error_at (const char *, const char *, ...) + __attribute__ ((format (gfc_printf, 2, 3))); +iexport_proto(os_error_at); + extern void show_locus (st_parameter_common *); internal_proto(show_locus); -extern void runtime_error (const char *, ...) - __attribute__ ((noreturn, format (gfc_printf, 1, 2))); +extern _Noreturn void runtime_error (const char *, ...) + __attribute__ ((format (gfc_printf, 1, 2))); iexport_proto(runtime_error); -extern void runtime_error_at (const char *, const char *, ...) - __attribute__ ((noreturn, format (gfc_printf, 2, 3))); +extern _Noreturn void runtime_error_at (const char *, const char *, ...) + __attribute__ ((format (gfc_printf, 2, 3))); iexport_proto(runtime_error_at); extern void runtime_warning_at (const char *, const char *, ...) __attribute__ ((format (gfc_printf, 2, 3))); iexport_proto(runtime_warning_at); -extern void internal_error (st_parameter_common *, const char *) - __attribute__ ((noreturn)); +extern _Noreturn void internal_error (st_parameter_common *, const char *); internal_proto(internal_error); -extern const char *get_oserror (void); -internal_proto(get_oserror); - extern const char *translate_error (int); internal_proto(translate_error); extern void generate_error (st_parameter_common *, int, const char *); iexport_proto(generate_error); -extern try notify_std (st_parameter_common *, int, const char *); +extern bool generate_error_common (st_parameter_common *, int, const char *); +iexport_proto(generate_error_common); + +extern void generate_warning (st_parameter_common *, const char *); +internal_proto(generate_warning); + +extern bool notify_std (st_parameter_common *, int, const char *); internal_proto(notify_std); extern notification notification_std(int); internal_proto(notification_std); +extern char *gf_strerror (int, char *, size_t); +internal_proto(gf_strerror); + /* fpu.c */ extern void set_fpu (void); internal_proto(set_fpu); +extern int get_fpu_trap_exceptions (void); +internal_proto(get_fpu_trap_exceptions); + +extern void set_fpu_trap_exceptions (int, int); +internal_proto(set_fpu_trap_exceptions); + +extern int support_fpu_trap (int); +internal_proto(support_fpu_trap); + +extern int get_fpu_except_flags (void); +internal_proto(get_fpu_except_flags); + +extern void set_fpu_except_flags (int, int); +internal_proto(set_fpu_except_flags); + +extern int support_fpu_flag (int); +internal_proto(support_fpu_flag); + +extern void set_fpu_rounding_mode (int); +internal_proto(set_fpu_rounding_mode); + +extern int get_fpu_rounding_mode (void); +internal_proto(get_fpu_rounding_mode); + +extern int support_fpu_rounding_mode (int); +internal_proto(support_fpu_rounding_mode); + +extern void get_fpu_state (void *); +internal_proto(get_fpu_state); + +extern void set_fpu_state (void *); +internal_proto(set_fpu_state); + +extern int get_fpu_underflow_mode (void); +internal_proto(get_fpu_underflow_mode); + +extern void set_fpu_underflow_mode (int); +internal_proto(set_fpu_underflow_mode); + +extern int support_fpu_underflow_control (int); +internal_proto(support_fpu_underflow_control); + /* memory.c */ -extern void *get_mem (size_t) __attribute__ ((malloc)); -internal_proto(get_mem); +extern void *xmalloc (size_t) __attribute__ ((malloc)); +internal_proto(xmalloc); -extern void free_mem (void *); -internal_proto(free_mem); +extern void *xmallocarray (size_t, size_t) __attribute__ ((malloc)); +internal_proto(xmallocarray); -extern void *internal_malloc_size (size_t) __attribute__ ((malloc)); -internal_proto(internal_malloc_size); +extern void *xcalloc (size_t, size_t) __attribute__ ((malloc)); +internal_proto(xcalloc); -/* environ.c */ +extern void *xrealloc (void *, size_t); +internal_proto(xrealloc); -extern int check_buffered (int); -internal_proto(check_buffered); +/* environ.c */ extern void init_variables (void); internal_proto(init_variables); -extern void show_variables (void); -internal_proto(show_variables); - unit_convert get_unformatted_convert (int); internal_proto(get_unformatted_convert); +/* Secure getenv() which returns NULL if running as SUID/SGID. */ +#ifndef HAVE_SECURE_GETENV +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) \ + && defined(HAVE_GETGID) && defined(HAVE_GETEGID) +#define FALLBACK_SECURE_GETENV +extern char *secure_getenv (const char *); +internal_proto(secure_getenv); +#else +#define secure_getenv getenv +#endif +#endif + /* string.c */ extern int find_option (st_parameter_common *, const char *, gfc_charlen_type, @@ -802,6 +867,22 @@ internal_proto(fstrcpy); extern gfc_charlen_type cf_strcpy (char *, gfc_charlen_type, const char *); internal_proto(cf_strcpy); +extern gfc_charlen_type string_len_trim (gfc_charlen_type, const char *); +export_proto(string_len_trim); + +extern gfc_charlen_type string_len_trim_char4 (gfc_charlen_type, + const gfc_char4_t *); +export_proto(string_len_trim_char4); + +extern char *fc_strdup(const char *, gfc_charlen_type); +internal_proto(fc_strdup); + +extern char *fc_strdup_notrim(const char *, gfc_charlen_type); +internal_proto(fc_strdup_notrim); + +extern const char *gfc_itoa(GFC_INTEGER_LARGEST, char *, size_t); +internal_proto(gfc_itoa); + /* io/intrinsics.c */ extern void flush_all_units (void); @@ -818,20 +899,13 @@ internal_proto(close_units); extern int unit_to_fd (int); internal_proto(unit_to_fd); -extern int st_printf (const char *, ...) - __attribute__ ((format (gfc_printf, 1, 2))); -internal_proto(st_printf); - -extern int st_vprintf (const char *, va_list); -internal_proto(st_vprintf); - extern char * filename_from_unit (int); internal_proto(filename_from_unit); /* stop.c */ -extern void stop_numeric (GFC_INTEGER_4) __attribute__ ((noreturn)); -iexport_proto(stop_numeric); +extern _Noreturn void stop_string (const char *, size_t, bool); +export_proto(stop_string); /* reshape_packed.c */ @@ -1286,6 +1360,10 @@ extern int compare_string_char4 (gfc_charlen_type, const gfc_char4_t *, gfc_charlen_type, const gfc_char4_t *); iexport_proto(compare_string_char4); +extern int memcmp_char4 (const void *, const void *, size_t); +internal_proto(memcmp_char4); + + /* random.c */ extern void random_seed_i4 (GFC_INTEGER_4 * size, gfc_array_i4 * put, @@ -1297,11 +1375,16 @@ iexport_proto(random_seed_i8); /* size.c */ -typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) array_t; +typedef GFC_ARRAY_DESCRIPTOR (void) array_t; extern index_type size0 (const array_t * array); iexport_proto(size0); +/* is_contiguous.c */ + +extern GFC_LOGICAL_4 is_contiguous0 (const array_t * const restrict array); +iexport_proto(is_contiguous0); + /* bounds.c */ extern void bounds_equal_extents (array_t *, array_t *, const char *, @@ -1325,53 +1408,370 @@ internal_proto(count_0); /* Internal auxiliary functions for cshift */ -void cshift0_i1 (gfc_array_i1 *, const gfc_array_i1 *, ssize_t, int); +void cshift0_i1 (gfc_array_i1 *, const gfc_array_i1 *, ptrdiff_t, int); internal_proto(cshift0_i1); -void cshift0_i2 (gfc_array_i2 *, const gfc_array_i2 *, ssize_t, int); +void cshift0_i2 (gfc_array_i2 *, const gfc_array_i2 *, ptrdiff_t, int); internal_proto(cshift0_i2); -void cshift0_i4 (gfc_array_i4 *, const gfc_array_i4 *, ssize_t, int); +void cshift0_i4 (gfc_array_i4 *, const gfc_array_i4 *, ptrdiff_t, int); internal_proto(cshift0_i4); -void cshift0_i8 (gfc_array_i8 *, const gfc_array_i8 *, ssize_t, int); +void cshift0_i8 (gfc_array_i8 *, const gfc_array_i8 *, ptrdiff_t, int); internal_proto(cshift0_i8); #ifdef HAVE_GFC_INTEGER_16 -void cshift0_i16 (gfc_array_i16 *, const gfc_array_i16 *, ssize_t, int); +void cshift0_i16 (gfc_array_i16 *, const gfc_array_i16 *, ptrdiff_t, int); internal_proto(cshift0_i16); #endif -void cshift0_r4 (gfc_array_r4 *, const gfc_array_r4 *, ssize_t, int); +void cshift0_r4 (gfc_array_r4 *, const gfc_array_r4 *, ptrdiff_t, int); internal_proto(cshift0_r4); -void cshift0_r8 (gfc_array_r8 *, const gfc_array_r8 *, ssize_t, int); +void cshift0_r8 (gfc_array_r8 *, const gfc_array_r8 *, ptrdiff_t, int); internal_proto(cshift0_r8); #ifdef HAVE_GFC_REAL_10 -void cshift0_r10 (gfc_array_r10 *, const gfc_array_r10 *, ssize_t, int); +void cshift0_r10 (gfc_array_r10 *, const gfc_array_r10 *, ptrdiff_t, int); internal_proto(cshift0_r10); #endif #ifdef HAVE_GFC_REAL_16 -void cshift0_r16 (gfc_array_r16 *, const gfc_array_r16 *, ssize_t, int); +void cshift0_r16 (gfc_array_r16 *, const gfc_array_r16 *, ptrdiff_t, int); internal_proto(cshift0_r16); #endif -void cshift0_c4 (gfc_array_c4 *, const gfc_array_c4 *, ssize_t, int); +void cshift0_c4 (gfc_array_c4 *, const gfc_array_c4 *, ptrdiff_t, int); internal_proto(cshift0_c4); -void cshift0_c8 (gfc_array_c8 *, const gfc_array_c8 *, ssize_t, int); +void cshift0_c8 (gfc_array_c8 *, const gfc_array_c8 *, ptrdiff_t, int); internal_proto(cshift0_c8); #ifdef HAVE_GFC_COMPLEX_10 -void cshift0_c10 (gfc_array_c10 *, const gfc_array_c10 *, ssize_t, int); +void cshift0_c10 (gfc_array_c10 *, const gfc_array_c10 *, ptrdiff_t, int); internal_proto(cshift0_c10); #endif #ifdef HAVE_GFC_COMPLEX_16 -void cshift0_c16 (gfc_array_c16 *, const gfc_array_c16 *, ssize_t, int); +void cshift0_c16 (gfc_array_c16 *, const gfc_array_c16 *, ptrdiff_t, int); internal_proto(cshift0_c16); #endif +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_1) +void cshift1_4_i1 (gfc_array_i1 * const restrict, + const gfc_array_i1 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_i1); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_2) +void cshift1_4_i2 (gfc_array_i2 * const restrict, + const gfc_array_i2 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_i2); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_4) +void cshift1_4_i4 (gfc_array_i4 * const restrict, + const gfc_array_i4 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_i4); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_8) +void cshift1_4_i8 (gfc_array_i8 * const restrict, + const gfc_array_i8 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_i8); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_16) +void cshift1_4_i16 (gfc_array_i16 * const restrict, + const gfc_array_i16 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_i16); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_1) +void cshift1_8_i1 (gfc_array_i1 * const restrict, + const gfc_array_i1 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_i1); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_2) +void cshift1_8_i2 (gfc_array_i2 * const restrict, + const gfc_array_i2 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_i2); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_4) +void cshift1_8_i4 (gfc_array_i4 * const restrict, + const gfc_array_i4 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_i4); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_8) +void cshift1_8_i8 (gfc_array_i8 * const restrict, + const gfc_array_i8 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_i8); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_16) +void cshift1_8_i16 (gfc_array_i16 * const restrict, + const gfc_array_i16 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_i16); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_1) +void cshift1_16_i1 (gfc_array_i1 * const restrict, + const gfc_array_i1 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_i1); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_2) +void cshift1_16_i2 (gfc_array_i2 * const restrict, + const gfc_array_i2 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_i2); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_4) +void cshift1_16_i4 (gfc_array_i4 * const restrict, + const gfc_array_i4 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_i4); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_8) +void cshift1_16_i8 (gfc_array_i8 * const restrict, + const gfc_array_i8 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_i8); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_16) +void cshift1_16_i16 (gfc_array_i16 * const restrict, + const gfc_array_i16 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_i16); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_REAL_4) +void cshift1_4_r4 (gfc_array_r4 * const restrict, + const gfc_array_r4 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_r4); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_REAL_8) +void cshift1_4_r8 (gfc_array_r8 * const restrict, + const gfc_array_r8 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_r8); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_REAL_10) +void cshift1_4_r10 (gfc_array_r10 * const restrict, + const gfc_array_r10 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_r10); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_REAL_16) +void cshift1_4_r16 (gfc_array_r16 * const restrict, + const gfc_array_r16 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_r16); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_REAL_4) +void cshift1_8_r4 (gfc_array_r4 * const restrict, + const gfc_array_r4 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_r4); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_REAL_8) +void cshift1_8_r8 (gfc_array_r8 * const restrict, + const gfc_array_r8 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_r8); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_REAL_10) +void cshift1_8_r10 (gfc_array_r10 * const restrict, + const gfc_array_r10 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_r10); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_REAL_16) +void cshift1_8_r16 (gfc_array_r16 * const restrict, + const gfc_array_r16 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_r16); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_REAL_4) +void cshift1_16_r4 (gfc_array_r4 * const restrict, + const gfc_array_r4 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_r4); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_REAL_8) +void cshift1_16_r8 (gfc_array_r8 * const restrict, + const gfc_array_r8 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_r8); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_REAL_10) +void cshift1_16_r10 (gfc_array_r10 * const restrict, + const gfc_array_r10 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_r10); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_REAL_16) +void cshift1_16_r16 (gfc_array_r16 * const restrict, + const gfc_array_r16 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_r16); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_COMPLEX_4) +void cshift1_4_c4 (gfc_array_c4 * const restrict, + const gfc_array_c4 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_c4); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_COMPLEX_8) +void cshift1_4_c8 (gfc_array_c8 * const restrict, + const gfc_array_c8 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_c8); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_COMPLEX_10) +void cshift1_4_c10 (gfc_array_c10 * const restrict, + const gfc_array_c10 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_c10); +#endif + +#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_COMPLEX_16) +void cshift1_4_c16 (gfc_array_c16 * const restrict, + const gfc_array_c16 * const restrict, + const gfc_array_i4 * const restrict, + const GFC_INTEGER_4 * const restrict); +internal_proto(cshift1_4_c16); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_COMPLEX_4) +void cshift1_8_c4 (gfc_array_c4 * const restrict, + const gfc_array_c4 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_c4); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_COMPLEX_8) +void cshift1_8_c8 (gfc_array_c8 * const restrict, + const gfc_array_c8 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_c8); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_COMPLEX_10) +void cshift1_8_c10 (gfc_array_c10 * const restrict, + const gfc_array_c10 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_c10); +#endif + +#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_COMPLEX_16) +void cshift1_8_c16 (gfc_array_c16 * const restrict, + const gfc_array_c16 * const restrict, + const gfc_array_i8 * const restrict, + const GFC_INTEGER_8 * const restrict); +internal_proto(cshift1_8_c16); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_COMPLEX_4) +void cshift1_16_c4 (gfc_array_c4 * const restrict, + const gfc_array_c4 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_c4); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_COMPLEX_8) +void cshift1_16_c8 (gfc_array_c8 * const restrict, + const gfc_array_c8 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_c8); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_COMPLEX_10) +void cshift1_16_c10 (gfc_array_c10 * const restrict, + const gfc_array_c10 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_c10); +#endif + +#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_COMPLEX_16) +void cshift1_16_c16 (gfc_array_c16 * const restrict, + const gfc_array_c16 * const restrict, + const gfc_array_i16 * const restrict, + const GFC_INTEGER_16 * const restrict); +internal_proto(cshift1_16_c16); +#endif + +/* We always have these. */ + +#define HAVE_GFC_UINTEGER_1 1 +#define HAVE_GFC_UINTEGER_4 1 + #endif /* LIBGFOR_H */