diff options
Diffstat (limited to 'gcc/cobol')
-rw-r--r-- | gcc/cobol/ChangeLog | 61 | ||||
-rw-r--r-- | gcc/cobol/cdf-copy.cc | 4 | ||||
-rw-r--r-- | gcc/cobol/cdf.y | 3 | ||||
-rw-r--r-- | gcc/cobol/cdfval.h | 2 | ||||
-rw-r--r-- | gcc/cobol/cobol1.cc | 1 | ||||
-rw-r--r-- | gcc/cobol/except.cc | 1 | ||||
-rw-r--r-- | gcc/cobol/gcobolspec.cc | 24 | ||||
-rw-r--r-- | gcc/cobol/genapi.cc | 2 | ||||
-rw-r--r-- | gcc/cobol/gengen.cc | 1 | ||||
-rw-r--r-- | gcc/cobol/genmath.cc | 1 | ||||
-rw-r--r-- | gcc/cobol/genutil.cc | 1 | ||||
-rw-r--r-- | gcc/cobol/parse.y | 24 | ||||
-rw-r--r-- | gcc/cobol/scan.l | 13 | ||||
-rw-r--r-- | gcc/cobol/structs.cc | 1 | ||||
-rw-r--r-- | gcc/cobol/symbols.cc | 177 | ||||
-rw-r--r-- | gcc/cobol/symbols.h | 5 | ||||
-rw-r--r-- | gcc/cobol/symfind.cc | 3 | ||||
-rw-r--r-- | gcc/cobol/token_names.h | 8 | ||||
-rw-r--r-- | gcc/cobol/util.cc | 5 |
19 files changed, 200 insertions, 137 deletions
diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog index be421d2..4d2c7de 100644 --- a/gcc/cobol/ChangeLog +++ b/gcc/cobol/ChangeLog @@ -1,3 +1,64 @@ +2025-03-24 Iain Sandoe <iain@sandoe.co.uk> + + * cdf-copy.cc: Move host include before system.h + +2025-03-24 Andreas Schwab <schwab@suse.de> + + PR cobol/119390 + * gcobolspec.cc (lang_specific_driver): Use pointer instead of + copying into fixed array. + +2025-03-21 Iain Sandoe <iain@sandoe.co.uk> + + * gcobolspec.cc (lang_specific_driver): Add libstdc++ + for any link line. + +2025-03-21 Iain Sandoe <iain@sandoe.co.uk> + + * gcobolspec.cc (add_arg_lib): Fix typo. + (lang_specific_driver): Arrange to append both -lgcobol + and -static-libgcobol for targets without + HAVE_LD_STATIC_DYNAMIC. + +2025-03-21 Jakub Jelinek <jakub@redhat.com> + + * parse.y: Rename COB_BLOCK to BLOCK_kw, COB_SIGNED to SIGNED_kw and + COB_UNSIGNED to UNSIGNED_kw. + * scan.l: Likewise. + * token_names.h: Regenerate. + +2025-03-21 Richard Biener <rguenther@suse.de> + + * symbols.cc (empty_float, empty_comp5, empty_literal, + empty_conditional, debug_registers, special_registers): Move + global cbl_field_t typed data to ... + (symbol_table_init): ... local scope here. + +2025-03-21 Richard Biener <rguenther@suse.de> + + PR cobol/119241 + * symbols.h: Do not typedef tree. + * cdf.y: Include coretypes.h and tree.h. + * symbols.cc: Likewise. + * symfind.cc: Likewise. + * util.cc: Likewise. + * parse.y: Include coretypes.h and tree.h where appropriate. + Rename BLOCK to COB_BLOCK, SIGNED to COB_SIGNED, UNSIGNED + to COB_UNSIGNED. + * scan.l: Likewise. + * token_names.h: Likewise. + * cobol1.cc: Do not define HOWEVER_GCC_DEFINES_TREE. + * except.cc: Likewise. + * genapi.cc: Likewise. + * gengen.cc: Likewise. + * genmath.cc: Likewise. + * genutil.cc: Likewise. + * structs.cc: Likewise. + +2025-03-20 Iain Sandoe <iain@sandoe.co.uk> + + * cdfval.h (struct cdfval_t): Overload long instead of int64_t. + 2025-03-18 Iain Sandoe <iain@sandoe.co.uk> * gcobolspec.cc (append_rpath): Remove. diff --git a/gcc/cobol/cdf-copy.cc b/gcc/cobol/cdf-copy.cc index 179dbac..c620c82 100644 --- a/gcc/cobol/cdf-copy.cc +++ b/gcc/cobol/cdf-copy.cc @@ -34,13 +34,13 @@ // // We regret any confusion engendered. +#include <glob.h> + #include "cobol-system.h" #include "cbldiag.h" #include "util.h" #include "copybook.h" -#include <glob.h> - #define COUNT_OF(X) (sizeof(X) / sizeof(X[0])) /* diff --git a/gcc/cobol/cdf.y b/gcc/cobol/cdf.y index 12d11e7..c44ee5e 100644 --- a/gcc/cobol/cdf.y +++ b/gcc/cobol/cdf.y @@ -30,6 +30,9 @@ %{ #include "cobol-system.h" +#include "coretypes.h" +#include "tree.h" +#undef yy_flex_debug #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" #include "util.h" diff --git a/gcc/cobol/cdfval.h b/gcc/cobol/cdfval.h index 1453f2a..4682db8 100644 --- a/gcc/cobol/cdfval.h +++ b/gcc/cobol/cdfval.h @@ -79,7 +79,7 @@ struct cdfval_t : public cdfval_base_t { cdfval_base_t::string = NULL; cdfval_base_t::number = value; } - cdfval_t( int64_t value ) + cdfval_t( long value ) : lineno(yylineno), filename(cobol_filename()) { cdfval_base_t::off = false; diff --git a/gcc/cobol/cobol1.cc b/gcc/cobol/cobol1.cc index 08af367..0d07c46 100644 --- a/gcc/cobol/cobol1.cc +++ b/gcc/cobol/cobol1.cc @@ -29,7 +29,6 @@ along with GCC; see the file COPYING3. If not see #include "langhooks-def.h" #include "target.h" #include "stringpool.h" -#define HOWEVER_GCC_DEFINES_TREE 1 #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" #include "util.h" diff --git a/gcc/cobol/except.cc b/gcc/cobol/except.cc index 5374201..ba49f78 100644 --- a/gcc/cobol/except.cc +++ b/gcc/cobol/except.cc @@ -32,7 +32,6 @@ #include "cobol-system.h" #include "coretypes.h" #include "tree.h" -#define HOWEVER_GCC_DEFINES_TREE 1 #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" #include "util.h" diff --git a/gcc/cobol/gcobolspec.cc b/gcc/cobol/gcobolspec.cc index 4ae8e2c..c84f405 100644 --- a/gcc/cobol/gcobolspec.cc +++ b/gcc/cobol/gcobolspec.cc @@ -116,8 +116,8 @@ add_arg_lib(const char *library, bool force_static ATTRIBUTE_UNUSED) { append_option (OPT_Wl_, LD_STATIC_OPTION, 1); } - append_option (OPT_l, library, 1); #endif + append_option (OPT_l, library, 1); #ifdef HAVE_LD_STATIC_DYNAMIC if( force_static ) { @@ -339,10 +339,8 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, break; case OPT_static_libgcobol: -#ifdef HAVE_LD_STATIC_DYNAMIC static_libgcobol = true; need_libgcobol = true; -#endif break; case OPT_l: @@ -500,15 +498,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, if( prior_main ) { - char ach[128]; - if( entry_point ) - { - strcpy(ach, entry_point); - } + const char *ach; + if (entry_point) + ach = entry_point; else - { - strcpy(ach, decoded_options[i].arg); - } + ach = decoded_options[i].arg; append_option(OPT_main_, ach, 1); prior_main = false; entry_point = NULL; @@ -548,7 +542,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, break; case OPT_static_libgcobol: - // Don't pass this one on to cobol1 +#if !defined (HAVE_LD_STATIC_DYNAMIC) + // Allow the target to use spec substitution. + append_arg(decoded_options[i]); +#endif + // Else don't pass this one on to cobol1 break; ////#ifdef __x86_64__ @@ -598,7 +596,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, { add_arg_lib(DL_LIBRARY, static_in_general); } - if( need_libstdc && static_in_general ) + if( need_libstdc ) { add_arg_lib(STDCPP_LIBRARY, static_in_general); } diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc index a4abbd1..8f4f9b2 100644 --- a/gcc/cobol/genapi.cc +++ b/gcc/cobol/genapi.cc @@ -35,8 +35,6 @@ #include "stringpool.h" #include "diagnostic-core.h" -#define HOWEVER_GCC_DEFINES_TREE 1 - #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" #include "util.h" diff --git a/gcc/cobol/gengen.cc b/gcc/cobol/gengen.cc index 2796b7f..ffb64c8 100644 --- a/gcc/cobol/gengen.cc +++ b/gcc/cobol/gengen.cc @@ -95,7 +95,6 @@ #include "toplev.h" #include "function.h" #include "fold-const.h" -#define HOWEVER_GCC_DEFINES_TREE 1 #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" #include "util.h" diff --git a/gcc/cobol/genmath.cc b/gcc/cobol/genmath.cc index 42f01cd..56254e8 100644 --- a/gcc/cobol/genmath.cc +++ b/gcc/cobol/genmath.cc @@ -30,7 +30,6 @@ #include "cobol-system.h" #include "coretypes.h" #include "tree.h" -#define HOWEVER_GCC_DEFINES_TREE 1 #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" #include "util.h" diff --git a/gcc/cobol/genutil.cc b/gcc/cobol/genutil.cc index c0e6631..f8bf7bc 100644 --- a/gcc/cobol/genutil.cc +++ b/gcc/cobol/genutil.cc @@ -30,7 +30,6 @@ #include "cobol-system.h" #include "coretypes.h" #include "tree.h" -#define HOWEVER_GCC_DEFINES_TREE 1 #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" #include "util.h" diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y index c45dc33..c436469 100644 --- a/gcc/cobol/parse.y +++ b/gcc/cobol/parse.y @@ -30,6 +30,7 @@ %code requires { #include <fstream> // Before cobol-system because it uses poisoned functions #include "cobol-system.h" + #include "coretypes.h" #include "../../libgcobol/io.h" #include "../../libgcobol/ec.h" @@ -279,6 +280,11 @@ %{ #include <fstream> // Before cobol-system because it uses poisoned functions #include "cobol-system.h" +#include "coretypes.h" +#include "tree.h" +#undef cobol_dialect +#undef cobol_exceptions +#undef yy_flex_debug #include "cdfval.h" #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" @@ -402,7 +408,7 @@ BASED BASECONVERT BEFORE BINARY BIT BIT_OF "BIT-OF" BIT_TO_CHAR "BIT-TO-CHAR" - BLANK BLOCK + BLANK BLOCK_kw BOOLEAN_OF_INTEGER "BOOLEAN-OF-INTEGER" BOTTOM BY BYTE BYTE_LENGTH "BYTE-LENGTH" @@ -607,7 +613,7 @@ NONE NORMAL NUMBERS PREFIXED PREVIOUS PROHIBITED RELATION REQUIRED REVERSE_VIDEO ROUNDING - SECONDS SECURE SHORT SIGNED + SECONDS SECURE SHORT SIGNED_kw STANDARD_BINARY "STANDARD-BINARY" STANDARD_DECIMAL "STANDARD-DECIMAL" STATEMENT STEP STRUCTURE @@ -615,7 +621,7 @@ TOWARD_LESSER "TOWARD-LESSER" TRUNCATION UCS_4 "UCS-4" - UNDERLINE UNSIGNED + UNDERLINE UNSIGNED_kw UTF_16 "UTF-16" UTF_8 "UTF-8" @@ -1008,7 +1014,7 @@ BACKWARD BASED BASECONVERT BEFORE BINARY BIT BIT_OF BIT_TO_CHAR - BLANK BLOCK + BLANK BLOCK_kw BOOLEAN_OF_INTEGER BOTTOM BY BYTE BYTE_LENGTH @@ -1222,7 +1228,7 @@ NONE NORMAL NUMBERS PREFIXED PREVIOUS PROHIBITED RELATION REQUIRED REVERSE_VIDEO ROUNDING - SECONDS SECURE SHORT SIGNED + SECONDS SECURE SHORT SIGNED_kw STANDARD_BINARY STANDARD_DECIMAL STATEMENT STEP STRUCTURE @@ -1230,7 +1236,7 @@ TOWARD_LESSER TRUNCATION UCS_4 - UNDERLINE UNSIGNED + UNDERLINE UNSIGNED_kw UTF_16 UTF_8 @@ -2901,7 +2907,7 @@ fd_clause: record_desc } ; -block_desc: BLOCK contains rec_contains chars_recs +block_desc: BLOCK_kw contains rec_contains chars_recs ; rec_contains: NUMSTR[min] { ssize_t n; @@ -6522,7 +6528,7 @@ context_word: APPLY { static char s[] ="APPLY"; $$ = s; } // screen description entry | SHORT { static char s[] ="SHORT"; $$ = s; } // DYNAMIC LENGTH STRUCTURE clause - | SIGNED { static char s[] ="SIGNED"; + | SIGNED_kw { static char s[] ="SIGNED"; $$ = s; } // DYNAMIC LENGTH STRUCTURE clause and USAGE clause | STANDARD_BINARY { static char s[] ="STANDARD-BINARY"; $$ = s; } // ARITHMETIC clause @@ -6548,7 +6554,7 @@ context_word: APPLY { static char s[] ="APPLY"; $$ = s; } // ALPHABET clause | UNDERLINE { static char s[] ="UNDERLINE"; $$ = s; } // screen description entry and SET attribute statement - | UNSIGNED { static char s[] ="UNSIGNED"; + | UNSIGNED_kw { static char s[] ="UNSIGNED"; $$ = s; } // USAGE clause | UTF_8 { static char s[] ="UTF-8"; $$ = s; } // ALPHABET clause diff --git a/gcc/cobol/scan.l b/gcc/cobol/scan.l index 18d0d82..2cb7d30 100644 --- a/gcc/cobol/scan.l +++ b/gcc/cobol/scan.l @@ -30,6 +30,9 @@ %{ #include <fstream> // Before cobol-system because it uses poisoned functions #include "cobol-system.h" +#include "coretypes.h" +#include "tree.h" +#undef yy_flex_debug #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" @@ -371,7 +374,7 @@ ROUNDING { return ROUNDING; } SECONDS { return SECONDS; } SECURE { return SECURE; } SHORT { return SHORT; } -SIGNED { return SIGNED; } +SIGNED { return SIGNED_kw; } STANDARD-BINARY { return STANDARD_BINARY; } STANDARD-DECIMAL { return STANDARD_DECIMAL; } STATEMENT { return STATEMENT; } @@ -391,7 +394,7 @@ TOWARD-LESSER { return TOWARD_LESSER; } TRUNCATION { return TRUNCATION; } UCS-4 { return UCS_4; } UNDERLINE { return UNDERLINE; } -UNSIGNED { return UNSIGNED; } +UNSIGNED { return UNSIGNED_kw; } UTF-16 { return UTF_16; } UTF-8 { return UTF_8; } @@ -834,7 +837,7 @@ CALL { return CALL; } BY { return BY; } BOTTOM { return BOTTOM; } BEFORE { return BEFORE; } -BLOCK { return BLOCK; } +BLOCK { return BLOCK_kw; } BACKWARD { return BACKWARD; } AT { return AT; } @@ -1039,7 +1042,7 @@ USE({SPC}FOR)? { return USE; } AS { return AS; } ASCENDING { return ASCENDING; } BLANK { return BLANK; } - BLOCK { return BLOCK; } + BLOCK { return BLOCK_kw; } BY { return BY; } BYTE-LENGTH { return BYTE_LENGTH; } CHARACTER { return CHARACTER; } @@ -2161,7 +2164,7 @@ BASIS { yy_push_state(basis); return BASIS; } BINARY { return BINARY; } BIT { return BIT; } BLANK { return BLANK; } - BLOCK { return BLOCK; } + BLOCK { return BLOCK_kw; } BOTTOM { return BOTTOM; } BY { return BY; } CALL { return CALL; } diff --git a/gcc/cobol/structs.cc b/gcc/cobol/structs.cc index 39c8a42..1d2d984 100644 --- a/gcc/cobol/structs.cc +++ b/gcc/cobol/structs.cc @@ -55,7 +55,6 @@ #include "cobol-system.h" #include "coretypes.h" #include "tree.h" -#define HOWEVER_GCC_DEFINES_TREE 1 #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" #include "util.h" diff --git a/gcc/cobol/symbols.cc b/gcc/cobol/symbols.cc index 38c7a2e..b8d785f 100644 --- a/gcc/cobol/symbols.cc +++ b/gcc/cobol/symbols.cc @@ -30,6 +30,10 @@ #include <fstream> // Before cobol-system because it uses poisoned functions #include "cobol-system.h" + +#include "coretypes.h" +#include "tree.h" + #include <search.h> #include <iconv.h> #include "../../libgcobol/ec.h" @@ -291,81 +295,12 @@ symbol_valid_udf_args( size_t function, std::list<cbl_refer_t> args ) { static const struct cbl_occurs_t nonarray = cbl_occurs_t(); -static const struct cbl_field_t empty_float = { - 0, FldFloat, FldInvalid, - intermediate_e, - 0, 0, 0, nonarray, 0, "", - 0, cbl_field_t::linkage_t(), - {16, 16, 32, 0, NULL}, NULL }; - -static const struct cbl_field_t empty_comp5 = { - 0, FldNumericBin5, FldInvalid, - signable_e | intermediate_e, - 0, 0, 0, nonarray, 0, "", - 0, cbl_field_t::linkage_t(), - {16, 16, MAX_FIXED_POINT_DIGITS, 0, NULL}, NULL }; - #if 0 # define CONSTANT_E constant_e #else # define CONSTANT_E intermediate_e #endif -static struct cbl_field_t empty_literal = { - 0, FldInvalid, FldInvalid, CONSTANT_E, - 0, 0, 0, nonarray, 0, "", - 0, cbl_field_t::linkage_t(), - {}, NULL }; - -static const struct cbl_field_t empty_conditional = { - 0, FldConditional, FldInvalid, intermediate_e, - 0, 0, 0, nonarray, 0, "", - 0, cbl_field_t::linkage_t(), - {}, NULL }; - - -/** - * Debug register record - 01 DEBUG-ITEM. - 02 DEBUG-LINE PIC X(6). - 02 FILLER PIC X VALUE SPACE. - 02 DEBUG-NAME PIC X(30). - 02 FILLER PIC X VALUE SPACE. - 02 DEBUG-SUB-1 PIC S9999 SIGN IS LEADING SEPARATE CHARACTER. - 02 FILLER PIC X VALUE SPACE. - 02 DEBUG-SUB-2 PIC S9999 SIGN IS LEADING SEPARATE CHARACTER. - 02 FILLER PIC X VALUE SPACE. - 02 DEBUG-SUB-3 PIC S9999 SIGN IS LEADING SEPARATE CHARACTER. - 02 FILLER PIC X VALUE SPACE. - 02 DEBUG-CONTENTS PIC X(76). - **/ - -static cbl_field_t debug_registers[] = { - { 0, FldGroup, FldInvalid, global_e, 0,0,1, nonarray, 0, - "DEBUG-ITEM", 0, {}, {132,132,0,0, NULL}, NULL }, - { 0, FldAlphanumeric, FldInvalid, global_e, 0,0,2, nonarray, 0, - "DEBUG-LINE", 0, {}, {6,6,0,0, " "}, NULL }, - { 0, FldAlphanumeric, FldInvalid, 0, 0,0,2, nonarray, 0, - "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, - { 0, FldAlphanumeric, FldInvalid, global_e, 0,0,2, nonarray, 0, - "DEBUG-NAME", 0, {}, {30,30,0,0, NULL}, NULL }, - { 0, FldAlphanumeric, FldInvalid, 0, 0,0,2, nonarray, 0, - "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, - { 0, FldNumericDisplay, FldInvalid, signable_e | global_e | leading_e | separate_e, 0,0,2, nonarray, 0, - "DEBUG-SUB-1", 0, {}, {5,5,3,0, NULL}, NULL }, - { 0, FldAlphanumeric, FldInvalid, 0, 0,0,2, nonarray, 0, - "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, - { 0, FldNumericDisplay, FldInvalid, signable_e | global_e | leading_e | separate_e, 0,0,2, nonarray, 0, - "DEBUG-SUB-2", 0, {}, {5,5,3,0, NULL}, NULL }, - { 0, FldAlphanumeric, FldInvalid, 0, 0,0,2, nonarray, 0, - "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, - { 0, FldNumericDisplay, FldInvalid, signable_e | global_e | leading_e | separate_e, 0,0,2, nonarray, 0, - "DEBUG-SUB-3", 0, {}, {5,5,3,0, NULL}, NULL }, - { 0, FldAlphanumeric, FldInvalid, 0, 0,0,2, nonarray, 0, - "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, - { 0, FldAlphanumeric, FldInvalid, signable_e | global_e, 0,0,2, nonarray, 0, - "DEBUG-CONTENTS", 0, {}, {76,76,0,0, NULL}, NULL }, -}; class group_size_t { size_t size; @@ -380,26 +315,6 @@ class group_size_t { enum { constq = constant_e | quoted_e }; -static cbl_field_t special_registers[] = { - { 0, FldNumericDisplay, FldInvalid, 0, 0, 0, 0, nonarray, 0, "_FILE_STATUS", - 0, {}, {2,2,2,0, NULL}, NULL }, - { 0, FldNumericBin5, FldInvalid, 0, 0, 0, 0, nonarray, 0, "UPSI-0", - 0, {}, {2,2,4,0, NULL}, NULL }, - { 0, FldNumericBin5, FldInvalid, 0, 0, 0, 0, nonarray, 0, "RETURN-CODE", - 0, {}, {2,2,4,0, NULL}, NULL }, - { 0, FldNumericBin5, FldInvalid, 0, 0, 0, 0, nonarray, 0, "LINAGE-COUNTER", - 0, {}, {2,2,4,0, NULL}, NULL }, - { 0, FldLiteralA, FldInvalid, 0, 0, 0, 0, nonarray, 0, "_dev_stdin", - 0, {}, {0,0,0,0, "/dev/stdin"}, NULL }, - { 0, FldLiteralA, FldInvalid, constq, 0, 0, 0, nonarray, 0, "_dev_stdout", - 0, {}, {0,0,0,0, "/dev/stdout"}, NULL }, - { 0, FldLiteralA, FldInvalid, constq, 0, 0, 0, nonarray, 0, "_dev_stderr", - 0, {}, {0,0,0,0, "/dev/stderr"}, NULL }, - { 0, FldLiteralA, FldInvalid, constq, 0, 0, 0, nonarray, 0, "_dev_null", - 0, {}, {0,0,0,0, "/dev/null"}, NULL }, - -}; - static symbol_elem_t elementize( cbl_field_t& field ) { symbol_elem_t sym (SymField); @@ -2371,6 +2286,49 @@ symbol_table_init(void) { assert(table.nelem < table.capacity); + /** + * Debug register record + 01 DEBUG-ITEM. + 02 DEBUG-LINE PIC X(6). + 02 FILLER PIC X VALUE SPACE. + 02 DEBUG-NAME PIC X(30). + 02 FILLER PIC X VALUE SPACE. + 02 DEBUG-SUB-1 PIC S9999 SIGN IS LEADING SEPARATE CHARACTER. + 02 FILLER PIC X VALUE SPACE. + 02 DEBUG-SUB-2 PIC S9999 SIGN IS LEADING SEPARATE CHARACTER. + 02 FILLER PIC X VALUE SPACE. + 02 DEBUG-SUB-3 PIC S9999 SIGN IS LEADING SEPARATE CHARACTER. + 02 FILLER PIC X VALUE SPACE. + 02 DEBUG-CONTENTS PIC X(76). + **/ + + static cbl_field_t debug_registers[] = { + { 0, FldGroup, FldInvalid, global_e, 0,0,1, nonarray, 0, + "DEBUG-ITEM", 0, {}, {132,132,0,0, NULL}, NULL }, + { 0, FldAlphanumeric, FldInvalid, global_e, 0,0,2, nonarray, 0, + "DEBUG-LINE", 0, {}, {6,6,0,0, " "}, NULL }, + { 0, FldAlphanumeric, FldInvalid, 0, 0,0,2, nonarray, 0, + "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, + { 0, FldAlphanumeric, FldInvalid, global_e, 0,0,2, nonarray, 0, + "DEBUG-NAME", 0, {}, {30,30,0,0, NULL}, NULL }, + { 0, FldAlphanumeric, FldInvalid, 0, 0,0,2, nonarray, 0, + "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, + { 0, FldNumericDisplay, FldInvalid, signable_e | global_e | leading_e | separate_e, 0,0,2, nonarray, 0, + "DEBUG-SUB-1", 0, {}, {5,5,3,0, NULL}, NULL }, + { 0, FldAlphanumeric, FldInvalid, 0, 0,0,2, nonarray, 0, + "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, + { 0, FldNumericDisplay, FldInvalid, signable_e | global_e | leading_e | separate_e, 0,0,2, nonarray, 0, + "DEBUG-SUB-2", 0, {}, {5,5,3,0, NULL}, NULL }, + { 0, FldAlphanumeric, FldInvalid, 0, 0,0,2, nonarray, 0, + "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, + { 0, FldNumericDisplay, FldInvalid, signable_e | global_e | leading_e | separate_e, 0,0,2, nonarray, 0, + "DEBUG-SUB-3", 0, {}, {5,5,3,0, NULL}, NULL }, + { 0, FldAlphanumeric, FldInvalid, 0, 0,0,2, nonarray, 0, + "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, + { 0, FldAlphanumeric, FldInvalid, signable_e | global_e, 0,0,2, nonarray, 0, + "DEBUG-CONTENTS", 0, {}, {76,76,0,0, NULL}, NULL }, +}; + // debug registers assert(table.nelem + COUNT_OF(debug_registers) < table.capacity); @@ -2387,6 +2345,25 @@ symbol_table_init(void) { assert(table.nelem < table.capacity); std::for_each(debug_start+1, p, parent_elem_set(debug_start - table.elems)); + static cbl_field_t special_registers[] = { + { 0, FldNumericDisplay, FldInvalid, 0, 0, 0, 0, nonarray, 0, "_FILE_STATUS", + 0, {}, {2,2,2,0, NULL}, NULL }, + { 0, FldNumericBin5, FldInvalid, 0, 0, 0, 0, nonarray, 0, "UPSI-0", + 0, {}, {2,2,4,0, NULL}, NULL }, + { 0, FldNumericBin5, FldInvalid, 0, 0, 0, 0, nonarray, 0, "RETURN-CODE", + 0, {}, {2,2,4,0, NULL}, NULL }, + { 0, FldNumericBin5, FldInvalid, 0, 0, 0, 0, nonarray, 0, "LINAGE-COUNTER", + 0, {}, {2,2,4,0, NULL}, NULL }, + { 0, FldLiteralA, FldInvalid, 0, 0, 0, 0, nonarray, 0, "_dev_stdin", + 0, {}, {0,0,0,0, "/dev/stdin"}, NULL }, + { 0, FldLiteralA, FldInvalid, constq, 0, 0, 0, nonarray, 0, "_dev_stdout", + 0, {}, {0,0,0,0, "/dev/stdout"}, NULL }, + { 0, FldLiteralA, FldInvalid, constq, 0, 0, 0, nonarray, 0, "_dev_stderr", + 0, {}, {0,0,0,0, "/dev/stderr"}, NULL }, + { 0, FldLiteralA, FldInvalid, constq, 0, 0, 0, nonarray, 0, "_dev_null", + 0, {}, {0,0,0,0, "/dev/null"}, NULL }, + }; + // special registers assert(table.nelem + COUNT_OF(special_registers) < table.capacity); @@ -3261,6 +3238,28 @@ new_temporary_impl( enum cbl_field_type_t type ) intermediate_e, 0, 0, 0, nonarray, 0, "", 0, cbl_field_t::linkage_t(), {}, NULL }; + static const struct cbl_field_t empty_float = { + 0, FldFloat, FldInvalid, + intermediate_e, + 0, 0, 0, nonarray, 0, "", + 0, cbl_field_t::linkage_t(), + {16, 16, 32, 0, NULL}, NULL }; + static const struct cbl_field_t empty_comp5 = { + 0, FldNumericBin5, FldInvalid, + signable_e | intermediate_e, + 0, 0, 0, nonarray, 0, "", + 0, cbl_field_t::linkage_t(), + {16, 16, MAX_FIXED_POINT_DIGITS, 0, NULL}, NULL }; + static const struct cbl_field_t empty_conditional = { + 0, FldConditional, FldInvalid, intermediate_e, + 0, 0, 0, nonarray, 0, "", + 0, cbl_field_t::linkage_t(), + {}, NULL }; + static struct cbl_field_t empty_literal = { + 0, FldInvalid, FldInvalid, CONSTANT_E, + 0, 0, 0, nonarray, 0, "", + 0, cbl_field_t::linkage_t(), + {}, NULL }; struct cbl_field_t *f = new cbl_field_t; f->type = type; diff --git a/gcc/cobol/symbols.h b/gcc/cobol/symbols.h index c189412..fb7b60d 100644 --- a/gcc/cobol/symbols.h +++ b/gcc/cobol/symbols.h @@ -48,11 +48,6 @@ #define PICTURE_MAX 64 -// Define a tree type as void pointer outside the generator code. -#ifndef HOWEVER_GCC_DEFINES_TREE -typedef void *tree; -#endif - #if ! (__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)) static_assert( sizeof(output) == sizeof(long double), "long doubles?" ); diff --git a/gcc/cobol/symfind.cc b/gcc/cobol/symfind.cc index 38a8900..2687fdb 100644 --- a/gcc/cobol/symfind.cc +++ b/gcc/cobol/symfind.cc @@ -31,6 +31,9 @@ #include "cobol-system.h" +#include "coretypes.h" +#include "tree.h" + #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" #include "util.h" diff --git a/gcc/cobol/token_names.h b/gcc/cobol/token_names.h index 26dabc8..a082078 100644 --- a/gcc/cobol/token_names.h +++ b/gcc/cobol/token_names.h @@ -1,5 +1,5 @@ // generated by ./token_names.h.gen ../../build/gcc/cobol/parse.h -// Fri Jan 31 05:52:10 EST 2025 +// Fri Mar 21 10:13:54 CET 2025 tokens = { { "identification", IDENTIFICATION_DIV }, // 258 { "environment", ENVIRONMENT_DIV }, // 259 @@ -219,7 +219,7 @@ tokens = { { "bit-of", BIT_OF }, // 470 { "bit-to-char", BIT_TO_CHAR }, // 471 { "blank", BLANK }, // 472 - { "block", BLOCK }, // 473 + { "block", BLOCK_kw }, // 473 { "boolean-of-integer", BOOLEAN_OF_INTEGER }, // 474 { "bottom", BOTTOM }, // 475 { "by", BY }, // 476 @@ -642,7 +642,7 @@ tokens = { { "seconds", SECONDS }, // 891 { "secure", SECURE }, // 892 { "short", SHORT }, // 893 - { "signed", SIGNED }, // 894 + { "signed", SIGNED_kw }, // 894 { "standard-binary", STANDARD_BINARY }, // 895 { "standard-decimal", STANDARD_DECIMAL }, // 896 { "statement", STATEMENT }, // 897 @@ -653,7 +653,7 @@ tokens = { { "truncation", TRUNCATION }, // 902 { "ucs-4", UCS_4 }, // 903 { "underline", UNDERLINE }, // 904 - { "unsigned", UNSIGNED }, // 905 + { "unsigned", UNSIGNED_kw }, // 905 { "utf-16", UTF_16 }, // 906 { "utf-8", UTF_8 }, // 907 { "address", ADDRESS }, // 908 diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc index 101a0a0..1c0810b 100644 --- a/gcc/cobol/util.cc +++ b/gcc/cobol/util.cc @@ -35,6 +35,10 @@ */ #include "cobol-system.h" +#include "coretypes.h" +#include "tree.h" +#undef yy_flex_debug + #include <langinfo.h> #include "coretypes.h" @@ -55,7 +59,6 @@ #include "cbldiag.h" #include "lexio.h" -#define HOWEVER_GCC_DEFINES_TREE #include "../../libgcobol/ec.h" #include "../../libgcobol/common-defs.h" #include "symbols.h" |