Skip to content

Commit

Permalink
Remove unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf authored and xoviat committed Dec 23, 2017
1 parent 88d5e51 commit b3ce0e3
Show file tree
Hide file tree
Showing 31 changed files with 99 additions and 102 deletions.
6 changes: 3 additions & 3 deletions lib/scutil/pgnewfil.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <sys/stat.h>
#include <fcntl.h>

#if defined(_WIN32)
#if defined(HOST_WIN)
#include <direct.h>
#include <io.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -312,7 +312,7 @@ pg_makenewfile(char *pfx, char *sfx, int make)
if (!make) {
break;
} else {
#if defined(_WIN32)
#if defined(HOST_WIN)
fd = _open(filename, _O_CREAT | _O_BINARY | _O_EXCL | _O_RDWR, _S_IWRITE);
#else
fd = open(filename, O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
Expand Down Expand Up @@ -358,7 +358,7 @@ pg_makenewdir(char *pfx, char *sfx, int make)
if (r == -1 && errno == ENOENT) {
if (make) {
int err;
#if defined(_WIN32) || defined(WINNT) || defined(WIN64)
#if defined(HOST_WIN) || defined(WINNT) || defined(WIN64)
err = _mkdir(filename);
#else
err = mkdir(filename, S_IRWXG | S_IRWXO | S_IXUSR | S_IWUSR | S_IRUSR);
Expand Down
2 changes: 1 addition & 1 deletion runtime/flang/alarm3f.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/* alarm3f.c - Implements LIB3F alarm subprogram. */

#ifndef _WIN32
#ifndef WINNT
#include <signal.h>
#include "ent3f.h"

Expand Down
4 changes: 2 additions & 2 deletions runtime/flang/assign.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ __fortio_assign(char *item, /* where to store */
case __INT8:
if (__ftn_32in64_)
I64_MSH(valp->val.i8) = 0;
PP_INT4(item) = I64_LSH(valp->val.i8);
PP_INT4(item + 4) = I64_MSH(valp->val.i8);
PP_INT4(item) = valp->val.i8[0];
PP_INT4(item + 4) = valp->val.i8[1];
break;
case __REAL4:
PP_REAL4(item) = (float)I64_LSH(valp->val.i8);
Expand Down
21 changes: 11 additions & 10 deletions runtime/flang/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* Fio_asy_close - called from close
*/

#if !defined(_WIN32)
#if !defined(TARGET_WIN_X8664)
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
Expand All @@ -52,7 +52,7 @@ struct asy_transaction_data {
seekoffx_t off;
};

#if defined(_WIN32)
#if defined(TARGET_WIN_X8664)
struct asy {
FILE *fp;
int fd;
Expand Down Expand Up @@ -92,7 +92,7 @@ static int slime;

/* internal wait for asynch i/o */

#if defined(_WIN32)
#if defined(TARGET_WIN_X8664)
static int
asy_wait(struct asy *asy)
{
Expand Down Expand Up @@ -253,7 +253,7 @@ Fio_asy_open(FILE *fp, struct asy **pasy)
{
struct asy *asy;
char *p;
#if defined(_WIN32)
#if defined(TARGET_WIN_X8664)
HANDLE temp_handle;
#endif
asy = (struct asy *)calloc(sizeof(struct asy), 1);
Expand All @@ -263,7 +263,7 @@ Fio_asy_open(FILE *fp, struct asy **pasy)
}
asy->fp = fp;
asy->fd = __io_getfd(fp);
#if defined(_WIN32)
#if defined(TARGET_WIN_X8664)
temp_handle = _get_osfhandle(asy->fd);
asy->handle =
ReOpenFile(temp_handle, GENERIC_READ | GENERIC_WRITE,
Expand All @@ -287,13 +287,13 @@ Fio_asy_read(struct asy *asy, void *adr, long len)
int n;
int tn;

#if defined(_WIN32)
#if defined(TARGET_WIN_X8664)
union Converter converter;
#endif
if (slime)
printf("--Fio_asy_read %d %p %ld\n", asy->fd, adr, len);

#if defined(_WIN32)
#if defined(TARGET_WIN_X8664)
if (asy->flags & ASY_IOACT) { /* i/o active? */
if (asy_wait(asy) == -1) { /* ..yes, wait */
return (-1);
Expand Down Expand Up @@ -340,14 +340,14 @@ Fio_asy_write(struct asy *asy, void *adr, long len)
{
int n;
int tn;
#if defined(_WIN32)
#if defined(TARGET_WIN_X8664)
union Converter converter;
#endif

if (slime)
printf("--Fio_asy_write %d %p %ld\n", asy->fd, adr, len);

#if defined(_WIN32)
#if defined(TARGET_WIN_X8664)
if (asy->flags & ASY_IOACT) { /* i/o active? */
if (asy_wait(asy) == -1) { /* ..yes, wait */
return (-1);
Expand Down Expand Up @@ -408,10 +408,11 @@ Fio_asy_close(struct asy *asy)
if (asy->flags & ASY_IOACT) { /* i/o active? */
n = asy_wait(asy);
}
#if defined(_WIN32)
#if defined(TARGET_WIN_X8664)
/* Close the Re-opened handle that we created. */
CloseHandle(asy->handle);
#endif
free(asy);
return (n);
}

2 changes: 1 addition & 1 deletion runtime/flang/close.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ __fortio_close(FIO_FCB *f, int flag)
else
__fort_unlink(f->name);
}
#ifdef _WIN32
#ifdef WINNT
else if (f->status == FIO_SCRATCH)
unlink(f->name);
#endif
Expand Down
2 changes: 1 addition & 1 deletion runtime/flang/const.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ __get_size_of(int* idx)
return __fort_size_of[*idx];
}

#ifdef _WIN32
#ifdef WINNT

/* pg access routines for data shared between windows dlls */

Expand Down
10 changes: 5 additions & 5 deletions runtime/flang/fmtconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ __fortio_default_convert(char *item, int type,
break;
case __LOG8:
width = 2;
I64_LSH(i8val) = PP_LOG4(item);
I64_MSH(i8val) = PP_LOG4(item + 4);
i8val[0] = PP_LOG4(item);
i8val[1] = PP_LOG4(item + 4);
if (I64_LSH(i8val) & GET_FIO_CNFG_TRUE_MASK)
put_buf(width, "T", 1, 0);
else
Expand Down Expand Up @@ -366,7 +366,7 @@ __fortio_fmt_i8(FLANG_INT64 val,
put_buf(width, p, len, neg);
} else {
/* Iw.0 gen's blanks if value is 0 */
if (mn == 0 && I64_LSH(val) == 0 && I64_MSH(val) == 0)
if (mn == 0 && val[0] == 0 && val[1] == 0)
neg = 0;
put_buf(width, p, len, neg);
if (mn > len) {
Expand Down Expand Up @@ -394,8 +394,8 @@ conv_int8(FLANG_INT64 val, int *lenp, int *negp)
FLANG_INT64 value;

*negp = 0;
I64_LSH(value) = I64_LSH(val);
I64_MSH(value) = I64_MSH(val);
value[0] = val[0];
value[1] = val[1];
if (__ftn_32in64_) {
if (I64_LSH(value) & 0x80000000)
I64_MSH(value) = -1;
Expand Down
23 changes: 10 additions & 13 deletions runtime/flang/fmtread.c
Original file line number Diff line number Diff line change
Expand Up @@ -1812,8 +1812,8 @@ fr_readnum(int code, char *item, int type)
return __fortio_error(FIO_EERR_DATA_CONVERSION);
}
if (ty == __INT8) {
I64_MSH(i8val) = 0;
I64_LSH(i8val) = ival;
i8val[1] = 0;
i8val[0] = ival;
}
break;

Expand Down Expand Up @@ -1876,11 +1876,9 @@ fr_readnum(int code, char *item, int type)
idx++, w--;
if (comma_seen)
w -= 1;
if (w == 0) {
I64_LSH(i8val) = 0;
I64_MSH(i8val) = 0;
ival = 0;
} else {
if (w == 0)
ival = i8val[0] = i8val[1] = 0;
else {
c = g->rec_buff[idx];
e = FALSE; /* sign flag */
if (ty == __INT8) {
Expand All @@ -1894,8 +1892,7 @@ fr_readnum(int code, char *item, int type)
*/
int tmp_w = w;
int cpos = idx; /* 'last' character copied */
I64_MSH(i8val) = 0;
I64_LSH(i8val) = 0;
i8val[0] = i8val[1] = 0;
tmp_idx = idx;
while (--tmp_w > 0) {
++tmp_idx;
Expand Down Expand Up @@ -2106,14 +2103,14 @@ fr_assign(char *item, int type, __BIGINT_T ival, FLANG_INT64 i8val, __BIGREAL_T
case __LOG8:
if (__ftn_32in64_)
I64_MSH(i8val) = 0;
((__INT4_T *)item)[0] = I64_LSH(i8val);
((__INT4_T *)item)[1] = I64_MSH(i8val);
((__INT4_T *)item)[0] = i8val[0];
((__INT4_T *)item)[1] = i8val[1];
break;
case __INT8:
if (__ftn_32in64_)
I64_MSH(i8val) = 0;
((__INT4_T *)item)[0] = I64_LSH(i8val);
((__INT4_T *)item)[1] = I64_MSH(i8val);
((__INT4_T *)item)[0] = i8val[0];
((__INT4_T *)item)[1] = i8val[1];
break;

default:
Expand Down
44 changes: 22 additions & 22 deletions runtime/flang/fmtwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -1635,15 +1635,15 @@ fw_writenum(int code, char *item, int type)
is_logical = TRUE;
break;
case __LOG8:
I64_LSH(i8val) = ((__INT4_T *)item)[0];
I64_MSH(i8val) = ((__INT4_T *)item)[1];
i8val[0] = ((__INT4_T *)item)[0];
i8val[1] = ((__INT4_T *)item)[1];
ty = __INT8;
w = 24;
is_logical = TRUE;
break;
case __INT8:
I64_LSH(i8val) = ((__INT4_T *)item)[0];
I64_MSH(i8val) = ((__INT4_T *)item)[1];
i8val[0] = ((__INT4_T *)item)[0];
i8val[1] = ((__INT4_T *)item)[1];
ty = __INT8;
w = 24;
break;
Expand Down Expand Up @@ -1753,8 +1753,8 @@ fw_writenum(int code, char *item, int type)
case __REAL8:
case __REAL16:
crc.r8 = dval;
I64_LSH(i8val) = I64_LSH(crc.i8v);
I64_MSH(i8val) = I64_MSH(crc.i8v);
i8val[0] = crc.i8v[0];
i8val[1] = crc.i8v[1];
ty = __INT8;
w = 24;
break;
Expand All @@ -1780,8 +1780,8 @@ fw_writenum(int code, char *item, int type)
case __REAL8:
case __REAL16:
crc.r8 = dval;
I64_LSH(i8val) = I64_LSH(crc.i8v);
I64_MSH(i8val) = I64_MSH(crc.i8v);
i8val[0] = crc.i8v[0];
i8val[1] = crc.i8v[1];
ty = __INT8;
break;
}
Expand Down Expand Up @@ -1839,8 +1839,8 @@ fw_writenum(int code, char *item, int type)
case __REAL8:
case __REAL16:
crc.r8 = dval;
I64_LSH(i8val) = I64_LSH(crc.i8v);
I64_MSH(i8val) = I64_MSH(crc.i8v);
i8val[0] = crc.i8v[0];
i8val[1] = crc.i8v[1];
ty = __INT8;
break;
}
Expand All @@ -1866,8 +1866,8 @@ fw_writenum(int code, char *item, int type)
case __INT8:
if (__fortio_check_format())
goto fmt_mismatch;
I64_LSH(i8val) = I64_LSH(crc.i8v);
I64_MSH(i8val) = I64_MSH(crc.i8v);
crc.i8v[0] = i8val[0];
crc.i8v[1] = i8val[1];
dval = crc.r8;
e = 2;
ty = __REAL8;
Expand Down Expand Up @@ -1908,8 +1908,8 @@ fw_writenum(int code, char *item, int type)
case __INT8:
if (__fortio_check_format())
goto fmt_mismatch;
I64_LSH(crc.i8v) = I64_LSH(i8val);
I64_MSH(crc.i8v) = I64_MSH(i8val);
crc.i8v[0] = i8val[0];
crc.i8v[1] = i8val[1];
dval = crc.r8;
w = REAL8_W;
d = REAL8_D;
Expand Down Expand Up @@ -1947,8 +1947,8 @@ fw_writenum(int code, char *item, int type)
case __INT8:
if (__fortio_check_format())
goto fmt_mismatch;
I64_LSH(crc.i8v) = I64_LSH(i8val);
I64_MSH(crc.i8v) = I64_MSH(i8val);
crc.i8v[0] = i8val[0];
crc.i8v[1] = i8val[1];
dval = crc.r8;
if (!e_flag)
e = 2;
Expand Down Expand Up @@ -1979,8 +1979,8 @@ fw_writenum(int code, char *item, int type)
case __INT8:
if (__fortio_check_format())
goto fmt_mismatch;
I64_LSH(crc.i8v) = I64_LSH(i8val);
I64_MSH(crc.i8v) = I64_MSH(i8val);
crc.i8v[0] = i8val[0];
crc.i8v[1] = i8val[1];
dval = crc.r8;
w = REAL8_W;
d = REAL8_D;
Expand Down Expand Up @@ -2009,8 +2009,8 @@ fw_writenum(int code, char *item, int type)
case __INT8:
if (__fortio_check_format())
goto fmt_mismatch;
I64_LSH(crc.i8v) = I64_LSH(i8val);
I64_MSH(crc.i8v) = I64_MSH(i8val);
crc.i8v[0] = i8val[0];
crc.i8v[1] = i8val[1];
dval = crc.r8;
ty = __REAL8;
break;
Expand All @@ -2031,8 +2031,8 @@ fw_writenum(int code, char *item, int type)
case __INT8:
if (__fortio_check_format())
goto fmt_mismatch;
I64_LSH(crc.i8v) = I64_LSH(i8val);
I64_MSH(crc.i8v) = I64_MSH(i8val);
crc.i8v[0] = i8val[0];
crc.i8v[1] = i8val[1];
dval = crc.r8;
w = REAL8_W;
d = REAL8_D;
Expand Down
2 changes: 1 addition & 1 deletion runtime/flang/fork3f.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/* fork3f.c - Implements LIB3F fork subprogram. */

#ifndef _WIN32
#ifndef WINNT

/* must include ent3f.h AFTER io3f.h */
#include "io3f.h"
Expand Down
2 changes: 1 addition & 1 deletion runtime/flang/fstat3f.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int ENT3F(FSTAT, fstat)(int *lu, int *statb)
statb[8] = b.st_atime;
statb[9] = b.st_mtime;
statb[10] = b.st_ctime;
#if !defined(_WIN32)
#if !defined(WINNT)
statb[11] = b.st_blksize;
statb[12] = b.st_blocks;
#else
Expand Down
2 changes: 1 addition & 1 deletion runtime/flang/fstat643f.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

int ENT3F(FSTAT64, fstat64)(int *lu, long long *statb)
{
#if defined(_WIN32)
#if defined(TARGET_WIN) || defined(WIN32) || defined(WIN64)
/*
* The __int64_t members in the _stat64 are 8-byte aligned, thus the
* st_size member is at offset 24. On WIN32, 64-bit ints are 4-byte
Expand Down
2 changes: 1 addition & 1 deletion runtime/flang/getgid3f.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/* getgid3f.c - Implements LIB3F getgid subprogram. */

#ifndef _WIN32
#ifndef WINNT

#include <unistd.h>
#include "ent3f.h"
Expand Down
Loading

0 comments on commit b3ce0e3

Please sign in to comment.