aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog6
-rw-r--r--libcpp/errors.cc10
-rw-r--r--libcpp/include/cpplib.h2
-rw-r--r--libcpp/lex.cc5
4 files changed, 21 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 353227a..775b000 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,9 @@
+2025-04-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/110343
+ * lex.cc (lex_raw_string): For C allow $@` in raw string delimiters
+ if CPP_OPTION (pfile, low_ucns) i.e. for C23 and later.
+
2025-04-09 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/118674
diff --git a/libcpp/errors.cc b/libcpp/errors.cc
index 9621c4b..d9efb6a 100644
--- a/libcpp/errors.cc
+++ b/libcpp/errors.cc
@@ -52,6 +52,16 @@ cpp_diagnostic_get_current_location (cpp_reader *pfile)
}
}
+/* Sometimes a diagnostic needs to be generated before libcpp has been able
+ to generate a valid location for the current token; in that case, the
+ non-zero location returned by this function is the preferred one to use. */
+
+location_t
+cpp_get_diagnostic_override_loc (const cpp_reader *pfile)
+{
+ return pfile->diagnostic_override_loc;
+}
+
/* Print a diagnostic at the given location. */
ATTRIBUTE_CPP_PPDIAG (5, 0)
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 3bf33ab..7c147ae 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -1169,6 +1169,8 @@ extern const char *cpp_probe_header_unit (cpp_reader *, const char *file,
extern const char *cpp_get_narrow_charset_name (cpp_reader *) ATTRIBUTE_PURE;
extern const char *cpp_get_wide_charset_name (cpp_reader *) ATTRIBUTE_PURE;
+extern location_t cpp_get_diagnostic_override_loc (const cpp_reader *);
+
/* This function reads the file, but does not start preprocessing. It
returns the name of the original file; this is the same as the
input file, except for preprocessed input. This will generate at
diff --git a/libcpp/lex.cc b/libcpp/lex.cc
index 2d02ce6..e7705a6 100644
--- a/libcpp/lex.cc
+++ b/libcpp/lex.cc
@@ -2711,8 +2711,9 @@ lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
|| c == '!' || c == '=' || c == ','
|| c == '"' || c == '\''
|| ((c == '$' || c == '@' || c == '`')
- && CPP_OPTION (pfile, cplusplus)
- && CPP_OPTION (pfile, lang) > CLK_CXX23)))
+ && (CPP_OPTION (pfile, cplusplus)
+ ? CPP_OPTION (pfile, lang) > CLK_CXX23
+ : CPP_OPTION (pfile, low_ucns)))))
prefix[prefix_len++] = c;
else
{