[Bug rust/117762] New: libgrust/libproc_macro_internal/tokenstream.cc: 3 * performance issues ?

2024-11-24 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117762

Bug ID: 117762
   Summary: libgrust/libproc_macro_internal/tokenstream.cc: 3 *
performance issues ?
   Product: gcc
   Version: 15.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rust
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dcb314 at hotmail dot com
CC: dkm at gcc dot gnu.org, gcc-rust at gcc dot gnu.org,
pierre-emmanuel.patry at embecosm dot com
  Target Milestone: ---

Static analyser cppcheck says:

trunk/libgrust/libproc_macro_internal/tokenstream.cc:32:55: performance:
Function parameter 'vec' should be passed by const reference. [passedByValue]
trunk/libgrust/libproc_macro_internal/tokenstream.cc:35:13: performance: Range
variable 'tt' should be declared as const reference. [iterateByValue]
trunk/libgrust/libproc_macro_internal/tokenstream.cc:67:30: performance:
Function parameter 'tree' should be passed by const reference. [passedByValue]

Might be worth fixing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug rust/117762] libgrust/libproc_macro_internal/tokenstream.cc: 3 * performance issues ?

2024-11-24 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117762

--- Comment #1 from David Binderman  ---
Five more little problems in libgrust:

trunk/libgrust/libproc_macro_internal/group.cc:28:32: performance: Function
parameter 'stream' should be passed by const reference. [passedByValue]
trunk/libgrust/libproc_macro_internal/ident.cc:62:32: performance: Function
parameter 'str' should be passed by const reference. [passedByValue]
trunk/libgrust/libproc_macro_internal/tokentree.cc:28:34: performance: Function
parameter 'group' should be passed by const reference. [passedByValue]
trunk/libgrust/libproc_macro_internal/tokentree.cc:36:34: performance: Function
parameter 'ident' should be passed by const reference. [passedByValue]
trunk/libgrust/libproc_macro_internal/tokentree.cc:52:36: performance: Function
parameter 'literal' should be passed by const reference. [passedByValue]

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug rust/108111] New: Rust meets clang

2022-12-14 Thread dcb314 at hotmail dot com via Gcc-rust
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108111

Bug ID: 108111
   Summary: Rust meets clang
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rust
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dcb314 at hotmail dot com
CC: dkm at gcc dot gnu.org, gcc-rust at gcc dot gnu.org
  Target Milestone: ---

Since the new Rust code landed in gcc, I thought I'd give it 
compile with clang. The following 14 warning messages were produced:

./../trunk.d1/gcc/rust/ast/rust-item.h:2186:23: warning: 'as_string' overrides
a member function but is not marked 'override'
[-Winconsistent-missing-override]
../../trunk.d1/gcc/rust/ast/rust-item.h:2189:16: warning: 'accept_vis'
overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
../../trunk.d1/gcc/rust/ast/rust-item.h:2191:12: warning: 'get_locus' overrides
a member function but is not marked 'override'
[-Winconsistent-missing-override]
../../trunk.d1/gcc/rust/ast/rust-item.h:2196:8: warning: 'mark_for_strip'
overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
../../trunk.d1/gcc/rust/ast/rust-item.h:2197:8: warning: 'is_marked_for_strip'
overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
../../trunk.d1/gcc/rust/ast/rust-pattern.h:894:12: warning: 'get_locus'
overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
../../trunk.d1/gcc/rust/hir/tree/rust-hir-type.h:35:8: warning: private field
'in_parens' is not used [-Wunused-private-field]
../../trunk.d1/gcc/rust/lex/rust-lex.h:156:10: warning: explicitly defaulted
move assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
../../trunk.d1/gcc/rust/parse/rust-parse-impl.h:14918:23: warning: operator
'?:' has lower precedence than '<<'; '<<' will be evaluated first
[-Wparentheses]
../../trunk.d1/gcc/rust/typecheck/rust-substitution-mapper.h:332:19: warning:
private field 'concrete' is not used [-Wunused-private-field]
../../trunk.d1/gcc/rust/typecheck/rust-tyty-call.h:140:31: warning: private
field 'context' is not used [-Wunused-private-field]
../../trunk.d1/gcc/rust/typecheck/rust-tyty-call.h:83:31: warning: private
field 'context' is not used [-Wunused-private-field]
/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:181:4:
warning: destructor called on non-final 'Rust::TyTy::TypeBoundPredicate' that
has virtual functions but non-virtual destructor
[-Wdelete-non-abstract-non-virtual-dtor]
/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_construct.h:151:7:
warning: destructor called on non-final 'Rust::TyTy::TypeBoundPredicate' that
has virtual functions but non-virtual destructor
[-Wdelete-non-abstract-non-virtual-dtor]

Some, all or none of these might be worth fixing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-- 
Gcc-rust mailing list
Gcc-rust@gcc.gnu.org
https://gcc.gnu.org/mailman/listinfo/gcc-rust


[Bug rust/108126] New: rust meets cppcheck

2022-12-15 Thread dcb314 at hotmail dot com via Gcc-rust
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108126

