text-art: remove explicit #include of C++ standard library headers
Checks
Commit Message
On Fri, 2023-06-23 at 12:52 +0100, Alex Coplan wrote:
> Hi David,
>
> It looks like this patch breaks bootstrap on Darwin. I tried a
> bootstrap on
> x86_64-apple-darwin and got errors building selftest-run-tests.cc:
>
> In file included from
> /Users/alecop01/toolchain/src/gcc/gcc/selftest-run-tests.cc:31:
> In file included from
> /Users/alecop01/toolchain/src/gcc/gcc/text-art/selftests.h:25:
> In file included from
> /Users/alecop01/toolchain/src/gcc/gcc/text-art/types.h:26:
> In file included from
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:276:
> In file included from
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
> In file included from
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
> In file included from
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:670:
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/typeinfo:377:5: error:
> no member named 'fancy_abort' in namespace 'std::__1'; did you mean
> simply 'fancy_abort'?
> _VSTD::abort();
> ^~~~~~~
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:856:15: note:
> expanded from macro '_VSTD'
> #define _VSTD std::_LIBCPP_ABI_NAMESPACE
> ^
> /Users/alecop01/toolchain/src/gcc/gcc/system.h:811:13: note:
> 'fancy_abort' declared here
> extern void fancy_abort (const char *, int, const char *)
> ^
>
> Please could you take a look?
>
> Thanks,
> Alex
Sorry about the breakage.
Does the following patch fix it for you?
(only tested lightly so far, on x86_64-pc-linux-gnu)
Dave
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: Remove #include of <vector> and <string>.
* text-art/widget.cc: Add #define INCLUDE_VECTOR.
* text-art/widget.h: Remove #include <vector>.
---
gcc/analyzer/access-diagram.cc | 1 +
gcc/analyzer/bounds-checking.cc | 1 +
gcc/diagnostic-format-sarif.cc | 1 +
gcc/diagnostic.cc | 1 +
gcc/text-art/box-drawing.cc | 1 +
gcc/text-art/canvas.cc | 1 +
gcc/text-art/ruler.cc | 1 +
gcc/text-art/selftests.cc | 1 +
gcc/text-art/selftests.h | 4 +++-
gcc/text-art/style.cc | 1 +
gcc/text-art/styled-string.cc | 1 +
gcc/text-art/table.cc | 1 +
gcc/text-art/table.h | 1 -
gcc/text-art/theme.cc | 1 +
gcc/text-art/types.h | 2 --
gcc/text-art/widget.cc | 1 +
gcc/text-art/widget.h | 1 -
17 files changed, 16 insertions(+), 5 deletions(-)
Comments
Hi Dave,
On 23/06/2023 10:36, David Malcolm wrote:
> On Fri, 2023-06-23 at 12:52 +0100, Alex Coplan wrote:
> > Hi David,
> >
> > It looks like this patch breaks bootstrap on Darwin. I tried a
> > bootstrap on
> > x86_64-apple-darwin and got errors building selftest-run-tests.cc:
> >
> > In file included from
> > /Users/alecop01/toolchain/src/gcc/gcc/selftest-run-tests.cc:31:
> > In file included from
> > /Users/alecop01/toolchain/src/gcc/gcc/text-art/selftests.h:25:
> > In file included from
> > /Users/alecop01/toolchain/src/gcc/gcc/text-art/types.h:26:
> > In file included from
> > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> > Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:276:
> > In file included from
> > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> > Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__bit_reference:15:
> > In file included from
> > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> > Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
> > In file included from
> > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> > Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:670:
> > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> > Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/typeinfo:377:5: error:
> > no member named 'fancy_abort' in namespace 'std::__1'; did you mean
> > simply 'fancy_abort'?
> > _VSTD::abort();
> > ^~~~~~~
> > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/
> > Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:856:15: note:
> > expanded from macro '_VSTD'
> > #define _VSTD std::_LIBCPP_ABI_NAMESPACE
> > ^
> > /Users/alecop01/toolchain/src/gcc/gcc/system.h:811:13: note:
> > 'fancy_abort' declared here
> > extern void fancy_abort (const char *, int, const char *)
> > ^
> >
> > Please could you take a look?
> >
> > Thanks,
> > Alex
>
> Sorry about the breakage.
>
> Does the following patch fix it for you?
> (only tested lightly so far, on x86_64-pc-linux-gnu)
Thanks for the fix! I can confirm this fixes bootstrap on
x86_64-apple-darwin for me.
Cheers,
Alex
>
>
> Dave
>
>
>
> 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: Remove #include of <vector> and <string>.
> * text-art/widget.cc: Add #define INCLUDE_VECTOR.
> * text-art/widget.h: Remove #include <vector>.
> ---
> gcc/analyzer/access-diagram.cc | 1 +
> gcc/analyzer/bounds-checking.cc | 1 +
> gcc/diagnostic-format-sarif.cc | 1 +
> gcc/diagnostic.cc | 1 +
> gcc/text-art/box-drawing.cc | 1 +
> gcc/text-art/canvas.cc | 1 +
> gcc/text-art/ruler.cc | 1 +
> gcc/text-art/selftests.cc | 1 +
> gcc/text-art/selftests.h | 4 +++-
> gcc/text-art/style.cc | 1 +
> gcc/text-art/styled-string.cc | 1 +
> gcc/text-art/table.cc | 1 +
> gcc/text-art/table.h | 1 -
> gcc/text-art/theme.cc | 1 +
> gcc/text-art/types.h | 2 --
> gcc/text-art/widget.cc | 1 +
> gcc/text-art/widget.h | 1 -
> 17 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access-diagram.cc
> index 968ff50a0b7..467c9bdd734 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 10632d12562..5e8de9a7aa5 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 ac2f5b844e3..5e483988027 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 7c2289f0634..c523f215bae 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/text-art/box-drawing.cc b/gcc/text-art/box-drawing.cc
> index 981d0b095cf..7d499216806 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 f229612c919..26ea0517182 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 80c623f77ba..3323a055bb6 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 60ad003b549..25d81c1be89 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 706a1d8b5d6..ba29f692697 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 00b056336fc..85ad49ee809 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 cd176b2313f..a0cc187c8cb 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 42cc4228ea6..71a10246257 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 5e6c8ffb836..2dc5c3c41cb 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 54dfe7c9213..19c39fa7df7 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 b66188ae19c..dc2aba24440 100644
> --- a/gcc/text-art/types.h
> +++ b/gcc/text-art/types.h
> @@ -23,8 +23,6 @@ along with GCC; see the file COPYING3. If not see
>
> #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 e6e544d5035..b64a6236a5c 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 91209444bf7..8798e436d94 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"
>
> --
> 2.26.3
>
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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"
@@ -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 {
@@ -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"
@@ -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"
@@ -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"
@@ -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 {
@@ -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"
@@ -23,8 +23,6 @@ along with GCC; see the file COPYING3. If not see
#include "cpplib.h"
#include "pretty-print.h"
-#include <vector>
-#include <string>
namespace text_art {
@@ -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"
@@ -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"