aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2023-06-23 21:18:15 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2023-06-23 21:18:15 -0400
commitb2e075a594e93a4fc89de8fa53db5c32a4de83b5 (patch)
tree6445e0708abe125be290064589d135c534d8c064 /gcc
parentd39f4889cc24c5c96cf9112045298e0945b9932c (diff)
downloadgcc-b2e075a594e93a4fc89de8fa53db5c32a4de83b5.zip
gcc-b2e075a594e93a4fc89de8fa53db5c32a4de83b5.tar.gz
gcc-b2e075a594e93a4fc89de8fa53db5c32a4de83b5.tar.bz2
text-art: remove explicit #include of C++ standard library headers
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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/analyzer/access-diagram.cc1
-rw-r--r--gcc/analyzer/bounds-checking.cc1
-rw-r--r--gcc/diagnostic-format-sarif.cc1
-rw-r--r--gcc/diagnostic.cc1
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c1
-rw-r--r--gcc/text-art/box-drawing.cc1
-rw-r--r--gcc/text-art/canvas.cc1
-rw-r--r--gcc/text-art/ruler.cc1
-rw-r--r--gcc/text-art/selftests.cc1
-rw-r--r--gcc/text-art/selftests.h4
-rw-r--r--gcc/text-art/style.cc1
-rw-r--r--gcc/text-art/styled-string.cc1
-rw-r--r--gcc/text-art/table.cc1
-rw-r--r--gcc/text-art/table.h1
-rw-r--r--gcc/text-art/theme.cc1
-rw-r--r--gcc/text-art/types.h10
-rw-r--r--gcc/text-art/widget.cc1
-rw-r--r--gcc/text-art/widget.h1
18 files changed, 25 insertions, 5 deletions
diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access-diagram.cc
index 968ff50..467c9bd 100644
--- a/gcc/analyzer/access-diagram.cc
+++ b/gcc/analyzer/access-diagram.cc
@@ -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"
diff --git a/gcc/analyzer/bounds-checking.cc b/gcc/analyzer/bounds-checking.cc
index 10632d1..5e8de9a 100644
--- a/gcc/analyzer/bounds-checking.cc
+++ b/gcc/analyzer/bounds-checking.cc
@@ -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"
diff --git a/gcc/diagnostic-format-sarif.cc b/gcc/diagnostic-format-sarif.cc
index ac2f5b8..5e48398 100644
--- a/gcc/diagnostic-format-sarif.cc
+++ b/gcc/diagnostic-format-sarif.cc
@@ -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"
diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc
index 7c2289f..c523f21 100644
--- a/gcc/diagnostic.cc
+++ b/gcc/diagnostic.cc
@@ -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"
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c
index 27c341b..58b219b 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c
@@ -2,6 +2,7 @@
/* This plugin exercises the text_art code. */
+#define INCLUDE_VECTOR
#include "gcc-plugin.h"
#include "config.h"
#include "system.h"
diff --git a/gcc/text-art/box-drawing.cc b/gcc/text-art/box-drawing.cc
index 981d0b0..7d49921 100644
--- a/gcc/text-art/box-drawing.cc
+++ b/gcc/text-art/box-drawing.cc
@@ -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"
diff --git a/gcc/text-art/canvas.cc b/gcc/text-art/canvas.cc
index f229612..26ea051 100644
--- a/gcc/text-art/canvas.cc
+++ b/gcc/text-art/canvas.cc
@@ -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"
diff --git a/gcc/text-art/ruler.cc b/gcc/text-art/ruler.cc
index 80c623f..3323a05 100644
--- a/gcc/text-art/ruler.cc
+++ b/gcc/text-art/ruler.cc
@@ -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"
diff --git a/gcc/text-art/selftests.cc b/gcc/text-art/selftests.cc
index 60ad003..25d81c1 100644
--- a/gcc/text-art/selftests.cc
+++ b/gcc/text-art/selftests.cc
@@ -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"
diff --git a/gcc/text-art/selftests.h b/gcc/text-art/selftests.h
index 706a1d8..ba29f69 100644
--- a/gcc/text-art/selftests.h
+++ b/gcc/text-art/selftests.h
@@ -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 {
diff --git a/gcc/text-art/style.cc b/gcc/text-art/style.cc
index 00b0563..85ad49e 100644
--- a/gcc/text-art/style.cc
+++ b/gcc/text-art/style.cc
@@ -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"
diff --git a/gcc/text-art/styled-string.cc b/gcc/text-art/styled-string.cc
index cd176b2..a0cc187 100644
--- a/gcc/text-art/styled-string.cc
+++ b/gcc/text-art/styled-string.cc
@@ -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"
diff --git a/gcc/text-art/table.cc b/gcc/text-art/table.cc
index 42cc422..71a1024 100644
--- a/gcc/text-art/table.cc
+++ b/gcc/text-art/table.cc
@@ -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"
diff --git a/gcc/text-art/table.h b/gcc/text-art/table.h
index 5e6c8ff..2dc5c3c 100644
--- a/gcc/text-art/table.h
+++ b/gcc/text-art/table.h
@@ -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 {
diff --git a/gcc/text-art/theme.cc b/gcc/text-art/theme.cc
index 54dfe7c..19c39fa 100644
--- a/gcc/text-art/theme.cc
+++ b/gcc/text-art/theme.cc
@@ -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"
diff --git a/gcc/text-art/types.h b/gcc/text-art/types.h
index b66188a..ea4ff4b 100644
--- a/gcc/text-art/types.h
+++ b/gcc/text-art/types.h
@@ -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 {
diff --git a/gcc/text-art/widget.cc b/gcc/text-art/widget.cc
index e6e544d..b64a623 100644
--- a/gcc/text-art/widget.cc
+++ b/gcc/text-art/widget.cc
@@ -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"
diff --git a/gcc/text-art/widget.h b/gcc/text-art/widget.h
index 9120944..8798e43 100644
--- a/gcc/text-art/widget.h
+++ b/gcc/text-art/widget.h
@@ -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"