Skip to content

Commit

Permalink
fixes and cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
lefessan committed Oct 23, 2024
1 parent f47a04a commit 5fb3c4c
Show file tree
Hide file tree
Showing 7 changed files with 448 additions and 48 deletions.
464 changes: 436 additions & 28 deletions cobc/ChangeLog

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions cobc/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#
# Makefile gnucobol/cobc
#
# Copyright (C) 2003-2012, 2014-2021 Free Software Foundation, Inc.
Expand All @@ -23,7 +23,7 @@ bin_PROGRAMS = cobc
cobc_SOURCES = cobc.c cobc.h ppparse.y pplex.c parser.y scanner.c config.c \
reserved.c error.c tree.c tree.h field.c typeck.c codegen.c help.c \
config.def flag.def warning.def codeoptim.def ppparse.def \
codeoptim.c replace.c dump_tree.c
codeoptim.c replace.c dump_tree.c

#cobc_SOURCES = cobc.c cobc.h ppparse.y pplex.l parser.y scanner.l config.c

Expand All @@ -40,7 +40,7 @@ COBC = cobc$(EXEEXT)
# sources that needs to be built *before* any other file
# note: we actually want their header files...
BUILT_SOURCES = ppparse.c parser.c
EXTRA_DIST = pplex.l scanner.l ppparse.h parser.h
EXTRA_DIST = pplex.l scanner.l ppparse.h parser.h dump_tree_gen.c

MAINTAINERCLEANFILES = pplex.c scanner.c ppparse.h parser.h cobc.1
CLEANFILES = parser.output ppparse.output
Expand Down
5 changes: 2 additions & 3 deletions cobc/dump_tree.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
Copyright (C) 2001-2023 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman,
Edward Hart, Fabrice Le Fessant
Copyright (C) 2023-2024 Free Software Foundation, Inc.
Written by Fabrice Le Fessant
This file is part of GnuCOBOL.
Expand Down
2 changes: 1 addition & 1 deletion cobc/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -12957,7 +12957,7 @@ cancel_body:
| ALL
{
const char *all_name = "CANCEL ALL";
cb_tree all = cb_build_literal (CB_CATEGORY_ALPHANUMERIC, all_name, strlen (all_name));
struct cb_literal *all = build_literal (CB_CATEGORY_ALPHANUMERIC, all_name, strlen (all_name));
cb_emit_cancel (all);
}
;
Expand Down
13 changes: 3 additions & 10 deletions cobc/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1340,8 +1340,8 @@ cb_to_cname (const char *s)
return copy;
}

static
struct cb_literal *build_literal (const enum cb_category category, const void *data,
struct cb_literal *
build_literal (const enum cb_category category, const void *data,
const size_t size)
{
struct cb_literal *p;
Expand All @@ -1353,13 +1353,6 @@ struct cb_literal *build_literal (const enum cb_category category, const void *d
return p;
}

cb_tree
cb_build_literal (const enum cb_category category, const void *data,
const size_t size)
{
return CB_TREE(build_literal(category, data, size));
}

char *
cb_name (cb_tree x)
{
Expand All @@ -1385,7 +1378,7 @@ cb_exhbit_literal (cb_tree x)
s = cobc_parse_malloc (tlen + 4);
memcpy (s, tmp, tlen);
memcpy (s + tlen, " = ", 4);
return cb_build_literal (CB_CATEGORY_ALPHANUMERIC, s, tlen + 3);
return CB_TREE (build_literal (CB_CATEGORY_ALPHANUMERIC, s, tlen + 3));
}

enum cb_category
Expand Down
2 changes: 1 addition & 1 deletion cobc/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -2257,7 +2257,7 @@ extern cb_tree cb_build_initialize (const cb_tree, const cb_tree,
const enum cob_statement,
const unsigned int);

extern cb_tree cb_build_literal (enum cb_category,
extern struct cb_literal *build_literal (enum cb_category,
const void *, const size_t);

extern cb_tree cb_build_system_name (const enum cb_system_name_category,
Expand Down
4 changes: 2 additions & 2 deletions cobc/typeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -4691,7 +4691,7 @@ create_implicit_assign_dynamic_var (struct cb_program * const prog,
#if 0
p->count++;
#endif
x = cb_build_literal (CB_CATEGORY_ALPHANUMERIC, assign_name, strlen (assign_name));
x = CB_TREE (build_literal (CB_CATEGORY_ALPHANUMERIC, assign_name, strlen (assign_name)));
p->values = CB_LIST_INIT (x);
CB_FIELD_ADD (prog->working_storage, p);
}
Expand Down Expand Up @@ -4763,7 +4763,7 @@ validate_assign_name (struct cb_file * const f,
p = check_level_78 (CB_NAME (assign));
if (p) {
char *c = (char *)CB_LITERAL (p->values)->data;
f->assign = cb_build_literal (CB_CATEGORY_ALPHANUMERIC, c, strlen (c));
f->assign = CB_TREE (build_literal (CB_CATEGORY_ALPHANUMERIC, c, strlen (c)));
return;
}

Expand Down

0 comments on commit 5fb3c4c

Please sign in to comment.