Skip to content

Commit 1a70295

Browse files
committed
Merge branch 'refactoringWarning' into release/v1.5.1J
2 parents 38411f3 + b3ac40d commit 1a70295

13 files changed

Lines changed: 67 additions & 55 deletions

File tree

cobc/codegen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ output_param (cb_tree x, int id)
998998
int extrefs;
999999
int sav_stack_id;
10001000
char fname[12];
1001+
COB_UNUSED(extrefs);
10011002

10021003
param_id = id;
10031004

cobc/pplex.l

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ check_dollar_directive (char *buff, int *line_size)
743743
char sbuff[5][256];
744744
int isDEFINED, isNOT;
745745
int i;
746+
COB_UNUSED(n);
746747

747748
if (cb_source_format == CB_FORMAT_FIXED) {
748749
if (*line_size < 8) {

cobc/pplex.l.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ check_dollar_directive (char *buff, int *line_size)
758758
char sbuff[5][256];
759759
int isDEFINED, isNOT;
760760
int i;
761+
COB_UNUSED(n);
761762

762763
if (cb_source_format == CB_FORMAT_FIXED) {
763764
if (*line_size < 8) {

cobc/tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,7 @@ cb_build_picture (const char *str)
12751275
unsigned char lastonechar = 0;
12761276
unsigned char lasttwochar = 0;
12771277
unsigned char buff[COB_SMALL_BUFF];
1278+
COB_UNUSED(flg);
12781279

12791280
pic = make_tree (CB_TAG_PICTURE, CB_CATEGORY_UNKNOWN, sizeof (struct cb_picture));
12801281
if (strlen (str) > 50) {

cobc/typeck.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ cb_reference_type_check (cb_tree ref, cb_tree x, const char *name, int size, int
832832
char strbuf[256];
833833
int offset = 0 ;
834834
int ret = 0;
835+
COB_UNUSED(r);
835836

836837
r = CB_REFERENCE (ref);
837838
switch (CB_TREE_TAG (x)) {

libcob/call.c

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@
5656
#include <windows.h>
5757
/* Prototype */
5858
static char * lt_dlerror (void);
59-
void init_call_stack_list (void);
60-
struct call_stack_list
61-
cob_create_call_stack_list (const char *);
62-
void cob_cancel_call_stack_list (struct call_stack_list *);
6359

6460
static HMODULE
6561
lt_dlopen (const char *x)
@@ -285,6 +281,48 @@ lookup (const char *name)
285281
return NULL;
286282
}
287283

284+
static void
285+
init_call_stack_list (void)
286+
{
287+
if (!call_stack_list_head) {
288+
call_stack_list_head = cob_malloc (sizeof (struct call_stack_list));
289+
memset (call_stack_list_head, 0, sizeof (struct call_stack_list));
290+
}
291+
current_call_stack_list = call_stack_list_head;
292+
}
293+
294+
static struct call_stack_list *
295+
cob_create_call_stack_list (char *name)
296+
{
297+
struct call_stack_list *new_list = cob_malloc (sizeof (struct call_stack_list));
298+
memset (new_list, 0, sizeof (struct call_stack_list));
299+
new_list->parent = current_call_stack_list;
300+
new_list->name = cob_malloc (strlen (name) + 1);
301+
strcpy (new_list->name, name);
302+
current_call_stack_list = new_list;
303+
return new_list;
304+
}
305+
306+
static void
307+
cob_cancel_call_stack_list (struct call_stack_list *p)
308+
{
309+
if (!p) {
310+
/*No program*/
311+
return;
312+
}
313+
static cob_field_attr a_2 = {33, 0, 0, 0, NULL};
314+
cob_field f = {strlen (p->name), (unsigned char *) p->name, &a_2};
315+
cob_field_cancel (&f);
316+
if (p->children) {
317+
cob_cancel_call_stack_list (p->children);
318+
}
319+
struct call_stack_list *s = p->sister;
320+
while (s != NULL) {
321+
cob_cancel_call_stack_list (s);
322+
s = s->sister;
323+
}
324+
}
325+
288326
const char *
289327
cob_resolve_error (void)
290328
{
@@ -676,6 +714,7 @@ void *
676714
cobsavenv2 (struct cobjmp_buf *jbuf, const int jsize)
677715
{
678716
int jtemp;
717+
COB_UNUSED(jtemp);
679718

680719
/* Shut up compiler */
681720
jtemp = jsize;
@@ -697,28 +736,6 @@ coblongjmp (struct cobjmp_buf *jbuf)
697736
longjmp (jbuf->cbj_jmp_buf, 1);
698737
}
699738

700-
void
701-
init_call_stack_list ()
702-
{
703-
if (!call_stack_list_head) {
704-
call_stack_list_head = cob_malloc (sizeof (struct call_stack_list));
705-
memset (call_stack_list_head, 0, sizeof (struct call_stack_list));
706-
}
707-
current_call_stack_list = call_stack_list_head;
708-
}
709-
710-
struct call_stack_list *
711-
cob_create_call_stack_list (char *name)
712-
{
713-
struct call_stack_list *new_list = cob_malloc (sizeof (struct call_stack_list));
714-
memset (new_list, 0, sizeof (struct call_stack_list));
715-
new_list->parent = current_call_stack_list;
716-
new_list->name = cob_malloc (strlen (name) + 1);
717-
strcpy (new_list->name, name);
718-
current_call_stack_list = new_list;
719-
return new_list;
720-
}
721-
722739
void
723740
cob_push_call_stack_list (char *name)
724741
{
@@ -761,26 +778,6 @@ cob_pop_call_stack_list ()
761778
current_call_stack_list = current_call_stack_list->parent;
762779
}
763780

764-
void
765-
cob_cancel_call_stack_list (struct call_stack_list *p)
766-
{
767-
if (!p) {
768-
/*No program*/
769-
return;
770-
}
771-
static cob_field_attr a_2 = {33, 0, 0, 0, NULL};
772-
cob_field f = {strlen (p->name), (unsigned char *) p->name, &a_2};
773-
cob_field_cancel (&f);
774-
if (p->children) {
775-
cob_cancel_call_stack_list (p->children);
776-
}
777-
struct call_stack_list *s = p->sister;
778-
while (s != NULL) {
779-
cob_cancel_call_stack_list (s);
780-
s = s->sister;
781-
}
782-
}
783-
784781
void
785782
cob_cancel_all ()
786783
{

libcob/call.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct call_stack_list {
3636
struct call_stack_list *parent;
3737
struct call_stack_list *children;
3838
struct call_stack_list *sister;
39-
const char *name;
39+
char *name;
4040
};
4141

4242
DECLNORET COB_EXPIMP void cob_call_error (void) COB_A_NORETURN;

libcob/common.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2095,6 +2095,9 @@ cobcommandline (int flags, int *pargc, char ***pargv, char ***penvp, char **pnam
20952095
char **spenvp;
20962096
char *spname;
20972097
int sflags;
2098+
COB_UNUSED(spenvp);
2099+
COB_UNUSED(spname);
2100+
COB_UNUSED(sflags);
20982101

20992102
if (!cob_initialized) {
21002103
cob_runtime_error ("'cobcommandline' - Runtime has not been initialized");
@@ -2685,7 +2688,7 @@ cob_acuw_calledby (unsigned char *data)
26852688
memset (f1->data, ' ', (int)f1->size);
26862689
return 0;
26872690
} else {
2688-
called_program_name = (const char *)cob_current_module->next->program_id;
2691+
called_program_name = (char *)cob_current_module->next->program_id;
26892692
if (called_program_name == NULL) {
26902693
return -1;
26912694
}

libcob/fileio.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5482,7 +5482,7 @@ cob_acuw_file_delete (unsigned char *file_name, unsigned char *file_type)
54825482
return ret;
54835483
}
54845484

5485-
int
5485+
static int
54865486
cob_listdir_open (cob_field *f_dirname, cob_field *f_pattern)
54875487
{
54885488
//FIXME: now not use file pattern(ex. *).
@@ -5516,10 +5516,11 @@ cob_listdir_open (cob_field *f_dirname, cob_field *f_pattern)
55165516
}
55175517

55185518
#endif
5519-
return listdir_handle;
5519+
//FIXME: now not use handle.
5520+
return 0;
55205521
}
55215522

5522-
int
5523+
static int
55235524
cob_listdir_next (cob_field *f_handle, cob_field *f_filename)
55245525
{
55255526
//FIXME: now not use handle.
@@ -5531,7 +5532,7 @@ cob_listdir_next (cob_field *f_handle, cob_field *f_filename)
55315532
#else
55325533
listdir_filedata = readdir (listdir_handle);
55335534
if (listdir_filedata == NULL) {
5534-
filename = " ";
5535+
filename = NULL;
55355536
}else{
55365537
filename = listdir_filedata->d_name;
55375538
}
@@ -5542,7 +5543,9 @@ cob_listdir_next (cob_field *f_handle, cob_field *f_filename)
55425543
length = f_filename->size;
55435544
}
55445545
memset (f_filename->data, ' ', f_filename->size);
5545-
memcpy (f_filename->data, filename, length);
5546+
if(filename != NULL){
5547+
memcpy (f_filename->data, filename, length);
5548+
}
55465549
#ifdef _WIN32
55475550
if (!FindNextFile (listdir_handle, listdir_filedata)) {
55485551
strcpy (listdir_filedata->cFileName, " ");
@@ -5551,7 +5554,7 @@ cob_listdir_next (cob_field *f_handle, cob_field *f_filename)
55515554
return 0;
55525555
}
55535556

5554-
int
5557+
static int
55555558
cob_listdir_close (cob_field *f_handle)
55565559
{
55575560
//FIXME: now not use handle.

libcob/move.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ cob_move_fp_to_display (cob_field *f1, cob_field *f2)
554554
char *x, *y;
555555
char buff[64];
556556
char buff2[64];
557+
COB_UNUSED(frac);
557558

558559
memset ((ucharptr)buff, 0, sizeof (buff));
559560
memset ((ucharptr)buff2, 0, sizeof (buff2));

0 commit comments

Comments
 (0)