Skip to content

Commit

Permalink
Merge branch 'gnucobol-3.x' into gcos4gnucobol-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
lefessan committed Apr 12, 2023
2 parents 3d48698 + 57c12c6 commit 7981d8a
Show file tree
Hide file tree
Showing 43 changed files with 986 additions and 571 deletions.
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@

2023-03-03 Simon Sobisch <[email protected]>

* configure.ac: allow specification of XML2_CONFIG (only used if
pkg-config module libxml-2.0 is not available)
* configure.ac: check all used headers of libxml-2.0,
warn user if not found
* improve multiple header header check via AC_CHECK_HEADERS according
to docs (cJSON, json-c and curses)

2023-02-27 Simon Sobisch <[email protected]>

* configure.ac: fixed duplicate note about JSON_C_C_FLAGS,
changed messages as per autoconf docs

2023-02-19 Simon Sobisch <[email protected]>

* configure.ac: minor adjustment for bdb library lookup
Expand Down
37 changes: 36 additions & 1 deletion cobc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@

2023-03-08 Emilien Lemaire <[email protected]>

* reserved.c (get_user_specified_reserved_word): add check for
context sensitivity in aliases

2023-03-03 Simon Sobisch <[email protected]>

* typeck.c (cb_build_cond_fields): optimize comparison between field and
ZEROES up to COB_ZEROES_ALPHABETIC_BYTE_LENGTH

2023-02-28 Simon Sobisch <[email protected]>

* typeck.c (cb_emit_set_to): generate runtime check for SET source
at most one time
* cobc.c (process_filename) [_WIN32 __GNUC__]: pass .dll input files
to linker (GCC MinGW extension to drop need of link libraries)
* cobc.c (xref_files_and_their_records, xref_labels): minor refactoring

2023-02-24 Simon Sobisch <[email protected]>

* codegen.c (output_initial_values): drop wrong init comment
* field.c (copy_into_field): set EXTERNAL name if missing
* pplex.l, scanner.l: dropped extra line breaks before area_a token
* pplex.l (ppinput): insert "preparse area_a token" in column 1 instead
of column 2 to fix terminal-format support and insert it before
newlines are added to the beginning of the buffer

2023-02-20 Nicolas Berthier <[email protected]>

* scanner.l, config.def: Add support for EBCDIC symbolic characters in
alphanumeric literals, which is a GCOS-specific extension; add new
configuration option ebcdic-symbolic-characters
* scanner.l, pplex.l: detect and issue a warning when EBCDIC
symbolic character strings include extraneous separators

2023-02-21 Simon Sobisch <[email protected]>

* codegen.c, flag.def [COBC_HAS_CUTOFF_FLAG]: fix compile errors,
Expand Down Expand Up @@ -685,7 +720,7 @@
FR #360 AREACHECK
FR #309 raise warnings/errors when some periods are missing
* config.def: add dialect options areacheck and missing-period
* pplex.l, scanner.l, parser.y: check for empty Area A, and use a
* pplex.l, scanner.l, parser.y: check for empty Area A, and use a set of
dedicated *_IN_AREA_A tokens to detect missing periods and incorrect
use of Area A
* pplex.l, scanner.l, parser.y: support AREACHECK and NOAREACHECK
Expand Down
28 changes: 15 additions & 13 deletions cobc/cobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4244,9 +4244,12 @@ process_filename (const char *filename)
#if defined(__OS400__)
extension[0] == 0
#else
cb_strcasecmp (extension, COB_OBJECT_EXT) == 0
cb_strcasecmp (extension, COB_OBJECT_EXT) == 0
#if defined(_WIN32)
|| cb_strcasecmp (extension, "lib") == 0
#if defined (__GNUC__)
|| cb_strcasecmp (extension, "dll") == 0
#endif
#endif
#if !defined(_WIN32) || defined(__MINGW32__) || defined(__MINGW64__)
|| cb_strcasecmp (extension, "a") == 0
Expand Down Expand Up @@ -5904,12 +5907,12 @@ xref_files_and_their_records (cb_tree file_list_p)
cb_tree l;

