Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

printf format string vs data type mismatches #2

Closed
skliper opened this issue Jun 24, 2019 · 2 comments
Closed

printf format string vs data type mismatches #2

skliper opened this issue Jun 24, 2019 · 2 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Jun 24, 2019

We have some lingering mismatches between printf format string conversions and the parameter data types; all but one of them are in elf2cfetbl so pinning this bug on elf2cfetbl (will fix cmdUtil in passing):

tools/cmdUtil/cmdUtil.c:229:9: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:710:25: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:798:25: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1004:5: warning: format '%X' expects argument of type 'unsigned int', but argument 3 has type 'time_t' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1192:5: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1227:9: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1235:9: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1243:9: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1273:17: warning: format '%d' expects argument of type 'int', but argument 3 has type 'int32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1361:9: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1389:9: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1397:9: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1403:5: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1430:5: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1596:13: warning: format '%d' expects argument of type 'int', but argument 2 has type 'uint32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1596:13: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1619:9: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1647:70: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1647:70: warning: format '%d' expects argument of type 'int', but argument 3 has type 'char *' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1655:9: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1655:9: warning: format '%d' expects argument of type 'int', but argument 3 has type 'int32' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1670:9: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
tools/elf2cfetbl/elf2cfetbl.c:1707:28: warning: format '%d' expects argument of type 'int', but argument 4 has type 'uint32' [-Wformat=]
Attachments (0)

@skliper skliper added this to the 3.1.0 milestone Jun 24, 2019
@skliper skliper added good first issue Good for newcomers enhancement New feature or request labels Jun 24, 2019
@skliper skliper removed this from the 3.1.0 milestone Sep 16, 2019
@avan989
Copy link
Contributor

avan989 commented Sep 23, 2019

error no longer when elf2cfetbl is built:

make --no-print-directory -C "build" mission-all
Scanning dependencies of target elf2cfetbl
[ 50%] Building C object tools/elf2cfetbl/CMakeFiles/elf2cfetbl.dir/elf2cfetbl.c.o
[100%] Linking C executable elf2cfetbl
[100%] Built target elf2cfetbl
Scanning dependencies of target mission-version
[100%] Built target mission-version
Scanning dependencies of target mission-prebuild
[100%] Built target mission-prebuild
Scanning dependencies of target cpu1-all
Scanning dependencies of target osal
[  1%] Building C object osal/CMakeFiles/osal.dir/src/os/shared/osapi-binsem.c.o
[  2%] Building C object osal/CMakeFiles/osal.dir/src/os/shared/osapi-clock.c.o

@skliper
Copy link
Contributor Author

skliper commented Sep 23, 2019

Standard build doesn't turn on all warnings by default currently (see nasa/cFE#24). Suggest building with "-Wall –std=c99 –pedantic –Wstrict-prototypes –Wwrite-strings" as specified by that issue.

skliper added a commit that referenced this issue Oct 2, 2019
Fix #2, fix long string mismatch
skliper added a commit that referenced this issue Oct 2, 2019
Reviewed and approved at 2019-09-25 CCB
skliper added a commit that referenced this issue Oct 2, 2019
Print format change and classic build support removal
@skliper skliper closed this as completed in b8a84ae Oct 2, 2019
@skliper skliper added this to the 3.2.0 milestone Oct 2, 2019
@astrogeco astrogeco added bug Something isn't working and removed enhancement New feature or request labels Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants