Skip to content

Commit 7959b24

Browse files
committed
Merge remote-tracking branch 'upstream/master' into gc4
2 parents d5bcec1 + 0d6e40f commit 7959b24

40 files changed

+3666
-1103
lines changed

TODO

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ https://sourceforge.net/p/gnucobol/code/HEAD/tree/external-doc/guide/
210210

211211
- Rework the context-sensitive reserved words handling (or use a bigger type)
212212

213+
- Replace checks for statement that still use cobc_cs_check to [current_}statement->statement
214+
213215
- Add --error-list -e to cobc
214216

215217
- Check how to deal with IMPEXP in coblocal.h (should probably be in the "lib" directory as a static library to link with the other libraries)

cobc/ChangeLog

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
2025-05-21 David Declerck <[email protected]>
3+
4+
revert 2018-07-31 changes preferring normalization of
5+
numeric DISPLAY data including 0x00
6+
27
2025-05-21 David Declerck <[email protected]>
38

49
* cobc.c: fix duplicate values for CB_FLAG_GETOPT_GENTABLE
@@ -163,6 +168,20 @@
163168
* typeck.c (cb_emit, cb_emit_list): changed from defines to inline
164169
functions, now returning the tree that was emitted
165170

171+
2024-07-29 Chuck Haatvedt <[email protected]>
172+
173+
* tree.c (cb_build_picture): added logic to find the valid floating
174+
symbol if one exists and pass that symbol to the downstream functions
175+
* tree.c (valid_char_order): adjust the precedence in an ambigous
176+
where +$9 or 9$+ to identify the condition of the $ correctly
177+
to fix bug #935
178+
* tree.c (find_floating_insertion_str): generate a compile error
179+
if an invalid symbol is found between the float symbols; this also
180+
allows the COBOL 2023 standard to be more closely followed for
181+
display numeric edited picture strings
182+
* tree.c (char_to_precedence_idx): changed to check penultimate and last
183+
symbols before the first and second symbols
184+
166185
2024-07-26 Simon Sobisch <[email protected]>
167186

168187
* parser.y, config.def: rewrite ENVIRONMENT DIVISION parsing to allow
@@ -171,10 +190,18 @@
171190
* reserved.c: make MENU context-sensitive
172191
* reserved.c, parser.y: added MODAL + MODELESS to acu extension windows
173192

193+
2024-07-10 Chuck Haatvedt <[email protected]>
194+
195+
* tree.c (cb_build_picture): fixed currency scale counting logic
196+
174197
2024-06-19 David Declerck <[email protected]>
175198

176199
* cobc.c (process_compile): fix MSVC build command
177200

201+
2024-06-11 Chuck Haatvedt <[email protected]>
202+
203+
* tree.c (cb_build_picture): fixed currency digit counting logic
204+
178205
2024-05-16 David Declerck <[email protected]>
179206

180207
* cobc.c (process_compile)[_MSC_VER]: adjustment for compile

cobc/field.c

