From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A4E343857C4F for ; Sat, 24 Jun 2023 01:27:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A4E343857C4F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687570024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wtRrFKYQAK8zW1xCQm0Gzn9M6u7aU6VzE+JwlLPTNZ0=; b=ADLskmZjyAJvZoB+oxufkJivAQOxckWHqio077IdcUGLWAjnWzmGTiRjWtDiuHOmcP387S i57dXmAWuDaMRW7oWXKrusl+wOlZF+hSUiG2fX6j4CpENIpwQJ5TmKAY/JAmqVBuziHfi+ 5ibiyMwuc43oXK3kMocviKmpMjg/OAI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-668-0SnjLrOLMv-Nr5eVh5PaXQ-1; Fri, 23 Jun 2023 21:27:01 -0400 X-MC-Unique: 0SnjLrOLMv-Nr5eVh5PaXQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B1E353C0C88E; Sat, 24 Jun 2023 01:27:00 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.9.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A95D2166B25; Sat, 24 Jun 2023 01:27:00 +0000 (UTC) From: David Malcolm To: Alex Coplan Cc: gcc-patches@gcc.gnu.org, David Malcolm Subject: [pushed: v2] text-art: remove explicit #include of C++ standard library headers Date: Fri, 23 Jun 2023 21:26:57 -0400 Message-Id: <20230624012657.130267-1-dmalcolm@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 2023-06-23 at 16:35 +0100, Alex Coplan wrote: > Thanks for the fix! I can confirm this fixes bootstrap on > x86_64-apple-darwin for me. Thanks Alex Unfortunately the patch I posted broke the build of the plugin in the testsuite, so I had to tweak things slightly. Here's v2 of the patch, which fixes the plugin, and also adds a check to text-art/types.h to ensure that INCLUDE_VECTOR was defined. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. I've pushed it to trunk as r14-2059-gb2e075a594e93a. Hopefully this version also fixes the build for you; let me know if this is still causing problems. Sorry again for the breakage 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 . * text-art/theme.cc: Add #define INCLUDE_VECTOR. * text-art/types.h: Check that INCLUDE_VECTOR is defined. Remove #include of and . * text-art/widget.cc: Add #define INCLUDE_VECTOR. * text-art/widget.h: Remove #include . gcc/testsuite/ChangeLog: * gcc.dg/plugin/diagnostic_plugin_test_text_art.c: Add #define 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.dg/plugin/diagnostic_plugin_test_text_art.c | 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 | 10 ++++++++-- gcc/text-art/widget.cc | 1 + gcc/text-art/widget.h | 1 - 18 files changed, 25 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/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_text_art.c index 27c341b9f2f..58b219bb0dc 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 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 . */ #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 . */ #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 . */ #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 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 . */ #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..ea4ff4be8cc 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 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 -#include 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 #include "text-art/canvas.h" #include "text-art/table.h" -- 2.26.3