Bug 250133 - tools/tools/ifinfo/ifinfo.c Fixing build
Summary: tools/tools/ifinfo/ifinfo.c Fixing build
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-05 09:10 UTC by Olivier Cochard
Modified: 2020-11-23 16:18 UTC (History)
3 users (show)

See Also:


Attachments
patch to fix build (2.94 KB, patch)
2020-10-05 09:10 UTC, Olivier Cochard
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Cochard freebsd_committer 2020-10-05 09:10:30 UTC
Created attachment 218533 [details]
patch to fix build

Fixing this tool build (tested on amd64 only):
root@netboot-f:/usr/src/tools/tools/ifinfo # make
[Creating objdir /usr/obj/usr/src/amd64.amd64/tools/tools/ifinfo...]
echo ifinfo.full: /usr/lib/libc.a  >> .depend
cc  -O2 -pipe -fno-common   -g -MD  -MF.depend.ifinfo.o -MTifinfo.o -std=gnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable  -Qunused-arguments    -c /usr/src/tools/tools/ifinfo/ifinfo.c -o ifinfo.o
/usr/src/tools/tools/ifinfo/ifinfo.c:175:25: error: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
        printf("\tmtu: %lu\n", ifmd->ifmd_data.ifi_mtu);
                       ~~~     ^~~~~~~~~~~~~~~~~~~~~~~
                       %u
/usr/src/tools/tools/ifinfo/ifinfo.c:176:28: error: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
        printf("\tmetric: %lu\n", ifmd->ifmd_data.ifi_metric);
                          ~~~     ^~~~~~~~~~~~~~~~~~~~~~~~~~
                          %u
/usr/src/tools/tools/ifinfo/ifinfo.c:268:24: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
        if (type <= 0 || type >= NIFTYPES) {
                         ~~~~ ^  ~~~~~~~~
/usr/src/tools/tools/ifinfo/ifinfo.c:277:12: error: unused parameter 'type' [-Werror,-Wunused-parameter]
ifphys(int type, int phys)
           ^
4 errors generated.
*** Error code 1

Stop.
make: stopped in /usr/src/tools/tools/ifinfo
Comment 1 Maxim Konovalov freebsd_committer 2020-11-04 15:01:03 UTC
Hi Oliver,

Whitespace changes are not complete, there is at least one additional tab at the line #86 that should be removed.

It looks like ifphys() function doesn't do anything meaningful.  I'd suggest to remove it and all its traces completely.

All the rest looks sane.

Maxim
Comment 2 Maxim Konovalov freebsd_committer 2020-11-04 15:04:31 UTC
Oops, I misspelled your name, Olivier.  Sorry about that.

Maxim
Comment 3 Olivier Cochard freebsd_committer 2020-11-09 20:27:50 UTC
Improved patch here:
https://reviews.freebsd.org/D27155