Skip to content

Commit ae414cc

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

File tree

26 files changed

+275
-1
lines changed

26 files changed

+275
-1
lines changed

tools/flang1/flang1exe/detect.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,19 @@ static void tag_comms(int);
2929
static void matched_dim(int);
3030
static void no_comm_class(int);
3131
static void overlap_class(int);
32+
#ifdef FLANG_DETECT_UNUSED
3233
static void copy_section_class(int);
3334
static void gather_class(int, int);
35+
#endif
3436
static void convert_idx_scalar(int);
3537
static int is_structured(int);
38+
#ifdef FLANG_DETECT_UNUSED
3639
static LOGICAL is_scatterx_gatherx_subscript(int, int);
3740
static LOGICAL result_base_relation(int result, int base, int forall);
3841
static LOGICAL mask_array_relation(int mask, int array, int forall);
3942
static int generic_intrinsic_type(int);
4043
static LOGICAL is_all_idx_appears(int, int);
44+
#endif
4145
static LOGICAL is_array_in_expr(int ast);
4246
static LOGICAL is_nonscalar_array_in_expr(int ast);
4347

@@ -698,6 +702,7 @@ no_comm_class(int a)
698702
ARREF_CLASS(arref) = NO_COMM;
699703
}
700704

705+
#ifdef FLANG_DETECT_UNUSED
701706
/* Algorithm:
702707
* This routine does not cares about neither template nor distribution types.
703708
* It looks the subscripts of lhs and rhs:
@@ -920,13 +925,15 @@ scatter_type(int std)
920925
comminfo.scat.function = func;
921926
comminfo.scat.array_simple = TRUE;
922927
}
928+
#endif
923929

924930
LOGICAL
925931
scatter_class(int std)
926932
{
927933
return FALSE;
928934
}
929935

936+
#ifdef FLANG_DETECT_UNUSED
930937
static int
931938
generic_intrinsic_type(int otype)
932939
{
@@ -1025,6 +1032,7 @@ result_base_relation(int result, int base, int forall)
10251032
return TRUE;
10261033
return FALSE;
10271034
}
1035+
#endif
10281036

10291037
/** \brief Inquire whether array has indirection in its subscripts */
10301038
LOGICAL
@@ -1649,6 +1657,7 @@ convert_idx_scalar(int arref)
16491657
}
16501658
}
16511659

1660+
#ifdef FLANG_DETECT_UNUSED
16521661
/* This routine is to check
16531662
* whether all ind from list appears at array subscript
16541663
* For example, (i=, j=) a(i,j) true
@@ -1684,4 +1693,5 @@ is_all_idx_appears(int a, int list)
16841693
}
16851694
return TRUE;
16861695
}
1696+
#endif
16871697

tools/flang1/flang1exe/dpm_out.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,22 @@
3838
#define NO_DERIVEDPTR XBIT(58, 0x40000)
3939

4040
static void handle_nonalloc_template(void);
41+
#ifdef FLANG_DPM_OUT_UNUSED
4142
static int exist_test(int, int);
4243

4344
static void add_adjarr_bounds_extr_f77(int, int, int);
45+
#endif
4446
static bool allocate_one_auto(int);
4547
static void component_init_allocd_auto(int, int);
4648
static int bnd_assn_precedes(int, int, int);
4749
static void add_auto_bounds(int, int);
4850
static void mk_allocate_scalar(int memberast, int sptr, int before);
4951
static void mk_deallocate_scalar(int memberast, int sptr, int after);
5052
static void dealloc_dt_auto(int, int, int);
53+
#ifdef FLANG_DPM_OUT_UNUSED
5154
static int find_actual(int, int, int);
5255
static void set_actual(int, int, LOGICAL);
56+
#endif
5357

5458
static void open_entry_guard(int);
5559
static void close_entry_guard(void);
@@ -68,16 +72,22 @@ static void change_mk_id(int sptr, int sptr1);
6872
static void do_change_mk_id(void);
6973

7074
static void finish_fl(void);
75+
#ifdef FLANG_DPM_OUT_UNUSED
7176
static void add_fl(int);
77+
#endif
7278
static bool emit_alnd(int sptr, int memberast, LOGICAL free_flag,
7379
LOGICAL for_allocate, int allocbounds);
7480
static void emit_secd(int sptr, int memberast, LOGICAL free_flag,
7581
LOGICAL for_allocate);
82+
#ifdef FLANG_DPM_OUT_UNUSED
7683
static void construct_align_sc(int, int, int);
84+
#endif
7785
static void fix_sdsc_sc(int, int, int);
7886
static void emit_redim(int arg);
7987
static void emit_kopy_in(int, int, int);
88+
#ifdef FLANG_DPM_OUT_UNUSED
8089
static LOGICAL is_f77_adjustable(int sptr);
90+
#endif
8191
static void emit_scalar_kopy_in(int, int);
8292
static int gen_ptr_in(int, int);
8393
static int gen_ptr_out(int, int);
@@ -94,9 +104,11 @@ static void update_dist(int);
94104
static int get_scalar_in_expr(int expr, int std, LOGICAL astversion);
95105
static int emit_get_scalar_sub(int, int);
96106

107+
#ifdef FLANG_DPM_OUT_UNUSED
97108
static void update_with_actual(int);
98109
static void update_bounds_with_actual(int);
99110
static void emit_bcst_scalar(int sptr, int std);
111+
#endif
100112

101113
static int get_arg_table(void);
102114
static void put_arg_table(int);
@@ -192,6 +204,7 @@ finish_fl(void)
192204
FREE(fl.base);
193205
}
194206

207+
#ifdef FLANG_DPM_OUT_UNUSED
195208
static void
196209
add_fl(int a)
197210
{
@@ -224,6 +237,7 @@ add_fl(int a)
224237
fl.base[nd] = a;
225238
}
226239
}
240+
#endif
227241

228242
/**
229243
\brief Stub
@@ -507,6 +521,7 @@ make_alnd(int sptr)
507521
return nd;
508522
}
509523

524+
#ifdef FLANG_DPM_OUT_UNUSED
510525
static void
511526
construct_align_sc(int alnd, int alignee, int target)
512527
{
@@ -626,6 +641,7 @@ construct_align_sc(int alnd, int alignee, int target)
626641
return;
627642
}
628643
}
644+
#endif
629645

630646
static LOGICAL
631647
is_set(int flag, int value)
@@ -2670,6 +2686,7 @@ newargs_for_entry(int this_entry)
26702686
return new_dscptr;
26712687
}
26722688

2689+
#ifdef FLANG_DPM_OUT_UNUSED
26732690
/* This routine generate IFTHEN to test static descriptor
26742691
* initilaized. "if(a$sd(1) .eq. 0)
26752692
*/
@@ -2688,6 +2705,7 @@ exist_test(int sdsc, int memberast)
26882705
A_IFEXPRP(astnew, ifexpr);
26892706
return astnew;
26902707
}
2708+
#endif
26912709

