Skip to content

Commit a1c841d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into gc4
2 parents 149a215 + 97b7aa1 commit a1c841d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1128
-543
lines changed

ChangeLog

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11

2-
2024-09-19 David Declerck <david.declerck@ocamlpro.com>
2+
2025-02-11 David Declerck <david.declerck@ocamlpro.com>
33

4-
* configure.ac: replace AC_ARG_VAR by AC_SUBST where appropriate
4+
* configure.ac: add -Wno-unused-command-line-argument to CFLAGS under
5+
Clang, to prevent some features to be mistakenly detected as missing
6+
(in particular -Wno-pointer-sign and -fstack-clash-protection)
57

6-
2023-07-24 Simon Sobisch <simonsobisch@gnu.org>
8+
2024-09-19 David Declerck <david.declerck@ocamlpro.com>
79

8-
* configure.ac: fix for resolving COBCRUN_NAME
10+
* configure.ac: replace AC_ARG_VAR by AC_SUBST where appropriate
911

1012
2024-05-14 David Declerck <david.declerck@ocamlpro.com>
1113

1214
* configure.ac: update flags for building dynamic libraries on macOS
1315
(helps fixing testsuite issues on recent macOS versions)
1416

17+
2023-08-22 Simon Sobisch <simonsobisch@gnu.org>
18+
19+
* configure.ac: add -fstack-clash-protection to --enable-hardening[=no]
20+
21+
2023-07-28 Simon Sobisch <simonsobisch@gnu.org>
22+
23+
* configure.ac, NEWS: updated for 3.2
24+
* configure.ac: check for mousemask and mmask_t
25+
26+
2023-07-24 Simon Sobisch <simonsobisch@gnu.org>
27+
28+
* configure.ac: fix for resolving COBCRUN_NAME
29+
1530
2023-05-25 Chuck Haatvedt <chuck.haatvedt+cobol@gmail.com>
1631

1732
* configure.ac: added test for HAVE_RESIZE_TERM function
@@ -1682,7 +1697,7 @@
16821697
* Version 0.9 released.
16831698

16841699

1685-
Copyright 2002-2023 Free Software Foundation, Inc.
1700+
Copyright 2002-2024 Free Software Foundation, Inc.
16861701

16871702
Copying and distribution of this file, with or without modification, are
16881703
permitted provided the copyright notice and this notice are preserved.

NEWS

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,39 @@ Open Plans:
9494

9595
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9696

97-
GnuCOBOL 3.2
97+
GnuCOBOL 3.3 (planned January 2023)
98+
99+
work in progress
100+
101+
* New GnuCOBOL features
102+
103+
** cobc now checks for binary files and early exit parsing those;
104+
the error output for format errors (for example invalid indicator column)
105+
is now limitted to 5 per source file
106+
107+
more work in progress
108+
109+
* Important Bugfixes
110+
111+
** #904: MOVE PACKED-DECIMAL unsigned to signed led to bad sign
112+
113+
* Changes to the COBOL compiler (cobc) options:
114+
115+
** output of unlimited errors may be requested by -fmax-errors=0,
116+
to stop compiliation at first error use -Wfatal-errors
117+
** default value for -fmax-errors was changed from 128 to 20
118+
119+
* More notable changes
120+
121+
** execution times were significantly reduced for the following:
122+
INSPECT CONVERTING (and "simple" INSPECT REPLACING), in general
123+
and especially if both from and to are constants
124+
125+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126+
127+
GnuCOBOL 3.2 (20230728)
128+
GnuCOBOL 3.2rc1 (20230118)
129+
GnuCOBOL 3.2rc2 (20230210)
98130

99131
* New GnuCOBOL features
100132

@@ -436,7 +468,7 @@ Open Plans:
436468

437469
** the -P flag accepts - as argument for stdout
438470

439-
* Important Bugfixes:
471+
* Important Bugfixes
440472

441473
** for dialects other than the GnuCOBOL default different reserved "alias" words
442474
were not usable, for example SYNCHRONIZED or COMPUTATIONAL. This was fixed

