Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 719790 - app-admin/procinfo-ng-2.0.304-r1 -- clang: ./lib/timeRoutines.cpp:134:38: error: non-constant-expression cannot be narrowed from type 'uint32_t' (aka 'unsigned int') to 'int' in initializer list [-Wc++11-narrowing]
Summary: app-admin/procinfo-ng-2.0.304-r1 -- clang: ./lib/timeRoutines.cpp:134:38: err...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Shell Tools project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-27 11:57 UTC by Frederik Pfautsch
Modified: 2022-11-10 05:10 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Compile log procinfo (app-admin:procinfo-ng-2.0.304-r1:20200427-112022.log,16.63 KB, text/x-log)
2020-04-27 11:57 UTC, Frederik Pfautsch
Details
emerge info (emerge.info,5.75 KB, application/x-info)
2020-04-27 11:58 UTC, Frederik Pfautsch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frederik Pfautsch 2020-04-27 11:57:59 UTC
Created attachment 634848 [details]
Compile log procinfo

From the compile log:

<...>
./lib/timeRoutines.cpp:134:38: error: non-constant-expression cannot be narrowed from type 'uint32_t' (aka 'unsigned int') to 'int' in initializer list [-Wc++11-narrowing]
                { tm_sec: result1.seconds, tm_min: result1.minutes, tm_hour: result1.hours,
                                                   ^~~~~~~~~~~~~~~
./lib/timeRoutines.cpp:134:38: note: insert an explicit cast to silence this issue
                { tm_sec: result1.seconds, tm_min: result1.minutes, tm_hour: result1.hours,
                                                   ^~~~~~~~~~~~~~~
                                                   static_cast<int>( )
./lib/timeRoutines.cpp:134:64: error: non-constant-expression cannot be narrowed from type 'uint32_t' (aka 'unsigned int') to 'int' in initializer list [-Wc++11-narrowing]
                { tm_sec: result1.seconds, tm_min: result1.minutes, tm_hour: result1.hours,
                                                                             ^~~~~~~~~~~~~
./lib/timeRoutines.cpp:134:64: note: insert an explicit cast to silence this issue
                { tm_sec: result1.seconds, tm_min: result1.minutes, tm_hour: result1.hours,
                                                                             ^~~~~~~~~~~~~
                                                                             static_cast<int>( )
./lib/timeRoutines.cpp:135:12: error: non-constant-expression cannot be narrowed from type 'uint32_t' (aka 'unsigned int') to 'int' in initializer list [-Wc++11-narrowing]
                tm_wday: result1.days, tm_week: result1.weeks };
                         ^~~~~~~~~~~~
./lib/timeRoutines.cpp:135:12: note: insert an explicit cast to silence this issue
                tm_wday: result1.days, tm_week: result1.weeks };
                         ^~~~~~~~~~~~
                         static_cast<int>( )
./lib/timeRoutines.cpp:135:35: error: non-constant-expression cannot be narrowed from type 'uint32_t' (aka 'unsigned int') to 'int' in initializer list [-Wc++11-narrowing]
                tm_wday: result1.days, tm_week: result1.weeks };
<...>

Builds fine when using gcc instead of clang.

clang --version:
clang version 9.0.1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/9/bin

gcc --version:
gcc (Gentoo 9.2.0-r2 p3) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
Comment 1 Frederik Pfautsch 2020-04-27 11:58:44 UTC
Created attachment 634850 [details]
emerge info
Comment 2 Larry the Git Cow gentoo-dev 2022-11-10 05:10:37 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a4ae230be03c2f8ab6ed0e2d53f431d5bd649dbb

commit a4ae230be03c2f8ab6ed0e2d53f431d5bd649dbb
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-11-10 04:57:16 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-11-10 05:09:21 +0000

    app-admin/procinfo-ng: fix build w/ clang, -Wformat-security
    
    It's a lazy fix but upstream is dead and surprisingly other
    distros still package this. Fix -Wformat-security while at it.
    
    Closes: https://bugs.gentoo.org/719790
    Signed-off-by: Sam James <sam@gentoo.org>

 .../files/procinfo-ng-2.0.304-wformat-security.patch    | 11 +++++++++++
 ...-2.0.304-r1.ebuild => procinfo-ng-2.0.304-r2.ebuild} | 17 +++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)