diff --git a/NEWS b/NEWS index 4be136e3..df2e1070 100644 --- a/NEWS +++ b/NEWS @@ -6,13 +6,9 @@ NEWS - user visible changes -*- outline -*- * New GnuCOBOL features -** the leading space for all internal directives is removed in the lexer. - Source previously processed may need to be ajusted to be processed by - GnuCOBOL 3.3. - -** cobc now checks for binary files and early exit parsing those; - the error output for format errors (for example invalid indicator column) - is now limitted to 5 per source file +** cobc now checks for binary and multi-byte encoded files and early exit + parsing those; the error output for format errors (for example invalid + indicator column) is now limitted to 5 per source file ** support the COLLATING SEQUENCE clause on indexed files (currently only with the BDB backend) diff --git a/cobc/ChangeLog b/cobc/ChangeLog index de631ec5..d0399c9c 100644 --- a/cobc/ChangeLog +++ b/cobc/ChangeLog @@ -149,9 +149,12 @@ 2024-04-25 Boris Eng - * pplex.l, ppparse.y, scanner.l, cobc.h, codegen.c: - new >>IMP INCLUDE directive to include one or multiple header files in - the generated C code (same behavior as the --include compiler option) + FR #176: "Implementation of GC directive to include .h (c/c++) files" + * pplex.l, ppparse.y, cobc.h, codegen.c: new >>IMP INCLUDE directive to + include one or multiple header files in the generated C code (same behavior + as the --include but with one directive per file) + * scanner.l: the leading space for all internal directives is removed in the + lexer. Source previously preprocessed may need to be adjusted 2024-04-24 Fabrice Le Fessant diff --git a/cobc/cobc.h b/cobc/cobc.h index c9c5559b..838dfaed 100644 --- a/cobc/cobc.h +++ b/cobc/cobc.h @@ -481,7 +481,6 @@ extern struct cb_text_list *cb_copy_list; extern struct cb_text_list *cb_include_file_list; /* global */ extern struct cb_text_list *cb_include_file_list_directive; /* temporary */ extern struct cb_text_list *cb_include_list; -extern struct cb_text_list *cb_include_file_list_directive; extern struct cb_text_list *cb_intrinsic_list; extern struct cb_text_list *cb_extension_list; extern struct cb_text_list *cb_static_call_list; diff --git a/cobc/codegen.c b/cobc/codegen.c index 7e5625a1..ad47f1b0 100644 --- a/cobc/codegen.c +++ b/cobc/codegen.c @@ -1832,24 +1832,24 @@ output_gnucobol_defines (const char *formatted_date) current_compile_tm.tm_sec; output_line ("#define COB_MODULE_TIME\t\t%d", i); - { - struct cb_text_list *l; - for (l = cb_include_file_list; l; l = l->next) { - if (l->text[0] == '<') { - output_line ("#include %s", l->text); - } else { - output_line ("#include \"%s\"", l->text); - } + struct cb_text_list *l; + for (l = cb_include_file_list; l; l = l->next) { + if (l->text[0] == '<') { + output_line ("#include %s", l->text); + } else { + output_line ("#include \"%s\"", l->text); } + } - for (l = cb_include_file_list_directive; l; l = l->next) { - if (l->text[0] == '<') { - output_line ("#include %s", l->text); - } else { - output_line ("#include \"%s\"", l->text); - } + for (l = cb_include_file_list_directive; l; l = l->next) { + if (l->text[0] == '<') { + output_line ("#include %s", l->text); + } else { + output_line ("#include \"%s\"", l->text); } } + + cb_include_file_list_directive = NULL; } /* CALL cache */ diff --git a/tests/testsuite.src/syn_misc.at b/tests/testsuite.src/syn_misc.at index 466a241d..14481c89 100644 --- a/tests/testsuite.src/syn_misc.at +++ b/tests/testsuite.src/syn_misc.at @@ -8464,10 +8464,22 @@ AT_DATA([prog.cob], [ GOBACK. ]) +AT_DATA([prog2.cob], [ + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + PROCEDURE DIVISION. + GOBACK. +]) + AT_CHECK([$COMPILE --save-temps -E -o prog.i prog.cob], [0], [], []) +AT_CHECK([$COMPILE -C prog.cob prog2.cob], [0], [], []) AT_CHECK([$GREP "#INCLUDE file1.h" prog.i], [0], ignore, []) AT_CHECK([$GREP "#INCLUDE file2.h" prog.i], [0], ignore, []) AT_CHECK([$GREP "#INCLUDE " prog.i], [0], ignore, []) AT_CHECK([$GREP "#INCLUDE " prog.i], [0], ignore, []) +AT_CHECK([$GREP "#INCLUDE file1.h" prog.c], [1], ignore, []) +AT_CHECK([$GREP "#INCLUDE file2.h" prog.c], [1], ignore, []) +AT_CHECK([$GREP "#INCLUDE " prog.c], [1], ignore, []) +AT_CHECK([$GREP "#INCLUDE " prog.c], [1], ignore, []) AT_CLEANUP