aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-06-17 14:34:20 +0000
committerGitHub <noreply@github.com>2022-06-17 14:34:20 +0000
commitb711799e3eb450463a9f3be3b082b3ced9356358 (patch)
tree787da1ff11b1a7e557670b1162f27d13746d43ad /gcc
parent76f7e45179de4e6e53caab104022cc0784ecd618 (diff)
parent747700e045c3bf3f3d84b04f6799886f067704ae (diff)
downloadgcc-b711799e3eb450463a9f3be3b082b3ced9356358.zip
gcc-b711799e3eb450463a9f3be3b082b3ced9356358.tar.gz
gcc-b711799e3eb450463a9f3be3b082b3ced9356358.tar.bz2
Merge #1322
1322: Fixes #1263; diagnostics/feature/wrapper r=CohenArthur a=ndrwnaguib * wrapping GCC's diagnostics `sorry_at` with a new rust macro named `rust_sorry_at` which accepts `Location` instead of the default `location_t`. * refactoring previous usage of `sorry_at` to `rust_sorry_at` Fixes #1263 Co-authored-by: andrewnaguib <24280372+ndrwnaguib@users.noreply.github.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/backend/rust-compile-expr.cc4
-rw-r--r--gcc/rust/backend/rust-compile-pattern.cc3
-rw-r--r--gcc/rust/privacy/rust-privacy-reporter.cc3
-rw-r--r--gcc/rust/rust-diagnostics.h5
4 files changed, 9 insertions, 6 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index b153451..d12dc78 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -239,8 +239,8 @@ CompileExpr::visit (HIR::MatchExpr &expr)
{
// FIXME: CASE_LABEL_EXPR does not support floating point types.
// Find another way to compile these.
- sorry_at (expr.get_locus ().gcc_location (),
- "match on floating-point types is not yet supported");
+ rust_sorry_at (expr.get_locus (),
+ "match on floating-point types is not yet supported");
}
TyTy::BaseType *expr_tyty = nullptr;
diff --git a/gcc/rust/backend/rust-compile-pattern.cc b/gcc/rust/backend/rust-compile-pattern.cc
index 2f3449a..7e7fadd 100644
--- a/gcc/rust/backend/rust-compile-pattern.cc
+++ b/gcc/rust/backend/rust-compile-pattern.cc
@@ -96,8 +96,7 @@ CompilePatternCaseLabelExpr::visit (HIR::LiteralPattern &pattern)
// floating point types.
if (pattern.get_literal ().get_lit_type () == HIR::Literal::LitType::FLOAT)
{
- sorry_at (pattern.get_locus ().gcc_location (),
- "floating-point literal in pattern");
+ rust_sorry_at (pattern.get_locus (), "floating-point literal in pattern");
}
tree lit = CompileExpr::Compile (litexpr, ctx);
diff --git a/gcc/rust/privacy/rust-privacy-reporter.cc b/gcc/rust/privacy/rust-privacy-reporter.cc
index 4b010a0..f2752b6 100644
--- a/gcc/rust/privacy/rust-privacy-reporter.cc
+++ b/gcc/rust/privacy/rust-privacy-reporter.cc
@@ -164,8 +164,7 @@ PrivacyReporter::check_base_type_privacy (Analysis::NodeMapping &node_mappings,
return recursive_check (
static_cast<const TyTy::ProjectionType *> (ty)->get ());
case TyTy::CLOSURE:
- sorry_at (locus.gcc_location (),
- "privacy pass for closures is not handled yet");
+ rust_sorry_at (locus, "privacy pass for closures is not handled yet");
break;
// If we're dealing with a generic param, there's nothing we should be
diff --git a/gcc/rust/rust-diagnostics.h b/gcc/rust/rust-diagnostics.h
index f7a3856..93bd1b3 100644
--- a/gcc/rust/rust-diagnostics.h
+++ b/gcc/rust/rust-diagnostics.h
@@ -142,6 +142,11 @@ struct Error
// rust_debug uses normal printf formatting, not GCC diagnostic formatting.
#define rust_debug(...) rust_debug_loc (Location (), __VA_ARGS__)
+// rust_sorry_at wraps GCC diagnostic "sorry_at" to accept "Location" instead of
+// "location_t"
+#define rust_sorry_at(location, ...) \
+ sorry_at (location.gcc_location (), __VA_ARGS__)
+
void
rust_debug_loc (const Location location, const char *fmt,
...) ATTRIBUTE_PRINTF_2;