for (l = file_list_p; l; l = CB_CHAIN (l)) {
struct cb_file *file = CB_FILE (CB_VALUE (l));
pd_off = sprintf (print_data, "%-30.30s %-6u ",
CB_FILE (CB_VALUE (l))->name,
CB_FILE (CB_VALUE (l))->common.source_line);
xref_print (&CB_FILE (CB_VALUE (l))->xref, XREF_FILE, NULL);
if (CB_FILE (CB_VALUE (l))->record) {
(void)xref_fields (CB_FILE (CB_VALUE (l))->record);
file->name, file->common.source_line);
xref_print (&file->xref, XREF_FILE, NULL);
if (file->record) {
(void)xref_fields (file->record);
}
print_program_data ("");
}
Expand All @@ -5930,15 +5933,14 @@ xref_fields_in_section (struct cb_field *first_field_in_section)
}

static int
xref_labels (cb_tree label_list_p)
xref_labels (cb_tree statements)
{
cb_tree l;
char label_type = ' ';
struct cb_label *lab;

for (l = label_list_p; l; l = CB_CHAIN (l)) {
if (CB_LABEL_P(CB_VALUE(l))) {
lab = CB_LABEL (CB_VALUE (l));
cb_tree l;
for (l = statements; l; l = CB_CHAIN (l)) {
cb_tree stmt = CB_VALUE (l);
if (CB_LABEL_P (stmt)) {
struct cb_label *lab = CB_LABEL (stmt);
if (lab->xref.skip) {
continue;
}
Expand Down
7 changes: 2 additions & 5 deletions cobc/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -10505,7 +10505,6 @@ output_initial_values (struct cb_field *f)
continue;
}
x = cb_build_field_reference (p, NULL);
output_line ("/* initialize field %s */", f->name);
output_stmt (cb_build_initialize (x, cb_true, NULL, 1, STMT_INIT_STORAGE, 0));
output_newline ();
}
Expand Down Expand Up @@ -12323,10 +12322,8 @@ output_internal_function (struct cb_program *prog, cb_tree parameter_list)
gen_init_working = 1; /* Disable use of DEPENDING ON fields */
/* Initialize WORKING-STORAGE EXTERNAL items */
for (f = prog->working_storage; f; f = f->sister) {
if (f->redefines) {
continue;
}
if (!f->flag_external) {
if (!f->flag_external
|| f->redefines) {
continue;
}
output_prefix ();
Expand Down
3 changes: 3 additions & 0 deletions cobc/config.def
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ CB_CONFIG_SUPPORT (cb_hp_octal_literals, "hp-octal-literals",
CB_CONFIG_SUPPORT (cb_acu_literals, "acu-literals",
_("ACUCOBOL-GT literals (#B #O #H #X)"))

CB_CONFIG_BOOLEAN (cb_gcos_ebcdic_literals, "ebcdic-symbolic-characters",
_("EBCDIC symbolic characters in literals (\" \"135,151,151\"bar\"195, 194\"Z\" for \" foobarBAZ\")"))

CB_CONFIG_SUPPORT (cb_word_continuation, "word-continuation",
_("continuation of COBOL words"))

Expand Down
10 changes: 6 additions & 4 deletions cobc/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,10 +823,11 @@ cb_syntax_check (const char *fmt, ...)
enum cb_warn_val ret;
va_list ap;
va_start (ap, fmt);
if (cb_relaxed_syntax_checks)
if (cb_relaxed_syntax_checks) {
ret = cb_warning_internal (COBC_WARN_FILLER, fmt, ap);
else
} else {
ret = cb_error_internal (fmt, ap);
}
va_end (ap);
return cb_relaxed_syntax_checks ? ret != COBC_WARN_DISABLED : 0;
}
Expand All @@ -843,10 +844,11 @@ cb_syntax_check_x (cb_tree x, const char *fmt, ...)
enum cb_warn_val ret;
va_list ap;
va_start (ap, fmt);
if (cb_relaxed_syntax_checks)
if (cb_relaxed_syntax_checks) {
ret = cb_warning_x_internal (COBC_WARN_FILLER, x, fmt, ap);
else
} else {
ret = cb_error_x_internal (x, fmt, ap);
}
va_end (ap);
return cb_relaxed_syntax_checks ? ret != COBC_WARN_DISABLED : 0;
}
Expand Down
8 changes: 8 additions & 0 deletions cobc/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,14 @@ copy_into_field (struct cb_field *source, struct cb_field *target)
but may be specified on the field */
if (target->level == 1 || target->level == 77) {
field_attribute_copy (flag_external);
if (target->flag_external
&& !target->ename) {
#if 1 /* CHECKME: Which one to use? Possibly depending on AS clause? */
target->ename = source->ename;
#else
target->ename = cb_to_cname (target->name);
#endif
}
}
target->usage = source->usage;
if (source->values) {
Expand Down
2 changes: 1 addition & 1 deletion cobc/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ cobc_print_usage_common_options (void)
puts (_(" -I <directory> add <directory> to copy/include search path"));
puts (_(" -L <directory> add <directory> to library search path"));
puts (_(" -l <lib> link the library <lib>"));
puts (_(" -K <entry> generate CALL to <entry> as static"));
puts (_(" -D <define> define <define> for COBOL compilation"));
puts (_(" -A <options> add <options> to the C compile phase"));
puts (_(" -Q <options> add <options> to the C link phase"));
puts (_(" -Q <options> add <options> to the C link phase"));
puts (_(" --coverage instrument generated binaries for coverage"));
puts (_(" --conf=<file> user-defined dialect configuration; see -std"));
puts (_(" --list-reserved display reserved words"));
Expand Down
18 changes: 10 additions & 8 deletions cobc/pplex.l
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ static struct cb_text_list *pp_text_list_add (struct cb_text_list *,

WORD [_0-9A-Z\x80-\xFF-]+
NUMRIC_LITERAL [+-]?[0-9,.]*[0-9]
ALNUM_LITERAL "\""[^""\n]*"\""|"\'"[^''\n]*"\'"
ALNUM_LITERAL_Q "\""([^""\n]|("\""[0-9][0-9, ]*"\""))*"\""
ALNUM_LITERAL_A "\'"([^''\n]|("\'"[0-9][0-9, ]+"\'"))*"\'"
ALNUM_LITERAL {ALNUM_LITERAL_Q}|{ALNUM_LITERAL_A}
SET_PAREN_LIT \([^()\n]*\)
DEFNUM_LITERAL [+-]?[0-9]*[\.]*[0-9]+

Expand Down Expand Up @@ -505,7 +507,7 @@ MAYBE_AREA_A [ ]?#?
needed to properly handle the first line in each buffer, that for
some reason always starts with a space.
*/
fprintf (ppout, "\n#area_a\n");
fprintf (ppout, "#area_a\n");
}

"CONTROL"[ ,;\n]+"DIVISION" {
Expand Down Expand Up @@ -2499,11 +2501,6 @@ start:
} else {
/* Insert newlines at the start of the buffer */
gotcr = strlen (buff);
if (newline_count != 0) {
memmove (buff + newline_count, buff, gotcr + 1);
memset (buff, '\n', newline_count);
gotcr += newline_count;
}
if (in_area_a) {
/* (*area-a*): prepend special marker `#', indicating
the current non-continuation line starts in area A
Expand All @@ -2512,9 +2509,14 @@ start:
Assumes `buff' is large enough for one extra char. */
memmove (buff + 1, buff, gotcr + 1);
buff[1] = '#';
buff[0] = '#';
gotcr += 1;
}
if (newline_count != 0) {
memmove (buff + newline_count, buff, gotcr + 1);
memset (buff, '\n', newline_count);
gotcr += newline_count;
}
newline_count = 1;
}
return (int)gotcr;
Expand Down
5 changes: 5 additions & 0 deletions cobc/reserved.c
Original file line number Diff line number Diff line change
Expand Up @@ -4234,6 +4234,11 @@ get_user_specified_reserved_word (struct amendment_list user_reserved)
p = find_default_reserved_word (user_reserved.alias_for, 0);
if (p) {
cobc_reserved.token = p->token;
if (user_reserved.is_context_sensitive) {
cobc_reserved.context_sens =
!!user_reserved.is_context_sensitive;
cobc_reserved.context_test = p->context_test;
}
} else {
/* FIXME: can we point to the fname originally defining the word? */
configuration_error (NULL, 0, 1,
Expand Down
Loading

0 comments on commit 7981d8a

Please sign in to comment.