On Thu, 2026-10-29 at 09:43 +0100, Andreas Schwab wrote: > g++ -std=c++14 -c -g -O2 -DIN_GCC -fno-exceptions -fno-rtti - > fasynchronous-unwind-tables -W -Wall -Wno-error=narrowing -Wwrite- > strings -Wcast-qual -Wno-format -Wmissing-format-attribute - > Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long- > long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H - > DGENERATOR_FILE -I. -Ibuild -I../../gcc -I../../gcc/build - > I../../gcc/../include -I../../gcc/../libcpp/include \ > -o build/print-rtl.o ../../gcc/print-rtl.cc > In file included from ../../gcc/print-rtl.cc:57: > ../../gcc/json.h:226:57: error: ‘std::string’ has not been declared > 226 | const json::string *set_string (const char *key, > std::string utf8_value); > | > ^~~~~~ > ../../gcc/json.h:25:1: note: ‘std::string’ is defined in header > ‘<string>’; this is probably fixable by adding ‘#include <string>’ > 24 | #include "label-text.h" > +++ |+#include <string> > 25 | > make[3]: *** [Makefile:3297: build/print-rtl.o] Error 1
[adding the list this time] Sorry about the breakage. Does the attached patch fix things for you?
From 43303280b2c5b846a88e7b14f7d3db9e4beadbed Mon Sep 17 00:00:00 2001 From: David Malcolm <[email protected]> Date: Thu, 29 Oct 2026 09:32:36 -0400 Subject: [PATCH] Define INCLUDE_STRING in more places In r17-5669-g4a6c15e64ea599 I added a use of std::string to json.h Define INCLUDE_STRING before system.h in more places to ensure <string> is included. gcc/ChangeLog: * custom-sarif-properties/cfg.cc: Define INCLUDE_STRING. * custom-sarif-properties/digraphs.cc: Likewise. * custom-sarif-properties/state-graphs.cc: Likewise. * gimple-pretty-print.cc: Likewise. * optinfo-emit-json.cc: Likewise. * optinfo.cc: Likewise. * print-rtl.cc: Likewise. * selftest-json.cc: Likewise. * timevar.cc: Likewise. Signed-off-by: David Malcolm <[email protected]> --- gcc/custom-sarif-properties/cfg.cc | 1 + gcc/custom-sarif-properties/digraphs.cc | 1 + gcc/custom-sarif-properties/state-graphs.cc | 1 + gcc/gimple-pretty-print.cc | 1 + gcc/optinfo-emit-json.cc | 1 + gcc/optinfo.cc | 1 + gcc/print-rtl.cc | 1 + gcc/selftest-json.cc | 1 + gcc/timevar.cc | 1 + 9 files changed, 9 insertions(+) diff --git a/gcc/custom-sarif-properties/cfg.cc b/gcc/custom-sarif-properties/cfg.cc index 4b097487007..cc6fdf05e9d 100644 --- a/gcc/custom-sarif-properties/cfg.cc +++ b/gcc/custom-sarif-properties/cfg.cc @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +#define INCLUDE_STRING #include "config.h" #include "system.h" #include "coretypes.h" diff --git a/gcc/custom-sarif-properties/digraphs.cc b/gcc/custom-sarif-properties/digraphs.cc index 7920bfdd839..84589d7332e 100644 --- a/gcc/custom-sarif-properties/digraphs.cc +++ b/gcc/custom-sarif-properties/digraphs.cc @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +#define INCLUDE_STRING #include "config.h" #include "system.h" #include "coretypes.h" diff --git a/gcc/custom-sarif-properties/state-graphs.cc b/gcc/custom-sarif-properties/state-graphs.cc index 6d44e9d098a..acd8f7a05b3 100644 --- a/gcc/custom-sarif-properties/state-graphs.cc +++ b/gcc/custom-sarif-properties/state-graphs.cc @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +#define INCLUDE_STRING #include "config.h" #include "system.h" #include "coretypes.h" diff --git a/gcc/gimple-pretty-print.cc b/gcc/gimple-pretty-print.cc index b36e50b0fd4..f36321a71a7 100644 --- a/gcc/gimple-pretty-print.cc +++ b/gcc/gimple-pretty-print.cc @@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +#define INCLUDE_STRING #include "config.h" #include "system.h" #include "coretypes.h" diff --git a/gcc/optinfo-emit-json.cc b/gcc/optinfo-emit-json.cc index 5baa26449df..0d8df9866f5 100644 --- a/gcc/optinfo-emit-json.cc +++ b/gcc/optinfo-emit-json.cc @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +#define INCLUDE_STRING #include "config.h" #include "system.h" #include "coretypes.h" diff --git a/gcc/optinfo.cc b/gcc/optinfo.cc index 6e05c36a786..3300a0afaaa 100644 --- a/gcc/optinfo.cc +++ b/gcc/optinfo.cc @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +#define INCLUDE_STRING #include "config.h" #include "system.h" #include "coretypes.h" diff --git a/gcc/print-rtl.cc b/gcc/print-rtl.cc index e8d003173a6..d7fddf2f8ee 100644 --- a/gcc/print-rtl.cc +++ b/gcc/print-rtl.cc @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #endif +#define INCLUDE_STRING #include "system.h" #include "coretypes.h" #include "tm.h" diff --git a/gcc/selftest-json.cc b/gcc/selftest-json.cc index e9bfdb46cf3..bc51e78eff7 100644 --- a/gcc/selftest-json.cc +++ b/gcc/selftest-json.cc @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +#define INCLUDE_STRING #include "config.h" #include "system.h" #include "coretypes.h" diff --git a/gcc/timevar.cc b/gcc/timevar.cc index 2b2dd9386af..192db583536 100644 --- a/gcc/timevar.cc +++ b/gcc/timevar.cc @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +#define INCLUDE_STRING #include "config.h" #include "system.h" #include "coretypes.h" -- 2.56.0
