Build failure with clang #2

Closed
opened 2 years ago by Ray-V · 5 comments
Ray-V commented 2 years ago
Collaborator
../../../plugins/infowidget/chunkbar.cpp:210:16: error: non-constant-expression cannot be narrowed from type 'bt::Uint32' (aka 'unsigned int') to 'int' in initializer list [-Wc++11-narrowing]
                                Range r = {i,i,0};
                                           ^

Based on the fix for krusader, PR #8, the build completes and ktorrent runs for both gcc and clang builds with this patch.

--- plugins/infowidget/chunkbar.cpp
+++ plugins/infowidget/chunkbar.cpp
@@ -43,5 +43,5 @@
 	struct Range
 	{
-		int first,last;
+		uint first,last;
 		int fac;
 	};

Is this correct and all that's needed?

``` ../../../plugins/infowidget/chunkbar.cpp:210:16: error: non-constant-expression cannot be narrowed from type 'bt::Uint32' (aka 'unsigned int') to 'int' in initializer list [-Wc++11-narrowing] Range r = {i,i,0}; ^ ``` Based on the fix for krusader, PR [#8](https://mirror.git.trinitydesktop.org/gitea/TDE/krusader/issues/8), the build completes and ktorrent runs for both gcc and clang builds with this patch. ```diff --- plugins/infowidget/chunkbar.cpp +++ plugins/infowidget/chunkbar.cpp @@ -43,5 +43,5 @@ struct Range { - int first,last; + uint first,last; int fac; }; ``` Is this correct and all that's needed?
Owner

A bit more work is used. Those elements are used in the same file and after some maths, assigned to int variables. Need to change those accordingly.

A bit more work is used. Those elements are used in the same file and after some maths, assigned to int variables. Need to change those accordingly.
Owner

or rather, since those variables are used in a call to drawRect on a TQPainter which takes int, it would probably be better to leave them as 'int' and explicitly cast from uint to int where needed. It worked so far, I don't expect issues with explicit casting...

or rather, since those variables are used in a call to drawRect on a TQPainter which takes int, it would probably be better to leave them as 'int' and explicitly cast from uint to int where needed. It worked so far, I don't expect issues with explicit casting...
MicheleC referenced this issue from a commit 2 years ago
Owner

@Ray-V could you please test PR #3?

@Ray-V could you please test PR #3?
MicheleC added this to the R14.0.13 release milestone 2 years ago
Ray-V commented 2 years ago
Poster
Collaborator

All ok with gcc or clang.

Just two more clang build failure issues to come - for koffice and tdeutils.

All ok with gcc or clang. Just two more clang build failure issues to come - for koffice and tdeutils.
MicheleC referenced this issue from a commit 2 years ago
Owner

Ok, fix merged.
Re koffice and tdeutils, will try to have a look tomorrow. Very busy week :-(

Ok, fix merged. Re koffice and tdeutils, will try to have a look tomorrow. Very busy week :-(
SlavekB closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/ktorrent#2
Loading…
There is no content yet.