seL4 / seL4_libs

No-assurance libraries for rapid-prototyping of seL4 apps.
https://docs.sel4.systems
Other
52 stars 62 forks source link

libsel4allocman: fix clang warnings for printing #86

Closed axel-h closed 4 months ago

axel-h commented 7 months ago

Clang does a few more checks than gcc for the prinf() parameters and raises some warning for 64-bit. See e.g. https://github.com/axel-h/seL4_libs/actions/runs/6975395333/job/18982455268?pr=5

  /github/workspace/projects/seL4_libs/libsel4allocman/src/allocman.c:525:98: warning: format specifies type 'int' but the argument has type 'seL4_Word' (aka 'unsigned long') [-Wformat]
              ZF_LOGE("Failed to set reserve for {type: %d size_bits: %d} as one already exists.", chunk.type, chunk.size_bits);
                                                        ~~                                         ^~~~~~~~~~
                                                        %lu
  /github/workspace/projects/util_libs/libutils/include/utils/zf_log.h:359:43: note: expanded from macro 'ZF_LOGE'
                          _ZF_LOG_IMP(ZF_LOG_ERROR, _ZF_LOG_TAG, __VA_ARGS__)
                                                                 ^~~~~~~~~~~
  /github/workspace/projects/util_libs/libutils/include/utils/zf_log.h:302:18: note: expanded from macro '_ZF_LOG_IMP'
                                                          lvl, tag, __VA_ARGS__); \
                                                                    ^~~~~~~~~~~
  /github/workspace/projects/seL4_libs/libsel4allocman/src/allocman.c:525:110: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
              ZF_LOGE("Failed to set reserve for {type: %d size_bits: %d} as one already exists.", chunk.type, chunk.size_bits);
                                                                      ~~                                       ^~~~~~~~~~~~~~~
                                                                      %zu
  /github/workspace/projects/util_libs/libutils/include/utils/zf_log.h:359:43: note: expanded from macro 'ZF_LOGE'
                          _ZF_LOG_IMP(ZF_LOG_ERROR, _ZF_LOG_TAG, __VA_ARGS__)
                                                                 ^~~~~~~~~~~
  /github/workspace/projects/util_libs/libutils/include/utils/zf_log.h:302:18: note: expanded from macro '_ZF_LOG_IMP'
                                                          lvl, tag, __VA_ARGS__); \
                                                                    ^~~~~~~~~~~
  /github/workspace/projects/seL4_libs/libsel4allocman/src/allocman.c:587:84: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
              ZF_LOGE("Failed to set reserve for {size: %d} as one already exists.", chunk.size);
                                                        ~~                           ^~~~~~~~~~
                                                        %zu
  /github/workspace/projects/util_libs/libutils/include/utils/zf_log.h:359:43: note: expanded from macro 'ZF_LOGE'
                          _ZF_LOG_IMP(ZF_LOG_ERROR, _ZF_LOG_TAG, __VA_ARGS__)
                                                                 ^~~~~~~~~~~
  /github/workspace/projects/util_libs/libutils/include/utils/zf_log.h:302:18: note: expanded from macro '_ZF_LOG_IMP'
                                                          lvl, tag, __VA_ARGS__); \
                                                                    ^~~~~~~~~~~
axel-h commented 4 months ago

Please, can we merge this to get rid of the build warning?