X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=libgfortran%2Fm4%2Feoshift3.m4;h=269e13118721e9a9cfc42c7346588739d053a80d;hb=4292b27d501d5476beb1be16af134e6bac844906;hp=8acceeae91922a865e96f32d3047136d7875a999;hpb=93830de1da404ed79635b483769802c798b94980;p=pf3gnuchains%2Fgcc-fork.git diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4 index 8acceeae919..269e1311872 100644 --- a/libgfortran/m4/eoshift3.m4 +++ b/libgfortran/m4/eoshift3.m4 @@ -25,8 +25,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with libgfortran; see the file COPYING. If not, -write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ #include "config.h" #include @@ -35,18 +35,15 @@ Boston, MA 02111-1307, USA. */ #include "libgfortran.h"' include(iparm.m4)dnl -static const char zeros[16] = - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +`#if defined (HAVE_'atype_name`)' -extern void eoshift3_`'atype_kind (gfc_array_char *, gfc_array_char *, - atype *, const gfc_array_char *, - atype_name *); -export_proto(eoshift3_`'atype_kind); - -void -eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array, - atype *h, const gfc_array_char *bound, - atype_name *pwhich) +static void +eoshift3 (gfc_array_char * const restrict ret, + const gfc_array_char * const restrict array, + const atype * const restrict h, + const gfc_array_char * const restrict bound, + const atype_name * const restrict pwhich, + index_type size, char filler) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -72,7 +69,6 @@ eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array, index_type count[GFC_MAX_DIMENSIONS]; index_type extent[GFC_MAX_DIMENSIONS]; index_type dim; - index_type size; index_type len; index_type n; int which; @@ -90,7 +86,6 @@ eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array, else which = 0; - size = GFC_DESCRIPTOR_SIZE (ret); if (ret->data == NULL) { int i; @@ -113,7 +108,6 @@ eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array, extent[0] = 1; count[0] = 0; - size = GFC_DESCRIPTOR_SIZE (array); n = 0; for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) { @@ -162,7 +156,7 @@ eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array, if (bound) bptr = bound->data; else - bptr = zeros; + bptr = NULL; while (rptr) { @@ -196,11 +190,18 @@ eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array, dest = rptr; n = delta; - while (n--) - { - memcpy (dest, bptr, size); - dest += roffset; - } + if (bptr) + while (n--) + { + memcpy (dest, bptr, size); + dest += roffset; + } + else + while (n--) + { + memset (dest, filler, size); + dest += roffset; + } /* Advance to the next section. */ rptr += rstride0; @@ -238,3 +239,44 @@ eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array, } } } + +extern void eoshift3_`'atype_kind (gfc_array_char * const restrict, + const gfc_array_char * const restrict, + const atype * const restrict, + const gfc_array_char * const restrict, + const atype_name *); +export_proto(eoshift3_`'atype_kind); + +void +eoshift3_`'atype_kind (gfc_array_char * const restrict ret, + const gfc_array_char * const restrict array, + const atype * const restrict h, + const gfc_array_char * const restrict bound, + const atype_name * const restrict pwhich) +{ + eoshift3 (ret, array, h, bound, pwhich, GFC_DESCRIPTOR_SIZE (array), 0); +} + +extern void eoshift3_`'atype_kind`'_char (gfc_array_char * const restrict, + GFC_INTEGER_4, + const gfc_array_char * const restrict, + const atype * const restrict, + const gfc_array_char * const restrict, + const atype_name * const restrict, + GFC_INTEGER_4, GFC_INTEGER_4); +export_proto(eoshift3_`'atype_kind`'_char); + +void +eoshift3_`'atype_kind`'_char (gfc_array_char * const restrict ret, + GFC_INTEGER_4 ret_length __attribute__((unused)), + const gfc_array_char * const restrict array, + const atype * const restrict h, + const gfc_array_char * const restrict bound, + const atype_name * const restrict pwhich, + GFC_INTEGER_4 array_length, + GFC_INTEGER_4 bound_length __attribute__((unused))) +{ + eoshift3 (ret, array, h, bound, pwhich, array_length, ' '); +} + +#endif