build_windows/config.h.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@
411411
/* #undef HAVE_ATTRIBUTE_CONSTRUCTOR - using DllMain */
412412
#endif
413413

414+
/* Has __attribute__((pure)) */
415+
/* #undef HAVE_ATTRIBUTE_PURE */
416+
414417
/* Define to 1 if you have the `canonicalize_file_name' function. */
415418
#if defined(__ORANGEC__)
416419
#define HAVE_CANONICALIZE_FILE_NAME 1
@@ -659,6 +662,13 @@
659662
/* #undef HAVE_MOUSEINTERVAL */
660663
#endif
661664

665+
/* curses has mousemask function and mmask_t definition */
666+
#if CONFIGURED_CURSES != NOCURSES
667+
#define HAVE_MOUSEMASK 1
668+
#else
669+
/* #undef HAVE_MOUSEMASK */
670+
#endif
671+
662672
/* Define to 1 if you have the <mpir.h> header file. */
663673
#if USED_MATHLIB == MATHLIB_MPIR
664674
#define HAVE_MPIR_H 1

cobc/ChangeLog

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,52 @@
3636
* typeck.c (cb_emit, cb_emit_list): changed from defines to inline
3737
functions, now returning the tree that was emitted
3838

39+
2023-09-12 Simon Sobisch <simonsobisch@gnu.org>
40+
41+
* codegen.c (literal_list): removed self-reference as tree
42+
* replace.c (ppecho_replace): now inline
43+
* replace.c (cb_free_replace): removed setting child to zero before free
44+
* replace.c: style adjustment
45+
46+
2023-09-07 Simon Sobisch <simonsobisch@gnu.org>
47+
48+
* typeck.c (cb_build_converting): protoype (disabled) to pre-generate
49+
conversion table and call new function cob_inspect_translating instead
50+
of cob_inspect_converting if both operands are literals/alphabets
51+
52+
2023-09-06 Simon Sobisch <simonsobisch@gnu.org>
53+
54+
* typeck.c (validate_inspect): check for identical operands,
55+
check for invalid combination of operands
56+
* typeck.c (cb_build_converting): shortcut when identical operands
57+
are used
58+
* tree.h: change alphabet_target and alphabet_type from defines to enums
59+
3960
2023-09-01 Simon Sobisch <simonsobisch@gnu.org>
4061

62+
* pplex.l (ppopen_get_file): test for binary file and directly error out
63+
* cobc.c (cobc_terminate_exit), cobc.h: split cobc_terminate and make
64+
the new function available
65+
* pplex.l: check for format errors per file and skip format related
66+
warnings if the file reached a max. of 5 such errors
4167
* error.c, cobc.c (print_program_trailer), flag.def:
4268
implemented -fmax-errors=0 as unlimited
69+
* flag.def (max_errors): reduced default from 128 to 20
70+
* config.c (cb_load_conf), error.c (configuration_error): count missing
71+
definitions as single error
72+
* cobc.c (process_command_line): passing -O0 by defaut for -g as some
73+
C compilers raise warnings otherwise, breaking the testsuite
74+
75+
2023-08-25 Simon Sobisch <simonsobisch@gnu.org>
76+
77+
* codeoptim.c (cob_gen_optim): fixed to actually skip leading zeros
78+
for COB_GET_NUMDISP and COB_GET_NUMDISPS
79+
80+
2023-08-22 Simon Sobisch <simonsobisch@gnu.org>
81+
82+
* typeck.c (emit_definition_note): renamed from warning_destination
83+
* typeck.c (emit_definition_note), tree.h (cb_field): prevent output
84+
of the same field multiple times by new flag_had_definition_note
4385

4486
2023-07-26 Simon Sobisch <simonsobisch@gnu.org>
4587

cobc/cobc.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,25 +2256,31 @@ set_listing_date (void)
22562256
LISTING_TIMESTAMP_FORMAT, &current_compile_tm);
22572257
}
22582258