Lines changed: 26 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,6 +2269,7 @@ static unsigned int
22692269
validate_elementary_item (struct cb_field *f)
22702270
{
22712271
unsigned int ret;
2272+
cb_tree x;
22722273

22732274
ret = validate_usage (f);
22742275
if (f->flag_sign_clause) {
@@ -2294,6 +2295,7 @@ validate_elementary_item (struct cb_field *f)
22942295
ret |= validate_pic (f);
22952296

22962297
/* TODO: This is not validation and should be elsewhere. */
2298+
x = CB_TREE (f);
22972299
switch (f->usage) {
22982300
case CB_USAGE_DISPLAY:
22992301
if (current_program
@@ -2308,36 +2310,43 @@ validate_elementary_item (struct cb_field *f)
23082310
f->usage = CB_USAGE_COMP_5;
23092311
f->pic = cb_build_binary_picture ("BINARY-CHAR", 2, 1);
23102312
f->flag_real_binary = 1;
2313+
validate_field_clauses (x, f);
23112314
break;
23122315
case CB_USAGE_SIGNED_SHORT:
23132316
f->usage = CB_USAGE_COMP_5;
23142317
f->pic = cb_build_binary_picture ("BINARY-SHORT", 4, 1);
23152318
f->flag_real_binary = 1;
2319+
validate_field_clauses (x, f);
23162320
break;
23172321
case CB_USAGE_SIGNED_INT:
23182322
f->usage = CB_USAGE_COMP_5;
23192323
f->pic = cb_build_binary_picture ("BINARY-LONG", 9, 1);
23202324
f->flag_real_binary = 1;
2325+
validate_field_clauses (x, f);
23212326
break;
23222327
case CB_USAGE_SIGNED_LONG:
23232328
f->usage = CB_USAGE_COMP_5;
23242329
f->pic = cb_build_binary_picture ("BINARY-DOUBLE", 18, 1);
23252330
f->flag_real_binary = 1;
2331+
validate_field_clauses (x, f);
23262332
break;
23272333
case CB_USAGE_UNSIGNED_CHAR:
23282334
f->usage = CB_USAGE_COMP_5;
23292335
f->pic = cb_build_binary_picture ("BINARY-CHAR", 2, 0);
23302336
f->flag_real_binary = 1;
2337+
validate_field_clauses (x, f);
23312338
break;
23322339
case CB_USAGE_UNSIGNED_SHORT:
23332340
f->usage = CB_USAGE_COMP_5;
23342341
f->pic = cb_build_binary_picture ("BINARY-SHORT", 4, 0);
23352342
f->flag_real_binary = 1;
2343+
validate_field_clauses (x, f);
23362344
break;
23372345
case CB_USAGE_UNSIGNED_INT:
23382346
f->usage = CB_USAGE_COMP_5;
23392347
f->pic = cb_build_binary_picture ("BINARY-LONG", 9, 0);
23402348
f->flag_real_binary = 1;
2349+
validate_field_clauses (x, f);
23412350
break;
23422351
case CB_USAGE_POINTER:
23432352
if (cb_numeric_pointer) {
@@ -2349,6 +2358,7 @@ validate_elementary_item (struct cb_field *f)
23492358
f->usage = CB_USAGE_COMP_5;
23502359
f->pic = cb_build_binary_picture ("BINARY-DOUBLE", 18, 0);
23512360
f->flag_real_binary = 1;
2361+
validate_field_clauses (x, f);
23522362
break;
23532363
default:
23542364
break;
@@ -2358,7 +2368,6 @@ validate_elementary_item (struct cb_field *f)
23582368
if (f->flag_blank_zero
23592369
&& f->pic
23602370
&& f->pic->category == CB_CATEGORY_NUMERIC) {
2361-
cb_tree x;
23622371
cob_pic_symbol *pstr = NULL;
23632372
int n = 0;
23642373
/* Reconstruct the picture string */
@@ -2377,74 +2386,6 @@ validate_elementary_item (struct cb_field *f)
23772386
pstr->times_repeated = 1;
23782387
++pstr;
23792388
}
2380-
}
2381-
x = CB_TREE (f);
2382-
2383-
switch (f->usage) {
2384-
default:
2385-
break;
2386-
case CB_USAGE_DISPLAY:
2387-
if (current_program->flag_trailing_separate
2388-
&& f->pic
2389-
&& f->pic->category == CB_CATEGORY_NUMERIC
2390-
&& !f->flag_sign_leading) {
2391-
f->flag_sign_separate = 1;
2392-
}
2393-
break;
2394-
case CB_USAGE_SIGNED_CHAR:
2395-
f->usage = CB_USAGE_COMP_5;
2396-
f->pic = cb_build_binary_picture ("BINARY-CHAR", 2, 1);
2397-
f->flag_real_binary = 1;
2398-
validate_field_clauses (x, f);
2399-
break;
2400-
case CB_USAGE_SIGNED_SHORT:
2401-
f->usage = CB_USAGE_COMP_5;
2402-
f->pic = cb_build_binary_picture ("BINARY-SHORT", 4, 1);
2403-
f->flag_real_binary = 1;
2404-
validate_field_clauses (x, f);
2405-
break;
2406-
case CB_USAGE_SIGNED_INT:
2407-
f->usage = CB_USAGE_COMP_5;
2408-
f->pic = cb_build_binary_picture ("BINARY-LONG", 9, 1);
2409-
f->flag_real_binary = 1;
2410-
validate_field_clauses (x, f);
2411-
break;
2412-
case CB_USAGE_SIGNED_LONG:
2413-
f->usage = CB_USAGE_COMP_5;
2414-
f->pic = cb_build_binary_picture ("BINARY-DOUBLE", 18, 1);
2415-
f->flag_real_binary = 1;
2416-
validate_field_clauses (x, f);
2417-
break;
2418-
case CB_USAGE_UNSIGNED_CHAR:
2419-
f->usage = CB_USAGE_COMP_5;
2420-
f->pic = cb_build_binary_picture ("BINARY-CHAR", 2, 0);
2421-
f->flag_real_binary = 1;
2422-
validate_field_clauses (x, f);
2423-
break;
2424-
case CB_USAGE_UNSIGNED_SHORT:
2425-
f->usage = CB_USAGE_COMP_5;
2426-
f->pic = cb_build_binary_picture ("BINARY-SHORT", 4, 0);
2427-
f->flag_real_binary = 1;
2428-
validate_field_clauses (x, f);
2429-
break;
2430-
case CB_USAGE_UNSIGNED_INT:
2431-
f->usage = CB_USAGE_COMP_5;
2432-
f->pic = cb_build_binary_picture ("BINARY-LONG", 9, 0);
2433-
f->flag_real_binary = 1;
2434-
validate_field_clauses (x, f);
2435-
break;
2436-
case CB_USAGE_UNSIGNED_LONG:
2437-
f->usage = CB_USAGE_COMP_5;
2438-
f->pic = cb_build_binary_picture ("BINARY-DOUBLE", 18, 0);
2439-
f->flag_real_binary = 1;
2440-
validate_field_clauses (x, f);
2441-
break;
2442-
case CB_USAGE_BINARY:
2443-
case CB_USAGE_PACKED:
2444-
case CB_USAGE_BIT:
2445-
if (f->pic->category != CB_CATEGORY_NUMERIC) {
2446-
cb_error_x (x, _("'%s' PICTURE clause not compatible with USAGE"), cb_name (x));
2447-
}
24482389
pstr->symbol = '9';
24492390
pstr->times_repeated = (int)f->pic->digits - f->pic->scale;
24502391
++pstr;
@@ -2457,7 +2398,22 @@ validate_elementary_item (struct cb_field *f)
24572398
++pstr;
24582399

24592400
f->pic->size++;
2460-
break;
2401+
} else {
2402+
/* Size for genned string */
2403+
if (f->pic->have_sign) {
2404+
n = 2;
2405+
} else {
2406+
n = 1;
2407+
}
2408+
f->pic->str = cobc_parse_malloc ((size_t)n * sizeof(cob_pic_symbol));
2409+
pstr = f->pic->str;
2410+
if (f->pic->have_sign) {
2411+
pstr->symbol = '+';
2412+
pstr->times_repeated = 1;
2413+
++pstr;
2414+
}
2415+
pstr->symbol = '9';
2416+
pstr->times_repeated = f->pic->digits;
24612417
}
24622418
f->pic->lenstr = n;
24632419
f->pic->category = CB_CATEGORY_NUMERIC_EDITED;

0 commit comments

Comments
 (0)