Skip to content

Commit 84c55ce

Browse files
committed
Merge remote-tracking branch 'upstream/master' into gc4
2 parents 83582e3 + dc2da87 commit 84c55ce

Some content is hidden

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

51 files changed

+1080
-839
lines changed

build_windows/ChangeLog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@
363363
version_libcob.rc, version_cobcrun.rc provided by Simon)
364364

365365

366-
Copyright 2014-2023 Free Software Foundation, Inc.
366+
Copyright 2014-2024 Free Software Foundation, Inc.
367367

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

cobc/ChangeLog

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11

2+
2024-06-19 David Declerck <david.declerck@ocamlpro.com>
3+
4+
* cobc.c (process_compile): fix MSVC build command
5+
6+
2024-05-15 Simon Sobisch <simonsobisch@gnu.org>
7+
8+
* replace.c: fix compile warnings and formatting
9+
210
2024-05-14 David Declerck <david.declerck@ocamlpro.com>
311

412
* flag.def: fix macro usage for MSVC
513

14+
2024-05-14 Simon Sobisch <simonsobisch@gnu.org>
15+
16+
* tree.h: inclusion of cobc.h for types
17+
* codeoptim.c, config.c, error.c, field.c, replace.c, reserved.c:
18+
dropped unused header ctype
19+
* codeoptim.c: dropped unused headers stdlib and string
20+
621
2024-05-03 Simon Sobisch <simonsobisch@gnu.org>
722

823
* cobc.c (main): refactored to not need iterating via "iparams"
@@ -8110,7 +8125,11 @@
81108125

81118126
2014-12-11 Ron Norman <rjn@inglenet.com>
81128127

8113-
* Fixes so WARNING is given if no DETAIL lines in a report
8128+
* fixes so WARNING is given if no DETAIL lines in a report
8129+
8130+
2014-06-17 Ron Norman <rjn@inglenet.com>
8131+
8132+
* parser.y, tree.c, codegen.c: added check to verify PAGE LIMITS of report
81148133

81158134
2014-06-16 Simon Sobisch <simonsobisch@gnu.org>
81168135

cobc/cobc.c

