]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
make sources coretypes.h and tree.h clean
authorRichard Biener <rguenther@suse.de>
Wed, 19 Mar 2025 14:09:03 +0000 (15:09 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 21 Mar 2025 09:05:46 +0000 (10:05 +0100)
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.

15 files changed:
gcc/cobol/cdf.y
gcc/cobol/cobol1.cc
gcc/cobol/except.cc
gcc/cobol/genapi.cc
gcc/cobol/gengen.cc
gcc/cobol/genmath.cc
gcc/cobol/genutil.cc
gcc/cobol/parse.y
gcc/cobol/scan.l
gcc/cobol/structs.cc
gcc/cobol/symbols.cc
gcc/cobol/symbols.h
gcc/cobol/symfind.cc
gcc/cobol/token_names.h
gcc/cobol/util.cc

index 12d11e78116e6bb220fbf518fc46af3c0dbbc58d..c44ee5ee0723c440b73aaf74bad27c8d47d543c4 100644 (file)
@@ -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"
index 08af367e2264b22b49f19e075e1f64d48fe18dbf..0d07c460d4161172e6fb98b9c26a7c2cfdd1b295 100644 (file)
@@ -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"
index 5374201b4c822c570a58ddc96ded29a0442a5f92..ba49f78d897f45b02f75bce68e2d159f2ffccf63 100644 (file)
@@ -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"
index a4abbd13ab6ac7ba5aea39ec5bcf671f2cd001ba..8f4f9b2137057961fa26a82cc4b7c0cafb6bfa8b 100644 (file)
@@ -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"
index 2796b7facdbd138f2bdea04867f78af92e87fd82..ffb64c8993d912b6deb98c6965c8784d5d52972c 100644 (file)
@@ -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"
index 42f01cda6eec0660a315cef176f3e4c4794a05bb..56254e88cc6c57983482798920979caa009961d8 100644 (file)
@@ -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"
index c0e6631bb760a6350a7168de00e28aef3d0b091e..f8bf7bc34b7637fb9693c00ca710544bcd206bb3 100644 (file)
@@ -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"
index c45dc333ec7537494f17afe03b27f47f4054ded2..0105388873692b42f0f56c0e5fd898395af0df3f 100644 (file)
@@ -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"
 
 %{
 #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"
 
                        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"
                        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
                        TOWARD_LESSER "TOWARD-LESSER"
                        TRUNCATION
                        UCS_4 "UCS-4"
-                       UNDERLINE UNSIGNED
+                       UNDERLINE COB_UNSIGNED
                        UTF_16 "UTF-16"
                        UTF_8 "UTF-8"
 
 
                         BACKWARD BASED BASECONVERT
                        BEFORE BINARY BIT BIT_OF BIT_TO_CHAR
-                        BLANK BLOCK
+                        BLANK COB_BLOCK
                        BOOLEAN_OF_INTEGER
                        BOTTOM BY
                        BYTE BYTE_LENGTH
                         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
                        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
index 18d0d82cf43dd2662e8a8b63188d8ac2ca8542c4..4b212f02a11dfba050d019344cb594f817990a58 100644 (file)
@@ -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; }
index 39c8a425fa5194ac0a022cf571fb7fc378a81d89..1d2d9845fdf72e96183dea9f5575c6857d3bfc48 100644 (file)
@@ -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"
index 38c7a2ed47b19ce839633fb554911bcbc8acd035..17583e002a12afc6cb3ec0546de9d78b11157e15 100644 (file)
 
 #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"
index c1894129781ca175b9259739147ab190577a97a1..fb7b60d9eaaad0b9f469e641622d29960c48c6cf 100644 (file)
 
 #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?" );
 
index 38a890006c8da517b4ed1ec842a2c0ea4723dddf..2687fdb83df2f82f651c543d1750819bffd50967 100644 (file)
@@ -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"
index 26dabc87eff2e93e4d4f8165b5bf113cdf666814..f9b80b6fcb02d58b24b25a453f959247afd90596 100644 (file)
@@ -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
index 101a0a0d803018af23968f6742bf8eacad16a446..1c0810bf229725ca54d95d64ee905e57a87f418a 100644 (file)
  */
 
 #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"