26922710
static int *orderargs; /* List of arguments in dependence order. */
26932711

@@ -3289,6 +3307,7 @@ emit_kopy_in(int arg, int this_entry, int actual)
32893307
gbitable.unconditional = 1;
32903308
} /* emit_kopy_in */
32913309

3310+
#ifdef FLANG_DPM_OUT_UNUSED
32923311
/* Return TRUE if the arry given by sptr is adjustable according to
32933312
* Fortran-77. */
32943313
static LOGICAL
@@ -3325,6 +3344,7 @@ is_f77_adjustable(int sptr)
33253344
}
33263345
return TRUE;
33273346
}
3347+
#endif
33283348

33293349
/* pghpf_copy_out_(void *db, void *sb, section *ds,
33303350
* section *ss, int intent);
@@ -4526,6 +4546,7 @@ redimension(int sptr, int memberast)
45264546
add_stmt_before(astnew, EntryStd);
45274547
}
45284548

4549+
#ifdef FLANG_DPM_OUT_UNUSED
45294550
static void
45304551
add_adjarr_bounds_extr_f77(int sym, int entry, int call_ast)
45314552
{
@@ -4667,6 +4688,7 @@ set_actual(int entry, int call_ast, LOGICAL arrays)
46674688
}
46684689
}
46694690
}
4691+
#endif
46704692

46714693
#undef BND_ASSN_PRECEDES
46724694

tools/flang1/flang1exe/dump.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ putint(char *s, int d)
7272
putit();
7373
} /* putint */
7474

75+
#ifdef FLANG_DUMP_UNUSED
7576
static void
7677
putintstar(char *s, int d, int star, char *starstring)
7778
{
@@ -82,6 +83,7 @@ putintstar(char *s, int d, int star, char *starstring)
8283
}
8384
putit();
8485
} /* putintstar */
86+
#endif
8587

8688
static void
8789
put2int(char *s, int d1, int d2)
@@ -204,6 +206,7 @@ putsym1(int sptr)
204206
putit();
205207
} /* putsym1 */
206208

209+
#ifdef FLANG_DUMP_UNUSED
207210
static void
208211
putintsym1(int d, int sptr)
209212
{
@@ -216,6 +219,7 @@ putintsym1(int d, int sptr)
216219
}
217220
putit();
218221
} /* putintsym1 */
222+
#endif
219223

220224
static void
221225
putsymilist(int symi)
@@ -499,6 +503,7 @@ dumplists()
499503
}
500504
} /* dumplists */
501505

506+
#ifdef FLANG_DUMP_UNUSED
502507
static void
503508
putsymflags()
504509
{
@@ -577,6 +582,7 @@ putsymflags()
577582
putit();
578583
}
579584
} /* putsymflags */
585+
#endif
580586

