aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-03-19 15:09:03 +0100
committerRichard Biener <rguenth@gcc.gnu.org>2025-03-21 10:05:46 +0100
commita62893d71c5f48fd7780957e1ad1a4f38f351728 (patch)
tree5f995d84b47f50931c03aaa5d53608fc514e3c6b
parent0f344846a62c8863375909d8d6b435b4b5fd35a0 (diff)
downloadgcc-a62893d71c5f48fd7780957e1ad1a4f38f351728.zip
gcc-a62893d71c5f48fd7780957e1ad1a4f38f351728.tar.gz
gcc-a62893d71c5f48fd7780957e1ad1a4f38f351728.tar.bz2
make sources coretypes.h and tree.h clean
The following removes HOWEVER_GCC_DEFINES_TREE and the alternate definition of tree from symbols.h and instead ensures that both coretypes.h and tree.h are included where required. This required putting GCCs own 'NONE' in a scoped enum (see separate patch) and renaming the cobol use of UNSIGNED, SIGNED and BLOCK which conflict with enums from tree.h. There's a few things in conflict with options.h defines, notably cobol_dialect and cobol_exceptions but also yy_flex_debug (wherever that comes from). I've chosen to simply #undef those where appropriate. I've refrained from putting the coretypes.h and tree.h includes in cobol-system.h since not all files require this. This helps in making use of real.h instead of using _Float128. PR cobol/119241 gcc/cobol/ * 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.
-rw-r--r--gcc/cobol/cdf.y3
-rw-r--r--gcc/cobol/cobol1.cc1
-rw-r--r--gcc/cobol/except.cc1
-rw-r--r--gcc/cobol/genapi.cc2
-rw-r--r--gcc/cobol/gengen.cc1
-rw-r--r--gcc/cobol/genmath.cc1
-rw-r--r--gcc/cobol/genutil.cc1
-rw-r--r--gcc/cobol/parse.y24
-rw-r--r--gcc/cobol/scan.l13
-rw-r--r--gcc/cobol/structs.cc1
-rw-r--r--gcc/cobol/symbols.cc4
-rw-r--r--gcc/cobol/symbols.h5
-rw-r--r--gcc/cobol/symfind.cc3
-rw-r--r--gcc/cobol/token_names.h6
-rw-r--r--gcc/cobol/util.cc5
15 files changed, 40 insertions, 31 deletions
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/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/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..0105388 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 COB_BLOCK
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 COB_SIGNED
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 COB_UNSIGNED
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 COB_BLOCK
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 COB_SIGNED
STANDARD_BINARY
STANDARD_DECIMAL
STATEMENT STEP STRUCTURE
@@ -1230,7 +1236,7 @@
TOWARD_LESSER
TRUNCATION
UCS_4
- UNDERLINE UNSIGNED
+ UNDERLINE COB_UNSIGNED
UTF_16
UTF_8
@@ -2901,7 +2907,7 @@ fd_clause: record_desc
}
;
-block_desc: BLOCK contains rec_contains chars_recs
+block_desc: COB_BLOCK 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";
+ | COB_SIGNED { 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";
+ | COB_UNSIGNED { 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..4b212f0 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 COB_SIGNED; }
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 COB_UNSIGNED; }
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 COB_BLOCK; }
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 COB_BLOCK; }
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 COB_BLOCK; }
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..17583e0 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"
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..f9b80b6 100644
--- a/gcc/cobol/token_names.h
+++ b/gcc/cobol/token_names.h
@@ -219,7 +219,7 @@ tokens = {
{ "bit-of", BIT_OF }, // 470
{ "bit-to-char", BIT_TO_CHAR }, // 471
{ "blank", BLANK }, // 472
- { "block", BLOCK }, // 473
+ { "block", COB_BLOCK }, // 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", COB_SIGNED }, // 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", COB_UNSIGNED }, // 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"