Skip to content

Compiler warning on RTEMS #30

@jphickey

Description

@jphickey

Describe the bug
When compiling on RTEMS this application now has multiple warnings:

/home/joe/code/cfecfs/github/apps/sample_app/fsw/src/sample_app.c: In function 'SAMPLE_AppInit':
/home/joe/code/cfecfs/github/apps/sample_app/fsw/src/sample_app.c:166:30: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int32' [-Werror=format=]
                              status);
                              ^
/home/joe/code/cfecfs/github/apps/sample_app/fsw/src/sample_app.c:187:30: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int32' [-Werror=format=]
                              status);
                              ^
/home/joe/code/cfecfs/github/apps/sample_app/fsw/src/sample_app.c:199:30: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int32' [-Werror=format=]
                              status);
                              ^
/home/joe/code/cfecfs/github/apps/sample_app/fsw/src/sample_app.c:211:30: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int32' [-Werror=format=]
                              status);
                              ^
/home/joe/code/cfecfs/github/apps/sample_app/fsw/src/sample_app.c:226:9: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'int32' [-Werror=format=]
         CFE_ES_WriteToSysLog("Sample App: Error Registering \
         ^
/home/joe/code/cfecfs/github/apps/sample_app/fsw/src/sample_app.c: In function 'SAMPLE_GetCrc':
/home/joe/code/cfecfs/github/apps/sample_app/fsw/src/sample_app.c:535:9: error: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'uint32' [-Werror=format=]
         CFE_ES_WriteToSysLog("Sample App: CRC: 0x%08X\n\n", Crc);
         ^

To Reproduce
Build on RTEMS per the readme/howto and with -Wall -Werror switches

Expected behavior
Should build clean

System observed on:
Ubuntu 18.04 (build host) when cross compiling for RTEMS 4.11

Additional context
Appears the problem calls were introduced in #1

As a rule of thumb, whenever "printf" style conversions are used in conjunction with the fixed-width types (int32, uint32, etc) these need an explicit cast because the actual type definitions vary by platform.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions