Skip to content

Commit d8ebef3

Browse files
Kush Bhagatbryanpkc
authored andcommitted
[runtime] Guard unused code with macros; NFCI
1 parent ae414cc commit d8ebef3

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed

runtime/flang/allo.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ static long num_hdrs = NUM_HDRS;
102102

103103
#define ALLHDR()
104104

105+
#ifdef FLANG_ALLO_UNUSED
105106
/** \brief
106107
* Allocate ALLO_HDR list */
107108
static void
@@ -138,6 +139,7 @@ allhdr()
138139

139140
MP_V(sem);
140141
}
142+
#endif
141143

142144
/** \brief
143145
* Return nonzero if addresses p1 and p2 are aligned with respect to a

runtime/flang/encodefmt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ int *len;
705705

706706
/* ---------------------------------------------------------------- */
707707

708+
#ifdef FLANG_ENCODEFMT_UNUSED
708709
static int ef_nextdtchar(p, len)
709710
/* call after encounter DT */
710711
char *p;
@@ -723,6 +724,7 @@ int *len;
723724
c = c + ('A' - 'a');
724725
return c;
725726
}
727+
#endif
726728

727729
/* -------------------------------------------------------------------- */
728730

runtime/flang/fmtconv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ static void conv_e(int, int, int, bool);
3737
static void conv_en(int, int, bool);
3838
static void conv_es(int, int, bool);
3939
static void conv_f(int, int);
40+
#ifdef FLANG_FMTCONV_UNUSED
4041
static void fp_canon(__BIGREAL_T, int, int);
4142
static void cvtp_round(int);
43+
#endif
4244
static void cvtp_cp(int);
4345
static void cvtp_set(int, int);
4446
static void alloc_fpbuf(int);
@@ -1063,6 +1065,7 @@ __fortio_fmt_z(unsigned int c)
10631065
return buff_pos;
10641066
}
10651067

1068+
#ifdef FLANG_FMTCONV_UNUSED
10661069
static void
10671070
fp_canon(__BIGREAL_T val, int type, int round)
10681071
{
@@ -1119,6 +1122,7 @@ cvtp_round(int d)
11191122
}
11201123

11211124
}
1125+
#endif
11221126

11231127
static void
11241128
cvtp_cp(int n)

runtime/flang/fpcvt.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ static void fperror(int x);
5656
#define FP_UNDERFLOW_ERROR -3
5757
#define FP_UNDEFINED_ERROR -4
5858

59+
#ifdef FLANG_FPCVT_UNUSED
5960
static void
6061
ui64toa(INT m[2], char *s, int n, int decpl)
6162
{
@@ -89,6 +90,7 @@ ui64toa(INT m[2], char *s, int n, int decpl)
8990
s[j] = buff[i];
9091
s[j] = '\0';
9192
}
93+
#endif
9294

9395
static void
9496
manshftr(INT *m, /* m[4] */
@@ -299,6 +301,7 @@ ufpxten(UFP *u, int exp)
299301
u->fexp += ftab1[i][2] + ftab2[j][2];
300302
}
301303

304+
#ifdef FLANG_FPCVT_UNUSED
302305
static void
303306
ufptosci(UFP *u, char *s, int dp, int *decpt, int *sign)
304307
{
@@ -340,7 +343,9 @@ ufptosci(UFP *u, char *s, int dp, int *decpt, int *sign)
340343
}
341344
*decpt = exp10;
342345
}
346+
#endif
343347

348+
#ifdef FLANG_FPCVT_UNUSED
344349
static void
345350
ufptodec(UFP *u, char *s, int dp, int *decpt, int *sign)
346351
{
@@ -363,7 +368,9 @@ ufptodec(UFP *u, char *s, int dp, int *decpt, int *sign)
363368
manrnd(u->fman, 64);
364369
ui64toa(u->fman, s, 0, dp);
365370
}
371+
#endif
366372

373+
#ifdef FLANG_FPCVT_UNUSED
367374
static void
368375
dtoufp(IEEE64 d, UFP *u)
369376
{
@@ -396,6 +403,7 @@ dtoufp(IEEE64 d, UFP *u)
396403
} else
397404
u->fman[0] |= 0x00100000L;
398405
}
406+
#endif
399407

400408
static void
401409
ufptod(UFP *u, IEEE64 *r)

runtime/flang/query.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static int I8(fetch_int)(void *b, F90_Desc *s)
3232
}
3333
}
3434

35+
#ifdef FLANG_QUERY_UNUSED
3536
static int I8(fetch_log)(void *b, F90_Desc *s)
3637
{
3738
dtype kind = TYPEKIND(s);
@@ -49,6 +50,7 @@ static int I8(fetch_log)(void *b, F90_Desc *s)
4950
return 0;
5051
}
5152
}
53+
#endif
5254

5355
static void I8(fetch_vector)(void *ab, F90_Desc *as, __INT_T *vector,
5456
int veclen)

runtime/flang/rdst.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ I8(is_nonsequential_section)(F90_Desc *a, __INT_T dim)
261261
#define EXPAND 0x080
262262
#define RECOPY 0x100
263263

264+
#ifdef FLANG_RDST_UNUSED
264265
static void
265266
invalid_flags(int flags)
266267
{
@@ -270,6 +271,7 @@ invalid_flags(int flags)
270271
#endif
271272
__fort_abort("COPY_IN: internal error, invalid flags");
272273
}
274+
#endif
273275

274276
static void
275277
copy_in_abort(char *msg)
@@ -2827,7 +2829,10 @@ ENTF90(EXECCMDLINE, execcmdline)(DCHAR(command), __LOG_T *wait,
28272829
__INT_T *cmdstat_int_kind
28282830
DCLEN64(command) DCLEN64(cmdmsg)) {
28292831
char *cmd, *cmdmes;
2830-
int cmdmes_len, stat;
2832+
int cmdmes_len;
2833+
#if (defined(TARGET_LINUX_X8664) || defined(TARGET_OSX_X8664) || defined(TARGET_LINUX_POWER) || defined(TARGET_LINUX_ARM32) || defined(TARGET_LINUX_ARM64)) && !defined(TARGET_WIN)
2834+
int stat;
2835+
#endif
28312836
int cmdflag = 0;
28322837
enum CMD_ERR{NO_SUPPORT_ERR=-1, FORK_ERR=1, EXECL_ERR=2, SIGNAL_ERR=3};
28332838

0 commit comments

Comments
 (0)