2259-
2260-
DECLNORET static void COB_A_NORETURN
2261-
cobc_terminate (const char *str)
2259+
void
2260+
cobc_terminate_exit (const char *filename, const char *error)
22622261
{
22632262
if (cb_src_list_file) {
22642263
set_listing_date ();
22652264
set_standard_title ();
22662265
cb_listing_linecount = cb_lines_per_page;
2267-
cobc_elided_strcpy (cb_listing_filename, str, sizeof (cb_listing_filename), 0);
2266+
cobc_elided_strcpy (cb_listing_filename, filename, sizeof (cb_listing_filename), 0);
22682267
print_program_header ();
22692268
}
2270-
cb_perror (0, "cobc: %s: %s", str, cb_get_strerror ());
2269+
cb_source_line = 0; /* no context output for fatal open input/output errors */
2270+
cb_perror (0, "cobc: %s: %s", filename, error);
22712271
if (cb_src_list_file) {
22722272
print_program_trailer ();
22732273
}
22742274
cobc_clean_up (1);
22752275
exit (EXIT_FAILURE);
22762276
}
22772277

2278+
DECLNORET static void COB_A_NORETURN
2279+
cobc_terminate (const char *filename)
2280+
{
2281+
cobc_terminate_exit (filename, cb_get_strerror ());
2282+
}
2283+
22782284
static void
22792285
cobc_abort_msg (void)
22802286
{
@@ -3284,6 +3290,10 @@ process_command_line (const int argc, char **argv)
32843290
#ifdef COB_DEBUG_FLAGS
32853291
COBC_ADD_STR (cobc_cflags, " ", cobc_debug_flags, NULL);
32863292
#endif
3293+
if (copt == NULL) {
3294+
/* some compilers warn if not explicit passed, so default to -O0 for -g */
3295+
copt = CB_COPT_0;
3296+
}
32873297
break;
32883298

32893299
case 'G':

cobc/cobc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ extern void cb_add_error_to_listing (const char *, int, const char *, char *);
628628
DECLNORET extern void flex_fatal_error (const char *, const char *,
629629
const int) COB_A_NORETURN;
630630

631+
DECLNORET extern void cobc_terminate_exit (const char *, const char *) COB_A_NORETURN;
632+
631633
extern void cobc_set_listing_header_code (void);
632634

633635
/* reserved.c */

cobc/codegen.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ struct attr_list {
104104
struct literal_list {
105105
struct literal_list *next;
106106
struct cb_literal *literal;
107-
cb_tree x;
108107
int id;
109108
int make_decimal;
110109
};
@@ -720,7 +719,12 @@ output_string (const unsigned char *s, const int size, const cob_u32_t llit)
720719
} else
721720
#endif
722721
if (!isprint (c)) {
722+
#if 1 /* octal */
723723
output ("\\%03o", c);
724+
#else /* hex (can be useful for a small amount of non-printable characters,
725+
but gets really uggly if the string has a lot of those */
726+
output ("\" \"\\x%X\" \"", c);
727+
#endif
724728
} else if (c == '\"') {
725729
output ("\\%c", c);
726730
} else if ((c == '\\' || c == '?') && !llit) {
@@ -825,18 +829,17 @@ chk_field_variable_address (struct cb_field *fld)
825829
if (!cb_odoslide)
826830
return 0;
827831
if (!fld->flag_vaddr_done) {
828-
/* Note: this is called _very_ often and takes 15-20% of parse + codegen time,
832+
/* Note: this was called _very_ often and took 15-20% of parse + codegen time,
829833
with about half the time in chk_field_variable_size; so try to not call
830834
this function if not necessary (according to the testsuite: as long as
831835
cb_odoslide is not set, but the caller's coverage is not that well...) */
832836
struct cb_field *f = fld;
833837
struct cb_field *p;
834838
for (p = f->parent; p; f = f->parent, p = f->parent) {
835839
for (p = p->children; p != f; p = p->sister) {
836-
/* Skip PIC L fields as their representation
837-
have constant length */
838-
if (p->depending ||
839-
(!p->flag_picture_l && chk_field_variable_size (p))) {
840+
if (p->depending /* ODO leads to variable size */
841+
|| (!p->flag_picture_l && chk_field_variable_size (p)) /* skipping PIC L fields */
842+
) {
840843
fld->flag_vaddr_done = 1;
841844
fld->vaddr = 1;
842845
return 1;
@@ -3177,7 +3180,7 @@ output_literals_figuratives_and_constants (void)
31773180
for (lit = literal_cache; lit; lit = lit->next) {
31783181
output ("static const cob_field %s%d\t= ",
31793182
CB_PREFIX_CONST, lit->id);
3180-
output_field (lit->x);
3183+
output_field (CB_TREE(lit->literal));
31813184
output (";");
31823185
output_newline ();
31833186
}
@@ -3379,7 +3382,6 @@ cb_lookup_literal (cb_tree x, int make_decimal)
33793382
l->id = cb_literal_id;
33803383
l->literal = literal;
33813384
l->make_decimal = make_decimal;
3382-
l->x = x;
33833385
l->next = literal_cache;
33843386
literal_cache = l;
33853387

@@ -5579,8 +5581,8 @@ output_initialize_uniform (cb_tree x, struct cb_field *f,
55795581
output_size (x);
55805582
output (");");
55815583
} else if (!gen_init_working
5582-
&& (f->flag_unbounded || !(cb_complex_odo || cb_odoslide))
5583-
&& chk_field_variable_size (f) != NULL) {
5584+
&& (f->flag_unbounded || !(cb_complex_odo || cb_odoslide))
5585+
&& chk_field_variable_size (f) != NULL) {
55845586
out_odoslide_size (f);
55855587
output (");");
55865588
} else {
@@ -13568,7 +13570,7 @@ output_internal_function (struct cb_program *prog, cb_tree parameter_list)
1356813570
/* Check matching version */
1356913571
#if !defined (HAVE_ATTRIBUTE_CONSTRUCTOR)
1357013572
#ifdef _WIN32
13571-
if (prog->flag_main) /* otherwise we generate that in DllMain*/
13573+
if (prog->flag_main) /* otherwise we generate that in DllMain */
1357213574
#else
1357313575
if (!prog->nested_level)
1357413576
#endif
@@ -13667,8 +13669,7 @@ output_internal_function (struct cb_program *prog, cb_tree parameter_list)
1366713669

1366813670
seen = 0;
1366913671
for (m = literal_cache; m; m = m->next) {
13670-
if (CB_TREE_CLASS (m->x) == CB_CLASS_NUMERIC
13671-
&& m->make_decimal) {
13672+
if (m->make_decimal) {
1367213673
if (!seen) {
1367313674
seen = 1;
1367413675
output_line ("/* Set Decimal Constant values */");
@@ -13887,8 +13888,7 @@ output_internal_function (struct cb_program *prog, cb_tree parameter_list)
1388713888
output_line ("P_clear_decimal:");
1388813889
seen = 0;
1388913890
for (m = literal_cache; m; m = m->next) {
13890-
if (CB_TREE_CLASS (m->x) == CB_CLASS_NUMERIC
13891-
&& m->make_decimal) {
13891+
if (m->make_decimal) {
1389213892
if (!seen) {
1389313893
seen = 1;
1389413894
output_line ("/* Clear Decimal Constant values */");
@@ -14972,8 +14972,7 @@ codegen_finalize (void)
1497214972
struct literal_list* m;
1497314973
int comment_gen = 0;
1497414974
for (m = literal_cache; m; m = m->next) {
14975-
if (CB_TREE_CLASS (m->x) == CB_CLASS_NUMERIC
14976-
&& m->make_decimal) {
14975+
if (m->make_decimal) {
1497714976
if (!comment_gen) {
1497814977
comment_gen = 1;
1497914978
output_storage ("\n/* Decimal constants */\n");

0 commit comments

Comments
 (0)