]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
text-art: remove explicit #include of C++ standard library headers
authorDavid Malcolm <dmalcolm@redhat.com>
Sat, 24 Jun 2023 01:18:15 +0000 (21:18 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Sat, 24 Jun 2023 01:18:15 +0000 (21:18 -0400)
gcc/analyzer/ChangeLog:
* access-diagram.cc: Add #define INCLUDE_VECTOR.
* bounds-checking.cc: Likewise.

gcc/ChangeLog:
* diagnostic-format-sarif.cc: Add #define INCLUDE_VECTOR.
* diagnostic.cc: Likewise.
* text-art/box-drawing.cc: Likewise.
* text-art/canvas.cc: Likewise.
* text-art/ruler.cc: Likewise.
* text-art/selftests.cc: Likewise.
* text-art/selftests.h (text_art::canvas): New forward decl.
* text-art/style.cc: Add #define INCLUDE_VECTOR.
* text-art/styled-string.cc: Likewise.
* text-art/table.cc: Likewise.
* text-art/table.h: Remove #include <vector>.
* text-art/theme.cc: Add #define INCLUDE_VECTOR.
* text-art/types.h: Check that INCLUDE_VECTOR is defined.
Remove #include of <vector> and <string>.
* text-art/widget.cc: Add #define INCLUDE_VECTOR.
* text-art/widget.h: Remove #include <vector>.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_test_text_art.c: Add
#define INCLUDE_VECTOR.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
18 files changed:
gcc/analyzer/access-diagram.cc
gcc/analyzer/bounds-checking.cc
gcc/diagnostic-format-sarif.cc
gcc/diagnostic.cc
gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c
gcc/text-art/box-drawing.cc
gcc/text-art/canvas.cc
gcc/text-art/ruler.cc
gcc/text-art/selftests.cc
gcc/text-art/selftests.h
gcc/text-art/style.cc
gcc/text-art/styled-string.cc
gcc/text-art/table.cc
gcc/text-art/table.h
gcc/text-art/theme.cc
gcc/text-art/types.h
gcc/text-art/widget.cc
gcc/text-art/widget.h

index 968ff50a0b75ec9c25347dc6ca09484a317aee13..467c9bdd7340f46814a810c3c1a99f04d3ee2200 100644 (file)
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 #define INCLUDE_MEMORY
 #define INCLUDE_MAP
 #define INCLUDE_SET
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "coretypes.h"
index 10632d12562fbb88f8b031c62ae62d5ea617e3a8..5e8de9a7aa5c80aafcefc4cd7d62b991f847e50c 100644 (file)
@@ -19,6 +19,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_MEMORY
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "make-unique.h"
index ac2f5b844e394c16e2c8b4d1e2e548974e195010..5e483988027b78e9bbb27747ae791dbb37c17071 100644 (file)
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3.  If not see
 
 
 #include "config.h"
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "diagnostic.h"
index 7c2289f063429e47a84c074d3417e89753eb2289..c523f215baec25370dc4ef91b705306e687d18db 100644 (file)
@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3.  If not see
    message module.  */
 
 #include "config.h"
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "version.h"
index 27c341b9f2f54ba81ad04363432ab2824b85632f..58b219bb0dcccb968c2628e0ab17b56dad40e576 100644 (file)
@@ -2,6 +2,7 @@
 
 /* This plugin exercises the text_art code.  */
 
+#define INCLUDE_VECTOR
 #include "gcc-plugin.h"
 #include "config.h"
 #include "system.h"
index 981d0b095cf8c536f13a8c61a9ac0933f5efa237..7d4992168067b943f1b7be5135712cd328949665 100644 (file)
@@ -19,6 +19,7 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "text-art/box-drawing.h"
index f229612c91918aeac67d8a9cbcae2bd423804666..26ea051718268c608006126ed7aaf6f8ea508e3d 100644 (file)
@@ -19,6 +19,7 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "pretty-print.h"
index 80c623f77ba7d9f85221989e19e2e87a9d1a6e7c..3323a055bb6cd02c34b3b0940111c70d70e89cac 100644 (file)
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_ALGORITHM
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "pretty-print.h"
index 60ad003b549f34a78b62bb6aa94c31fcbad40b55..25d81c1be89a6f7399994c48d926cb393714ac1b 100644 (file)
@@ -19,6 +19,7 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "selftest.h"
index 706a1d8b5d6d2e6084c559803fe2283299519837..ba29f692697804004cb916e92425d5f7e8a31b7b 100644 (file)
@@ -22,7 +22,9 @@ along with GCC; see the file COPYING3.  If not see
 
 #if CHECKING_P
 
-#include "text-art/types.h"
+namespace text_art {
+  class canvas;
+} // namespace text_art
 
 namespace selftest {
 
index 00b056336fcbcae23b1295253ee18dc25d51bce1..85ad49ee809da2dcdc4c90877071c57893e21612 100644 (file)
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #define INCLUDE_ALGORITHM
 #define INCLUDE_MEMORY
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "make-unique.h"
index cd176b2313f5faf8d3611daeae876557d6341e3b..a0cc187c8cb2c6cd251d0f2e46b5061484d0ba67 100644 (file)
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_MEMORY
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "make-unique.h"
index 42cc4228ea6f1e08fcfadf49703d9679e15142cb..71a1024625761b842d8afb7bbc7dccefb1e65dc7 100644 (file)
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_MEMORY
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "make-unique.h"
index 5e6c8ffb83627df33b382c1241649928b1ff5d75..2dc5c3c41cb7ebccd3977e4f15e9f077c2d81589 100644 (file)
@@ -23,7 +23,6 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "text-art/canvas.h"
 #include "text-art/theme.h"
-#include <vector>
 
 namespace text_art {
 
index 54dfe7c9213931f718ac1f2e6f7603a250631645..19c39fa7df71a2cb61a708b163bd1fe55d583983 100644 (file)
@@ -19,6 +19,7 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "pretty-print.h"
index b66188ae19c913eb464d93108aa25f23776fa51b..ea4ff4be8cc9252ae7f01477a7d65f5ac55a2952 100644 (file)
@@ -21,10 +21,16 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_TEXT_ART_TYPES_H
 #define GCC_TEXT_ART_TYPES_H
 
+/* This header uses std::vector, but <vector> can't be directly
+   included due to issues with macros.  Hence it must be included from
+   system.h by defining INCLUDE_MEMORY in any source file using it.  */
+
+#ifndef INCLUDE_VECTOR
+# error "You must define INCLUDE_VECTOR before including system.h to use text-art/types.h"
+#endif
+
 #include "cpplib.h"
 #include "pretty-print.h"
-#include <vector>
-#include <string>
 
 namespace text_art {
 
index e6e544d50358915e997e2200d770daff2384abe2..b64a6236a5c7ab8cd92480b1dd946735a0c259a3 100644 (file)
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "config.h"
 #define INCLUDE_MEMORY
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "pretty-print.h"
index 91209444bf7b8546998e7cce9fdc3bf9fa33c014..8798e436d94de3910003c398272c31b68612fdd2 100644 (file)
@@ -21,7 +21,6 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_TEXT_ART_WIDGET_H
 #define GCC_TEXT_ART_WIDGET_H
 
-#include <vector>
 #include "text-art/canvas.h"
 #include "text-art/table.h"