581587
static void
582588
putbit(char *s, int b)
@@ -605,6 +611,7 @@ check(char *s, int v)
605611
}
606612
} /* check */
607613

614+
#ifdef FLANG_DUMP_UNUSED
608615
static void
609616
putmap(char *s, int m)
610617
{
@@ -624,6 +631,7 @@ putmap(char *s, int m)
624631
putit();
625632
}
626633
} /* putmap */
634+
#endif
627635

628636
void
629637
putasttype(char *s, int opc)

tools/flang1/flang1exe/exterf.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,28 @@ static void export_ieee_arith_libraries(void);
110110
static void export_one_std(int);
111111
static void queue_one_std(int std);
112112
static void all_stds(void (*)(int));
113+
#ifdef FLANG_EXTERF_UNUSED
113114
static void export_parameter_info(ast_visit_fn);
115+
#endif
114116
static void export_data_file(int);
115117
static void export_component_init(int);
116118
static void export_data_file_asts(ast_visit_fn, int, int, int);
117119
static void export_component_init_asts(ast_visit_fn, int, int);
120+
#ifdef FLANG_EXTERF_UNUSED
118121
static void export_equiv_asts(int, ast_visit_fn);
119122
static void export_dist_info(int, ast_visit_fn);
120123
static void export_align_info(int, ast_visit_fn);
124+
#endif
121125
static void export_equivs(void);
122126
static void export_external_equiv();
123127

128+
#ifdef FLANG_EXTERF_UNUSED
124129
static void export_dinit_file(void (*)(int), void (*)(int, INT), int);
125130
static void export_dinit_record(int, INT);
131+
#endif
126132
static int dtype_skip(int dtype);
127133

134+
#ifdef FLANG_EXTERF_UNUSED
128135
/* return 1 if the base type is double/complex/other 8-byte-type */
129136
static int
130137
doubletype(int sptr)
@@ -149,6 +156,7 @@ doubletype(int sptr)
149156
}
150157
return 0;
151158
} /* doubletype */
159+
#endif
152160

153161
void
154162
export_public_module(int module, int exceptlist)
@@ -2886,13 +2894,16 @@ all_stds(void (*callproc)(int))
28862894
(*callproc)(std);
28872895
}
28882896

2897+
#ifdef FLANG_EXTERF_UNUSED
28892898
/* export a single record to the interf file */
28902899
static void
28912900
export_dinit_record(int rectype, INT recval)
28922901
{
28932902
lzprintf(outlz, "I %d %x\n", rectype, recval);
28942903
} /* export_dinit_record */
2904+
#endif
28952905

2906+
#ifdef FLANG_EXTERF_UNUSED
28962907
/*
28972908
* go through data initialization file.
28982909
* call symproc for symbols in that file that will be saved
@@ -2988,7 +2999,9 @@ export_dinit_file(void (*symproc)(int), void (*recproc)(int, INT),
29882999
}
29893000
dinit_fseek_end();
29903001
} /* export_dinit_file */
3002+
#endif
29913003

3004+
#ifdef FLANG_EXTERF_UNUSED
29923005
/* go through symbols; if we find one that is a parameter, export
29933006
* the ASTs for its value */
29943007
static void
@@ -3003,7 +3016,9 @@ export_parameter_info(ast_visit_fn astproc)
30033016
}
30043017
}
30053018
} /* export_parameter_info */
3019+
#endif
30063020

3021+
#ifdef FLANG_EXTERF_UNUSED
30073022
static int
30083023
externalequiv(int evp)
30093024
{
@@ -3018,7 +3033,9 @@ externalequiv(int evp)
30183033
} while (evp != 0 && EQV(evp).is_first == 0);
30193034
return FALSE;
30203035
} /* externalequiv */
3036+
#endif
30213037

3038+
#ifdef FLANG_EXTERF_UNUSED
30223039
static void
30233040
export_equiv_asts(int queuesym, ast_visit_fn astproc)
30243041
{
@@ -3049,6 +3066,7 @@ export_equiv_asts(int queuesym, ast_visit_fn astproc)
30493066
}
30503067
}
30513068
} /* export_equiv_asts */
3069+
#endif
30523070

30533071
static void
30543072
export_equiv_item(int evp)
@@ -3067,6 +3085,7 @@ export_equiv_item(int evp)
30673085
lzprintf(outlz, " -1\n"); /* end of subscripts */
30683086
} /* export_equiv_item */
30693087

3088+
#ifdef FLANG_EXTERF_UNUSED
30703089
static void
30713090
export_external_equiv()
30723091
{
@@ -3084,6 +3103,7 @@ export_external_equiv()
30843103
}
30853104
}
30863105
} /* export_external_equiv */
3106+
#endif
30873107

30883108
static void
30893109
export_equivs(void)

0 commit comments

Comments
 (0)