Lines changed: 53 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2990,18 +2990,15 @@ static int
29902990
process_command_line (const int argc, char **argv)
29912991
{
29922992
struct cb_define_struct *p;
2993-
size_t osize;
29942993
int c;
29952994
int idx;
2996-
int n;
29972995
int exit_option = 0;
29982996
int list_reserved = 0;
29992997
int list_registers = 0;
30002998
int list_intrinsics = 0;
30012999
int list_system_names = 0;
30023000
int list_exceptions = 0;
30033001
int list_system_routines = 0;
3004-
enum cob_exception_id i;
30053002
char ext[COB_MINI_BUFF];
30063003
char *conf_label; /* we want a dynamic address for error.c, not a static one */
30073004
char *conf_entry;
@@ -3055,14 +3052,15 @@ process_command_line (const int argc, char **argv)
30553052
long_options, &idx, 1)) >= 0) {
30563053
switch (c) {
30573054

3058-
case 7:
3055+
case CB_FLAG_GETOPT_MAX_ERRORS: {
30593056
/* -fmax-errors=<xx> : Maximum errors until abort */
3060-
n = cobc_deciph_optarg (cob_optarg, 0);
3057+
const int n = cobc_deciph_optarg (cob_optarg, 0);
30613058
if (n < 0) {
30623059
cobc_err_exit (COBC_INV_PAR, "-fmax-errors");
30633060
}
30643061
cb_max_errors = n;
30653062
break;
3063+
}
30663064

30673065
case '?':
30683066
/* Unknown option or ambiguous,
@@ -3209,7 +3207,7 @@ process_command_line (const int argc, char **argv)
32093207
/* output version information when running very verbose -vv */
32103208
/* pass verbose switch to invoked commands when running very very verbose -vvv */
32113209
if (cob_optarg) {
3212-
n = cobc_deciph_optarg (cob_optarg, 0);
3210+
const int n = cobc_deciph_optarg (cob_optarg, 0);
32133211
if (n == -1) {
32143212
cobc_err_exit (COBC_INV_PAR, "--verbose");
32153213
}
@@ -3219,8 +3217,9 @@ process_command_line (const int argc, char **argv)
32193217
}
32203218
break;
32213219

3222-
case '$':
3220+
case '$': {
32233221
/* -std=<xx> : Specify dialect */
3222+
int n;
32243223
if (strlen (cob_optarg) > (COB_MINI_MAX - 6)) {
32253224
cobc_err_exit (COBC_INV_PAR, "-std");
32263225
}
@@ -3231,6 +3230,7 @@ process_command_line (const int argc, char **argv)
32313230
snprintf (cob_std_conf, sizeof(cob_std_conf), "%s.conf", cob_optarg);
32323231
num_std++;
32333232
break;
3233+
}
32343234

32353235
case '&':
32363236
/* -conf=<xx> : Specify dialect configuration file */
@@ -3323,12 +3323,12 @@ process_command_line (const int argc, char **argv)
33233323
cobc_wants_debug = 1;
33243324
break;
33253325

3326-
case CB_FLAG_GETOPT_DUMP: /* 8 */
3326+
case CB_FLAG_GETOPT_DUMP:
33273327
/* -fdump=<scope> : Add sections for dump code generation */
33283328
cobc_def_dump_opts (cob_optarg, 1);
33293329
break;
33303330

3331-
case CB_FLAG_GETOPT_NO_DUMP: /* 13 */
3331+
case CB_FLAG_GETOPT_NO_DUMP:
33323332
/* -fno-dump=<scope> : Suppress sections in dump code generation */
33333333
if (cob_optarg) {
33343334
cobc_def_dump_opts (cob_optarg, 0);
@@ -3357,6 +3357,7 @@ process_command_line (const int argc, char **argv)
33573357
} else
33583358
if (cb_config_name == NULL) {
33593359
#ifdef WITH_STD
3360+
int n;
33603361
strcpy(ext, WITH_STD);
33613362
for (n=0; ext[n] != 0; n++)
33623363
ext[n] = toupper(ext[n]);
@@ -3382,6 +3383,7 @@ process_command_line (const int argc, char **argv)
33823383

33833384
/* debug: Turn on all exception conditions */
33843385
if (cobc_wants_debug) {
3386+
enum cob_exception_id i;
33853387
for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) {
33863388
CB_EXCEPTION_ENABLE (i) = 1;
33873389
}
@@ -3534,9 +3536,9 @@ process_command_line (const int argc, char **argv)
35343536
/* these options were processed in the first getopt-run */
35353537
break;
35363538

3537-
case 'o':
3539+
case 'o': {
35383540
/* -o : Output file */
3539-
osize = strlen (cob_optarg);
3541+
const size_t osize = strlen (cob_optarg);
35403542
if (osize > COB_SMALL_MAX) {
35413543
cobc_err_exit (_("invalid output file name"));
35423544
}
@@ -3548,6 +3550,7 @@ process_command_line (const int argc, char **argv)
35483550
/* Allocate buffer plus extension reserve */
35493551
output_name_buff = cobc_main_malloc (osize + 32U);
35503552
break;
3553+
}
35513554

35523555
case '0':
35533556
/* -O0 : disable optimizations (or at least minimize them) */
@@ -3834,16 +3837,17 @@ process_command_line (const int argc, char **argv)
38343837
CB_TEXT_LIST_ADD (cb_early_exit_list, cob_optarg);
38353838
break;
38363839

3837-
case CB_FLAG_GETOPT_STACK_SIZE: /* 1 */
3840+
case CB_FLAG_GETOPT_STACK_SIZE: {
38383841
/* -fstack-size=<xx> : Specify stack (perform) size */
3839-
n = cobc_deciph_optarg (cob_optarg, 0);
3842+
const int n = cobc_deciph_optarg (cob_optarg, 0);
38403843
if (n < 16 || n > 512) {
38413844
cobc_err_exit (COBC_INV_PAR, "-fstack-size");
38423845
}
38433846
cb_stack_size = n;
38443847
break;
3848+
}
38453849

3846-
case CB_FLAG_GETOPT_SIGN: /* 3 */
3850+
case CB_FLAG_GETOPT_SIGN:
38473851
/* -fsign=<ASCII/EBCDIC> : Specify display sign */
38483852
if (!cb_strcasecmp (cob_optarg, "EBCDIC")) {
38493853
cb_ebcdic_sign = 1;
@@ -3854,26 +3858,26 @@ process_command_line (const int argc, char **argv)
38543858
}
38553859
break;
38563860

3857-
case CB_FLAG_GETOPT_EBCDIC_TABLE: /* 14 */
3861+
case CB_FLAG_GETOPT_EBCDIC_TABLE:
38583862
/* -febcdic-table=<cconv-table> */
38593863
cb_ebcdic_table = cobc_main_strdup (cob_optarg);
38603864
break;
38613865

3862-
case CB_FLAG_GETOPT_DEFAULT_COLSEQ: /* 15 */
3866+
case CB_FLAG_GETOPT_DEFAULT_COLSEQ:
38633867
/* -fdefault-colseq=<ASCII/EBCDIC/NATIVE> */
38643868
if (cb_deciph_default_colseq_name (cob_optarg)) {
38653869
cobc_err_exit (COBC_INV_PAR, "-fdefault-colseq");
38663870
}
38673871
break;
38683872

3869-
case CB_FLAG_GETOPT_DEFAULT_FILE_COLSEQ: /* 16 */
3873+
case CB_FLAG_GETOPT_DEFAULT_FILE_COLSEQ:
38703874
/* -fdefault-file-colseq=<ASCII/EBCDIC/NATIVE> */
38713875
if (cb_deciph_default_file_colseq_name (cob_optarg)) {
38723876
cobc_err_exit (COBC_INV_PAR, "-fdefault-file-colseq");
38733877
}
38743878
break;
38753879

3876-
case CB_FLAG_GETOPT_FOLD_COPY: /* 4 */
3880+
case CB_FLAG_GETOPT_FOLD_COPY:
38773881
/* -ffold-copy=<UPPER/LOWER> : COPY fold case */
38783882
if (!cb_strcasecmp (cob_optarg, "UPPER")) {
38793883
cb_fold_copy = COB_FOLD_UPPER;
@@ -3884,7 +3888,7 @@ process_command_line (const int argc, char **argv)
38843888
}
38853889
break;
38863890

3887-
case CB_FLAG_GETOPT_FOLD_CALL: /* 5 */
3891+
case CB_FLAG_GETOPT_FOLD_CALL:
38883892
/* -ffold-call=<UPPER/LOWER> : CALL/PROG-ID fold case */
38893893
if (!cb_strcasecmp (cob_optarg, "UPPER")) {
38903894
cb_fold_call = COB_FOLD_UPPER;
@@ -3895,44 +3899,43 @@ process_command_line (const int argc, char **argv)
38953899
}
38963900
break;
38973901

3898-
case CB_FLAG_GETOPT_TTITLE: /* 6 */
3902+
case CB_FLAG_GETOPT_TTITLE: {
38993903
/* -fttitle=<title> : Title for listing */
3900-
{
3901-
const size_t len = strlen (cob_optarg);
3902-
size_t i;
3903-
if (cb_listing_with_title)
3904-
cobc_main_free (cb_listing_with_title);
3905-
cb_listing_with_title = cobc_main_strdup (cob_optarg);
3906-
for (i = 0; i < len; i++) {
3907-
if (cb_listing_with_title[i] == '_')
3908-
cb_listing_with_title[i] = ' ';
3909-
}
3904+
const size_t len = strlen (cob_optarg);
3905+
size_t i;
3906+
if (cb_listing_with_title)
3907+
cobc_main_free (cb_listing_with_title);
3908+
cb_listing_with_title = cobc_main_strdup (cob_optarg);
3909+
for (i = 0; i < len; i++) {
3910+
if (cb_listing_with_title[i] == '_')
3911+
cb_listing_with_title[i] = ' ';
39103912
}
39113913
break;
3914+
}
39123915

3913-
case CB_FLAG_GETOPT_MAX_ERRORS: /* 7 */
3916+
case CB_FLAG_GETOPT_MAX_ERRORS:
39143917
/* -fmax-errors=<xx> : Maximum errors until abort */
39153918
/* This option was processed in the first getopt-run */
39163919
break;
39173920

3918-
case CB_FLAG_GETOPT_DUMP: /* 8 */
3921+
case CB_FLAG_GETOPT_DUMP:
39193922
/* -fdump=<scope> : Add sections for dump code generation */
3920-
case CB_FLAG_GETOPT_NO_DUMP: /* 13 */
3923+
case CB_FLAG_GETOPT_NO_DUMP:
39213924
/* -fno-dump=<scope> : Suppress sections in dump code generation */
39223925
/* These options were all processed in the first getopt-run */
39233926
break;
39243927

3925-
case CB_FLAG_GETOPT_CALLFH: /* 9 */
3928+
case CB_FLAG_GETOPT_CALLFH:
39263929
/* -fcallfh=<func> : Function-name for EXTFH */
39273930
cb_call_extfh = cobc_main_strdup (cob_optarg);
39283931
break;
39293932

3930-
case CB_FLAG_GETOPT_INTRINSICS: /* 10 */
3933+
case CB_FLAG_GETOPT_INTRINSICS:
39313934
/* -fintrinsics=<xx> : Intrinsic name or ALL */
39323935
cobc_deciph_funcs (cob_optarg);
39333936
break;
39343937

3935-
case CB_FLAG_GETOPT_SQLSCHEMA: /* 20 */
3938+
case CB_FLAG_GETOPT_SQLSCHEMA:
39363939
/* -fsqlschema=<name> : Database schema name for XFD */
39373940
cb_sqldb_schema = cobc_main_strdup (cob_optarg);
39383941
cb_flag_sql_xfd = 1;
@@ -3955,7 +3958,7 @@ process_command_line (const int argc, char **argv)
39553958
#endif
39563959
break;
39573960

3958-
case CB_FLAG_GETOPT_FILE_FORMAT: /* 21 */
3961+
case CB_FLAG_GETOPT_FILE_FORMAT:
39593962
/* -ffile-format=<name> : Default file format */
39603963
if (cb_strcasecmp (cob_optarg, "mf") == 0) {
39613964
cb_mf_files = 1;
@@ -3967,39 +3970,39 @@ process_command_line (const int argc, char **argv)
39673970
}
39683971
break;
39693972

3970-
case CB_FLAG_GETOPT_EC: /* 11 */
3973+
case CB_FLAG_GETOPT_EC:
39713974
/* -fec=<xx> : COBOL exception-name, e.g. EC-BOUND-OVERFLOW,
39723975
also allows to skip the prefix e.g. BOUND-OVERFLOW */
39733976
if (cobc_deciph_ec (cob_optarg, 1U)) {
39743977
cobc_err_exit (COBC_INV_PAR, "-fec");
39753978
};
39763979
break;
39773980

3978-
case CB_FLAG_GETOPT_NO_EC: /* 12 */
3981+
case CB_FLAG_GETOPT_NO_EC:
39793982
/* -fno-ec=<xx> : COBOL exception-name, e.g. EC-BOUND-OVERFLOW */
39803983
if (cobc_deciph_ec (cob_optarg, 0)) {
39813984
cobc_err_exit (COBC_INV_PAR, "-fno-ec");
39823985
};
39833986
break;
39843987

3985-
case CB_FLAG_GETOPT_MEMORY_CHECK: /* 17 */
3986-
/* -fmemory-check=<scope> : */
3988+
case CB_FLAG_GETOPT_MEMORY_CHECK:
3989+
/* -fmemory-check=<scope> : extra memcmp for memory-guard */
39873990
if (!cob_optarg) {
39883991
cb_flag_memory_check = CB_MEMCHK_ALL;
39893992
} else if (cobc_deciph_memory_check (cob_optarg)) {
39903993
cobc_err_exit (COBC_INV_PAR, "-fmemory-check");
39913994
}
39923995
break;
39933996

3994-
case CB_FLAG_GETOPT_COPY_FILE: /* 18 */
3997+
case CB_FLAG_GETOPT_COPY_FILE:
39953998
/* --copy=<file> : COPY file at beginning */
39963999
if (strlen (cob_optarg) > (COB_MINI_MAX)) {
39974000
cobc_err_exit (COBC_INV_PAR, "--copy");
39984001
}
39994002
CB_TEXT_LIST_ADD (cb_copy_list, cobc_strdup (cob_optarg));
40004003
break;
40014004

4002-
case CB_FLAG_GETOPT_INCLUDE_FILE: /* 19 */
4005+
case CB_FLAG_GETOPT_INCLUDE_FILE:
40034006
/* -include=<file.h> : add #include "file.h" to
40044007
generated C file */
40054008
if (strlen (cob_optarg) > (COB_MINI_MAX)) {
@@ -4125,7 +4128,8 @@ process_command_line (const int argc, char **argv)
41254128

41264129
/* LCOV_EXCL_START */
41274130
default:
4128-
cobc_err_msg ("missing evaluation of command line option '%c'", c); /* not translated as unlikely */
4131+
/* not translated as unlikely */
4132+
cobc_err_msg ("missing evaluation of command line option '%c'", c);
41294133
COBC_ABORT ();
41304134
/* LCOV_EXCL_STOP */
41314135

@@ -8301,6 +8305,9 @@ process_compile (struct filename *fn)
83018305
name = file_basename (fn->source, NULL);
83028306
#ifndef _MSC_VER
83038307
strcat (name, ".s");
8308+
#else
8309+
/* earlier versions of msbuild don't recognize .s */
8310+
strcat (name, ".asm");
83048311
#endif
83058312
}
83068313
size = strlen (name);
@@ -8315,11 +8322,12 @@ process_compile (struct filename *fn)
83158322
cobc_chk_buff_size (bufflen);
83168323

83178324
#ifdef _MSC_VER
8325+
/* TODO: we likely need to call ml.exe / ml64.exe */
83188326
sprintf (cobc_buffer, cb_source_debugging ?
83198327
"%s /c %s %s /Od /MDd /Zi /FR /c /Fa\"%s\" /Fo\"%s\" \"%s\"" :
83208328
"%s /c %s %s /MD /c /Fa\"%s\" /Fo\"%s\" \"%s\"",
83218329
cobc_cc, cobc_cflags, cobc_include, name,
8322-
name, fn->translate);
8330+
fn->object, fn->translate);
83238331
if (verbose_output > 1) {
83248332
return process (cobc_buffer);
83258333
} else {

cobc/codegen.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6259,7 +6259,7 @@ output_initialize_record_one (struct cb_initialize *p, cb_tree c,
62596259
multi VALUES */
62606260
if (p->val && f->values && CB_LIST_P (f->values)) {
62616261
const cb_tree save_val = p->val;
6262-
const int save_default = p->flag_default;
6262+
const unsigned char save_default = p->flag_default;
62636263
p->val = NULL;
62646264
p->flag_default = 1;
62656265
output_initialize_one (p, c);
@@ -14948,8 +14948,6 @@ codegen_internal (struct cb_program *prog, const int subsequent_call)
1494814948
cb_tree l;
1494914949
int i;
1495014950

14951-
int comment_gen;
14952-
1495314951
struct cb_report *rep;
1495414952

1495514953
/* skip prototypes */
@@ -15085,7 +15083,7 @@ codegen_internal (struct cb_program *prog, const int subsequent_call)
1508515083

1508615084
/* Report data fields */
1508715085
if (prog->report_storage) {
15088-
comment_gen = 0;
15086+
int comment_gen = 0;
1508915087
for (l = prog->report_list; l; l = CB_CHAIN (l)) {
1509015088
if (!CB_VALUE (l)) {
1509115089
continue;

0 commit comments

Comments
 (0)