diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in index 57ef7a460db2ae937f61891a614c3aab5317b139..c2c49e5f50112903908f7b3cf0c5d3cb661727f6 100644 --- a/gcc/cobol/Make-lang.in +++ b/gcc/cobol/Make-lang.in @@ -46,6 +46,7 @@ cobol: cobol1$(exeext) .PHONY: cobol BINCLUDE ?= ./gcc +LIB_INCLUDE ?= $(srcdir)/../libgcobol # # At this point, as of 2022-10-21, CPPFLAGS is an empty string and can be @@ -58,6 +59,7 @@ CPPFLAGS = \ $(MAX_ERRORS) \ -Iinclude \ -I$(BINCLUDE) \ + -I$(LIB_INCLUDE) \ -Wno-cpp \ -Wno-missing-field-initializers \ -DEXEC_LIB=\"$(DESTDIR)$(libdir)\" diff --git a/gcc/cobol/except.cc b/gcc/cobol/except.cc index c7f437198f987e2ef3d5499200b16be7d81cc8d4..ea281a1f0510a400dac7b521bfa79f046eb10e7f 100644 --- a/gcc/cobol/except.cc +++ b/gcc/cobol/except.cc @@ -43,7 +43,7 @@ #include "gengen.h" #include "ec.h" -#include "except.h" +#include "exceptc.h" static const ec_descr_t * ec_type_descr( ec_type_t type ) { diff --git a/gcc/cobol/parse_ante.h b/gcc/cobol/parse_ante.h index e37156c351075dba1ba7498a300e5ece027c2be0..65552d6e33515a7d20081d4c109fc0feb44dadb5 100644 --- a/gcc/cobol/parse_ante.h +++ b/gcc/cobol/parse_ante.h @@ -51,12 +51,12 @@ #define MAXLENGTH_FORMATTED_DATETIME 30 - - - - - - +// This definition is for a function in except.cc. When I dissected lihgcobol +// from gcc/cobol, I had to rename except.h to exceptc.h, because it was +// conflicting with a poisoned GCC_EXCEPT_H. And then I didn't know where to +// put this declaration. So, I shoved it here. RJD. +extern void declarative_runtime_match(cbl_field_t *declaratives, + cbl_label_t *lave ); extern int yylineno, yyleng, yychar; extern char *yytext; diff --git a/gcc/cobol/scan.l b/gcc/cobol/scan.l index 7ee809bc5d4593c271fccfe4266cbbba7d99b520..4b65b63ea9bbf88b3a8c7812512b5a28660f9423 100644 --- a/gcc/cobol/scan.l +++ b/gcc/cobol/scan.l @@ -29,6 +29,7 @@ */ %{ +#include "symbols.h" #include "scan_ante.h" #include "ec.h" #include "lexio.h" diff --git a/gcc/cobol/symbols.h b/gcc/cobol/symbols.h index 13d1125c91dff967d2f8e6d6f2e53c8adbca16e5..a8bca49204b2fcd2420fa096a2891248a6e9e26a 100644 --- a/gcc/cobol/symbols.h +++ b/gcc/cobol/symbols.h @@ -46,6 +46,8 @@ #include <variant> #include <vector> +#include "common-defs.h" + #define PICTURE_MAX 64 // Define a tree type as void pointer outside the generator code. @@ -516,6 +518,22 @@ struct cbl_field_t { } }; +// Necessary forward referencea +struct cbl_label_t; +struct cbl_refer_t; + +struct cbl_span_t { + cbl_refer_t *from, *len; + + cbl_span_t( cbl_refer_t *from, cbl_refer_t *len = NULL ) + : from(from), len(len) {}; + bool is_active() const { return !( from == NULL && len == NULL ); } + + cbl_field_t *from_field(); + cbl_field_t *len_field(); +}; + + struct cbl_refer_t { cbl_field_t *field; cbl_label_t *prog_func; @@ -719,17 +737,6 @@ struct cbl_label_addresses_t { struct cbl_refer_t; -struct cbl_span_t { - cbl_refer_t *from, *len; - - cbl_span_t( cbl_refer_t *from, cbl_refer_t *len = NULL ) - : from(from), len(len) {}; - bool is_active() const { return !( from == NULL && len == NULL ); } - - cbl_field_t *from_field(); - cbl_field_t *len_field(); -}; - static inline const char * logop_str( enum logop_t logop ) { switch ( logop ) { diff --git a/libgcobol/common-defs.h b/libgcobol/common-defs.h index 87683fb9f1335180abb9966bbb203d7ea45ff0aa..5a1740d3ff3b810f7b5f469f8a32e66b6fa81986 100644 --- a/libgcobol/common-defs.h +++ b/libgcobol/common-defs.h @@ -35,8 +35,6 @@ #include "ec.h" - - #define COUNT_OF(X) (sizeof(X) / sizeof(X[0])) // This constant establishes the maximum number of digits in a fixed point diff --git a/libgcobol/ec.h b/libgcobol/ec.h index 4116b884e6300702b6c46541f06d9f4b017ba633..999ed3fe8d5449c13e2c26d73fa39bf9edaec3b0 100644 --- a/libgcobol/ec.h +++ b/libgcobol/ec.h @@ -32,8 +32,6 @@ #ifndef _CBL_EC_H_ #define _CBL_EC_H_ -#include "common-defs.h" - #include <set> #include <assert.h> diff --git a/libgcobol/except.h b/libgcobol/exceptc.h similarity index 99% rename from libgcobol/except.h rename to libgcobol/exceptc.h index 156872a39319c88784e68601dc29f507bb83c2a7..236edaeef2ab96387551c79837a5446f69efa3ec 100644 --- a/libgcobol/except.h +++ b/libgcobol/exceptc.h @@ -404,7 +404,7 @@ ec_descr_t exception_table[] = { static const auto exception_table_end = exception_table + COUNT_OF(exception_table); /* Inventory of exceptions: - In except.h::exception_table, unimplemented ECs have a uc_ disposition. + In except.hc::exception_table, unimplemented ECs have a uc_ disposition. ec_function_argument_e ACOS ANNUITY diff --git a/libgcobol/libgcobol.cc b/libgcobol/libgcobol.cc index a39b6d994e227ac6c8f8a2e366879d96a4ccea84..85b896ca6166116e2b5cae238d6d6e9638893971 100644 --- a/libgcobol/libgcobol.cc +++ b/libgcobol/libgcobol.cc @@ -61,7 +61,7 @@ #include <execinfo.h> #include "ec.h" -#include "except.h" +#include "exceptc.h" // This couldn't be defined in symbols.h because it conflicts with a LEVEL66 // in parse.h