aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBob Dubner <rdubner@symas.com>2025-03-28 12:09:39 -0400
committerRobert Dubner <rdubner@symas.com>2025-03-28 12:21:05 -0400
commit137e294883407d227ad20767ea3363a37d22c1e9 (patch)
tree421f590dae579169c872207d91db34cd17bad401 /gcc
parentb69945d511b394ef092c888c6475f8c72bee0c03 (diff)
downloadgcc-137e294883407d227ad20767ea3363a37d22c1e9.zip
gcc-137e294883407d227ad20767ea3363a37d22c1e9.tar.gz
gcc-137e294883407d227ad20767ea3363a37d22c1e9.tar.bz2
cobol: Confine all __int128/_Float128 references to libgcobol.
These changes are part of the effort to make possible cross compilation for hosts that don't support __int128 or _Float128. gcc/cobol * Make-lang.in: Eliminate libgcobol.h from gcc/cobol files. * genapi.cc: Eliminate "#include libgcobol.h". (parser_display_internal): Change comment. * genmath.cc: Eliminate "#include libgcobol.h". * genutil.cc: Likewise. (get_power_of_ten): Change comment. * structs.cc: Eliminate cblc_int128_type_node. * structs.h: Likewise. * symbols.h: Receive comment from libgcobol.h libgcobol * charmaps.cc:Eliminate "#include libgcobol.h". Change comment about _Float128. * common-defs.h: Change comment about _Float128. Receive #defines from libgcobol.h. * constants.cc: Eliminate #include libgcobol.h. Eliminate other unneeded #includes. * ec.h: Receive declarations from libgcobol.h. * gcobolio.h: Likewise. * gfileio.cc: (__gg__file_init): Use file_flag_none_e instead of zero in assignment. (__gg__file_reopen): Likewise. (__io__file_open): Likewise. * gfileio.h: Receive declarations from libgcobol.h. * libgcobol.h: Numerous declarations moved elsewhere.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cobol/Make-lang.in2
-rw-r--r--gcc/cobol/genapi.cc8
-rw-r--r--gcc/cobol/genmath.cc1
-rw-r--r--gcc/cobol/genutil.cc3
-rw-r--r--gcc/cobol/structs.cc30
-rw-r--r--gcc/cobol/structs.h1
-rw-r--r--gcc/cobol/symbols.h8
7 files changed, 12 insertions, 41 deletions
diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in
index 02c867e..ee048b0 100644
--- a/gcc/cobol/Make-lang.in
+++ b/gcc/cobol/Make-lang.in
@@ -93,7 +93,6 @@ cobol/charmaps.cc: $(LIB_SOURCE)/charmaps.cc
sed -i "s|\"common-defs[.]h\"|\"$(LIB_SOURCE)/common-defs.h\"|g" $@
sed -i "s|\"io[.]h\"|\"$(LIB_SOURCE)/io.h\"|g" $@
sed -i "s|\"gcobolio[.]h\"|\"$(LIB_SOURCE)/gcobolio.h\"|g" $@
- sed -i "s|\"libgcobol[.]h\"|\"$(LIB_SOURCE)/libgcobol.h\"|g" $@
sed -i "s|\"gfileio[.]h\"|\"$(LIB_SOURCE)/gfileio.h\"|g" $@
sed -i "s|\"charmaps[.]h\"|\"$(LIB_SOURCE)/charmaps.h\"|g" $@
sed -i "s|\"valconv[.]h\"|\"$(LIB_SOURCE)/valconv.h\"|g" $@
@@ -105,7 +104,6 @@ cobol/valconv.cc: $(LIB_SOURCE)/valconv.cc
sed -i "s|\"common-defs[.]h\"|\"$(LIB_SOURCE)/common-defs.h\"|g" $@
sed -i "s|\"io[.]h\"|\"$(LIB_SOURCE)/io.h\"|g" $@
sed -i "s|\"gcobolio[.]h\"|\"$(LIB_SOURCE)/gcobolio.h\"|g" $@
- sed -i "s|\"libgcobol[.]h\"|\"$(LIB_SOURCE)/libgcobol.h\"|g" $@
sed -i "s|\"gfileio[.]h\"|\"$(LIB_SOURCE)/gfileio.h\"|g" $@
sed -i "s|\"charmaps[.]h\"|\"$(LIB_SOURCE)/charmaps.h\"|g" $@
sed -i "s|\"valconv[.]h\"|\"$(LIB_SOURCE)/valconv.h\"|g" $@
diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc
index 8adc07e..be463f2 100644
--- a/gcc/cobol/genapi.cc
+++ b/gcc/cobol/genapi.cc
@@ -48,7 +48,6 @@
#include "genmath.h"
#include "structs.h"
#include "../../libgcobol/gcobolio.h"
-#include "../../libgcobol/libgcobol.h"
#include "../../libgcobol/charmaps.h"
#include "../../libgcobol/valconv.h"
#include "show_parse.h"
@@ -4800,14 +4799,13 @@ parser_display_internal(tree file_descriptor,
else if( refer.field->type == FldLiteralN )
{
// The parser found the string of digits from the source code and converted
- // it to a _Float128.
+ // it to a 128-bit binary floating point number.
// The bad news is that something like 555.55 can't be expressed exactly;
// internally it is 555.5499999999....
- // The good news is that we know any string of 33 or fewer digits is
- // converted to _Float128 and then converted back again, you get the same
- // string.
+ // The good news is that we know any string of 33 or fewer decimal digits
+ // can be converted to and from IEEE 754 binary128 without being changes
// We make use of that here
diff --git a/gcc/cobol/genmath.cc b/gcc/cobol/genmath.cc
index 56254e8..9725754 100644
--- a/gcc/cobol/genmath.cc
+++ b/gcc/cobol/genmath.cc
@@ -42,7 +42,6 @@
#include "gengen.h"
#include "structs.h"
#include "../../libgcobol/gcobolio.h"
-#include "../../libgcobol/libgcobol.h"
#include "show_parse.h"
void
diff --git a/gcc/cobol/genutil.cc b/gcc/cobol/genutil.cc
index 509f8d2..d11e464 100644
--- a/gcc/cobol/genutil.cc
+++ b/gcc/cobol/genutil.cc
@@ -42,7 +42,6 @@
#include "genutil.h"
#include "structs.h"
#include "../../libgcobol/gcobolio.h"
-#include "../../libgcobol/libgcobol.h"
#include "../../libgcobol/charmaps.h"
#include "show_parse.h"
#include "../../libgcobol/exceptl.h"
@@ -1463,7 +1462,7 @@ get_power_of_ten(int n)
else
{
// 19 through 38 is handled in a second step, because when this was written,
- // GCC couldn't handle __int128 constants:
+ // GCC couldn't handle 128-bit constants:
retval = pos[n/2];
retval *= retval;
if( n & 1 )
diff --git a/gcc/cobol/structs.cc b/gcc/cobol/structs.cc
index 1d2d984..e6f38e6 100644
--- a/gcc/cobol/structs.cc
+++ b/gcc/cobol/structs.cc
@@ -157,7 +157,6 @@ tree cblc_field_pp_type_node;
tree cblc_file_type_node;
tree cblc_file_p_type_node;
tree cblc_goto_type_node;
-tree cblc_int128_type_node;
// The following functions return type_decl nodes for the various structures
@@ -286,34 +285,6 @@ typedef struct cblc_file_t
return retval;
}
-static tree
-create_cblc_int128_t()
- {
- /*
- // GCC-13 can't initialize __int64 variables, which is something we need to
- // be able to do. So, I created this union. The array can be initialized,
- // and thus we do an end run around the problem. Annoying, but not fatally
- // so.
-
- typedef union cblc_int128_t
- {
- unsigned char array16[16];
- __uint128 uval128;
- __int128 sval128;
- } cblc_int128_t;
- */
- tree retval = NULL_TREE;
- tree array_type = build_array_type_nelts(UCHAR, 16);
- retval = gg_get_filelevel_union_type_decl(
- "cblc_int128_t",
- 3,
- array_type, "array16" ,
- UINT128, "uval128" ,
- INT128, "sval128" );
- retval = TREE_TYPE(retval);
- return retval;
- }
-
void
create_our_type_nodes()
{
@@ -326,7 +297,6 @@ create_our_type_nodes()
cblc_field_pp_type_node = build_pointer_type(cblc_field_p_type_node);
cblc_file_type_node = create_cblc_file_t();
cblc_file_p_type_node = build_pointer_type(cblc_file_type_node);
- cblc_int128_type_node = create_cblc_int128_t();
}
}
diff --git a/gcc/cobol/structs.h b/gcc/cobol/structs.h
index 618d8f0..47a78b4 100644
--- a/gcc/cobol/structs.h
+++ b/gcc/cobol/structs.h
@@ -55,7 +55,6 @@ extern GTY(()) tree cblc_field_pp_type_node;
extern GTY(()) tree cblc_file_type_node;
extern GTY(()) tree cblc_file_p_type_node;
extern GTY(()) tree cblc_goto_type_node;
-extern GTY(()) tree cblc_int128_type_node;
extern void create_our_type_nodes();
diff --git a/gcc/cobol/symbols.h b/gcc/cobol/symbols.h
index 91115b7..d5acf16 100644
--- a/gcc/cobol/symbols.h
+++ b/gcc/cobol/symbols.h
@@ -477,6 +477,14 @@ struct cbl_subtable_t {
bool is_elementary( enum cbl_field_type_t type );
+/* In cbl_field_t:
+ * 'offset' is overloaded for FldAlphanumeric/temporary/intermediate variables
+ * For such variables, offset is a copy of the initial capacity. This is in
+ * support of the FUNCTION TRIM function, which both needs to be able to
+ * reduce the capacity of the target variable, and then to reset it back to
+ * the original value
+ */
+
struct cbl_field_t {
size_t offset;
enum cbl_field_type_t type, usage;