public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] gccrs: fix some clang warnings
@ 2023-03-14 11:44 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-03-14 11:44 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2c1e7b55dab5564f92d890c4953f9fd387bb30d7
commit 2c1e7b55dab5564f92d890c4953f9fd387bb30d7
Author: Marc Poulhiès <dkm@kataplop.net>
Date: Sat Dec 17 16:23:05 2022 +0100
gccrs: fix some clang warnings
This fixes some extra warnings reported by clang.
gcc/rust/ChangeLog:
PR rust/108111
* ast/rust-ast-full-decls.h (StructPatternElements): Declare as a
class.
* ast/rust-item.h (EnumItem): Mark several method as being
overrides.
* ast/rust-pattern.h (StructPattern::get_locus): Add override.
* lex/rust-lex.h (BufferInputSource): Use reference_wrapper
instead of bare reference.
(TokenSource::get): Add method to implement the reference_wrapper
interface.
* typecheck/rust-tyty.h (TypeBoundPredicate): Add empty dtor.
* util/rust-buffered-queue.h (peek): Source token stream is now
using a reference_wrapper, use .get()
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Diff:
---
gcc/rust/ast/rust-ast-full-decls.h | 2 +-
gcc/rust/ast/rust-item.h | 10 +++++-----
gcc/rust/ast/rust-pattern.h | 2 +-
gcc/rust/lex/rust-lex.h | 5 ++++-
gcc/rust/typecheck/rust-tyty.h | 2 ++
gcc/rust/util/rust-buffered-queue.h | 2 +-
6 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/gcc/rust/ast/rust-ast-full-decls.h b/gcc/rust/ast/rust-ast-full-decls.h
index eafc82f4820..fee174b5cf6 100644
--- a/gcc/rust/ast/rust-ast-full-decls.h
+++ b/gcc/rust/ast/rust-ast-full-decls.h
@@ -240,7 +240,7 @@ class StructPatternField;
class StructPatternFieldTuplePat;
class StructPatternFieldIdentPat;
class StructPatternFieldIdent;
-struct StructPatternElements;
+class StructPatternElements;
class StructPattern;
class TupleStructItems;
class TupleStructItemsNoRange;
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h
index 065ca1ed58a..2646c526503 100644
--- a/gcc/rust/ast/rust-item.h
+++ b/gcc/rust/ast/rust-item.h
@@ -2210,18 +2210,18 @@ public:
return std::unique_ptr<EnumItem> (clone_item_impl ());
}
- virtual std::string as_string () const;
+ virtual std::string as_string () const override;
// not pure virtual as not abstract
- virtual void accept_vis (ASTVisitor &vis);
+ virtual void accept_vis (ASTVisitor &vis) override;
- Location get_locus () const { return locus; }
+ Location get_locus () const override { return locus; }
Identifier get_identifier () const { return variant_name; }
// Based on idea that name is never empty.
- void mark_for_strip () { variant_name = ""; }
- bool is_marked_for_strip () const { return variant_name.empty (); }
+ void mark_for_strip () override { variant_name = ""; }
+ bool is_marked_for_strip () const override { return variant_name.empty (); }
protected:
EnumItem *clone_item_impl () const override { return new EnumItem (*this); }
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h
index 0cc84252640..079c7a9eae4 100644
--- a/gcc/rust/ast/rust-pattern.h
+++ b/gcc/rust/ast/rust-pattern.h
@@ -919,7 +919,7 @@ public:
* is empty). */
bool has_struct_pattern_elems () const { return !elems.is_empty (); }
- Location get_locus () const { return path.get_locus (); }
+ Location get_locus () const override { return path.get_locus (); }
void accept_vis (ASTVisitor &vis) override;
diff --git a/gcc/rust/lex/rust-lex.h b/gcc/rust/lex/rust-lex.h
index 50424713df9..14008397154 100644
--- a/gcc/rust/lex/rust-lex.h
+++ b/gcc/rust/lex/rust-lex.h
@@ -277,7 +277,7 @@ private:
// InputSource input_source;
// Input file queue.
std::unique_ptr<InputSource> raw_input_source;
- buffered_queue<int, InputSource &> input_queue;
+ buffered_queue<int, std::reference_wrapper<InputSource>> input_queue;
// Token source wrapper thing.
struct TokenSource
@@ -288,6 +288,9 @@ private:
// Create a new TokenSource with given lexer.
TokenSource (Lexer *parLexer) : lexer (parLexer) {}
+ // Used to mimic std::reference_wrapper that is used for InputSource.
+ TokenSource &get () { return *this; }
+
// Overload operator () to build token in lexer.
TokenPtr next () { return lexer->build_token (); }
};
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index b729437f73d..7cd8673ea73 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -387,6 +387,8 @@ public:
TypeBoundPredicate (const TypeBoundPredicate &other);
+ virtual ~TypeBoundPredicate (){};
+
TypeBoundPredicate &operator= (const TypeBoundPredicate &other);
static TypeBoundPredicate error ();
diff --git a/gcc/rust/util/rust-buffered-queue.h b/gcc/rust/util/rust-buffered-queue.h
index 20dd768ced3..c3c30c664c0 100644
--- a/gcc/rust/util/rust-buffered-queue.h
+++ b/gcc/rust/util/rust-buffered-queue.h
@@ -102,7 +102,7 @@ public:
/* iterate through buffer and invoke operator () on source on values
* past original end */
for (int i = 0; i < num_items_to_read; i++)
- buffer[end + i] = source.next ();
+ buffer[end + i] = source.get ().next ();
// move end based on additional items added
end += num_items_to_read;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-14 11:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 11:44 [gcc/devel/rust/master] gccrs: fix some clang warnings Thomas Schwinge
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).