From: FX Coudert <fxcoudert@gmail.com>
To: gcc@gcc.gnu.org
Cc: gaiusmod2@gmail.com
Subject: Nonbootstrap build with Apple clang broken in gm2
Date: Thu, 11 Jul 2024 16:08:28 +0200 [thread overview]
Message-ID: <F2B9E804-0226-4851-969C-2EC584B62FDB@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 499 bytes --]
Hi,
I am unable to perform a nonbootstrap build when gm2 is included, with Apple clang 15 as compiler. The error is due to incorrect inclusion of headers (<string> and <vector>) which are included after GCC’s system.h has been included, and macros like abort() are redefined or poisoned.
I think the correct idiom in GCC is to #define INCLUDE_STRING (for example) before “system.h” is included, rather than #include <string> directly. The attached patch fixes the issue.
Best,
FX
[-- Attachment #2: gm2.diff --]
[-- Type: application/octet-stream, Size: 1246 bytes --]
diff --git a/gcc/m2/gm2-gcc/m2linemap.cc b/gcc/m2/gm2-gcc/m2linemap.cc
index c916ba6155a..fcf589e840f 100644
--- a/gcc/m2/gm2-gcc/m2linemap.cc
+++ b/gcc/m2/gm2-gcc/m2linemap.cc
@@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License
along with GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
+#define INCLUDE_STRING
#include "gcc-consolidation.h"
/* Utilize some of the C build routines */
@@ -36,7 +37,6 @@ along with GNU Modula-2; see the file COPYING3. If not see
#define m2linemap_c
#include "m2linemap.h"
#include "m2color.h"
-#include <string>
static int inFile = FALSE;
diff --git a/gcc/m2/gm2spec.cc b/gcc/m2/gm2spec.cc
index a4faf88027a..2a4dccf8b93 100644
--- a/gcc/m2/gm2spec.cc
+++ b/gcc/m2/gm2spec.cc
@@ -20,6 +20,8 @@ along with GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
+#define INCLUDE_STRING
+#define INCLUDE_VECTOR
#include "system.h"
#include "coretypes.h"
#include "tm.h"
@@ -31,8 +33,6 @@ along with GNU Modula-2; see the file COPYING3. If not see
#include "gcc.h"
#include "opts.h"
#include "vec.h"
-#include <vector>
-#include <string>
#include "m2/gm2config.h"
next reply other threads:[~2024-07-11 14:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 14:08 FX Coudert [this message]
2024-07-12 12:52 ` Gaius Mulley
2024-07-12 16:04 ` FX Coudert
2024-07-24 13:33 ` Gaius Mulley
2024-07-24 13:38 ` FX Coudert
2024-07-28 14:17 ` Gaius Mulley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=F2B9E804-0226-4851-969C-2EC584B62FDB@gmail.com \
--to=fxcoudert@gmail.com \
--cc=gaiusmod2@gmail.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).