Bug ID: 108126
   Summary: rust meets cppcheck
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rust
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dcb314 at hotmail dot com
CC: dkm at gcc dot gnu.org, gcc-rust at gcc dot gnu.org
  Target Milestone: ---

I just ran the C/C++ static analyser over the new source code of rust.

First the errors:

trunk.d1/gcc/rust/ast/rust-cond-compilation.h:228:65: error: Member variable
'cfg_attrs' is initialized by itself. [selfInitialization]
trunk.d1/gcc/rust/typecheck/rust-tyty.h:1635:46: error: Reference to local
variable returned. [returnReference]
trunk.d1/gcc/rust/typecheck/rust-tyty.h:1636:58: error: Reference to local
variable returned. [returnReference]
trunk.d1/gcc/rust/typecheck/rust-tyty.h:558:58: error: Reference to local
variable returned. [returnReference]
trunk.d1/gcc/rust/util/rust-optional.h:157:12: error: Reference to local
variable returned. [returnReference]

Next, the warnings:

trunk.d1/gcc/rust/parse/rust-parse-impl.h:12423:21: warning: Access of moved
variable 'outer_attrs'. [accessMoved]
trunk.d1/gcc/rust/typecheck/rust-tyty-rules.h:394:7: warning: Class 'BaseRules'
does not have a copy constructor which is recommended since it has dynamic
memory/resource allocation(s). [noCopyConstructor]
trunk.d1/gcc/rust/typecheck/rust-tyty-rules.h:394:7: warning: Class 'BaseRules'
does not have a operator= which is recommended since it has dynamic
memory/resource allocation(s). [noOperatorEq]
trunk.d1/gcc/rust/typecheck/rust-substitution-mapper.h:146:7: warning: Class
'SubstMapper' does not have a copy constructor which is recommended since it
has dynamic memory/resource allocation(s). [noCopyConstructor]
trunk.d1/gcc/rust/typecheck/rust-substitution-mapper.h:146:7: warning: Class
'SubstMapper' does not have a operator= which is recommended since it has
dynamic memory/resource allocation(s). [noOperatorEq]
trunk.d1/gcc/rust/typecheck/rust-substitution-mapper.h:261:7: warning: Class
'SubstMapperInternal' does not have a copy constructor which is recommended
since it has dynamic memory/resource allocation(s). [noCopyConstructor]
trunk.d1/gcc/rust/typecheck/rust-substitution-mapper.h:261:7: warning: Class
'SubstMapperInternal' does not have a operator= which is recommended since it
has dynamic memory/resource allocation(s). [noOperatorEq]
trunk.d1/gcc/rust/typecheck/rust-tyty-call.h:75:7: warning: Class
'TypeCheckCallExpr' does not have a copy constructor which is recommended since
it has dynamic memory/resource allocation(s). [noCopyConstructor]
trunk.d1/gcc/rust/typecheck/rust-tyty-call.h:75:7: warning: Class
'TypeCheckCallExpr' does not have a operator= which is recommended since it has
dynamic memory/resource allocation(s). [noOperatorEq]
trunk.d1/gcc/rust/typecheck/rust-hir-type-check-struct.cc:29:5: warning: Class
'TypeCheckStructExpr' does not have a copy constructor which is recommended
since it has dynamic memory/resource allocation(s). [noCopyConstructor]
trunk.d1/gcc/rust/typecheck/rust-hir-type-check-struct.cc:29:5: warning: Class
'TypeCheckStructExpr' does not have a operator= which is recommended since it
has dynamic memory/resource allocation(s). [noOperatorEq]
trunk.d1/gcc/rust/typecheck/rust-tyty.h:664:9: warning: Either the condition
'argument!=nullptr' is redundant or there is possible null pointer dereference:
argument. [nullPointerRedundantCheck]
trunk.d1/gcc/rust/typecheck/rust-tyty.h:740:29: warning: Either the condition
'index>mappings.size()' is redundant or 'index' can have the value
mappings.size(). Expression 'mappings.at(index)' cause access out of bounds.
[containerOutOfBounds]
trunk.d1/gcc/rust/expand/rust-macro-substitute-ctx.cc:77:25: warning: Either
the condition 'it==fragments.end()' is redundant or there is possible
dereference of an invalid iterator: it. [derefInvalidIteratorRedundantCheck]
trunk.d1/gcc/rust/backend/rust-tree.cc:155:5: warning: Label 'CASE_CONVERT' is
not used. Should this be a 'case' of the enclosing switch()?
[unusedLabelSwitch]
trunk.d1/gcc/rust/backend/rust-tree.cc:45:5: warning: Label 'CASE_CONVERT' is
not used. Should this be a 'case' of the enclosing switch()?
[unusedLabelSwitch]
trunk.d1/gcc/rust/ast/rust-expr.h:1853:3: warning: Member variable
'CallExpr::fndeclRef' is not initialized in the constructor. [uninitMemberVar]
trunk.d1/gcc/rust/ast/rust-expr.h:1862:3: warning: Member variable
'CallExpr::fndeclRef' is not initialized in the copy constructor.
[uninitMemberVar]
trunk.d1/gcc/rust/util/rust-canonical-path.h:51:18: warning: Member variable
'Canonical