Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#32 Format specifier patch

open
nobody
None
5
2012-05-24
2012-05-24
Jerry James
No

While compiling on a 32-bit platform, I saw some GCC warnings about printf arguments not matching the corresponding format specifiers. This patch fixes all of the warnings I saw on that platform.

Discussion

  • Jerry James
    Jerry James
    2012-05-24

    Format specifier patch

     
    Attachments
  • Sam Steingold
    Sam Steingold
    2012-05-25

    this patch results in these warnings on amd64:

    In file included from ../src/spvw.d:161:0:
    ../src/spvw_debug.d: In function ‘nobject_out1’:
    ../src/spvw_debug.d:123:5: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uintWL’ [-Wformat]
    ../src/spvw_debug.d:124:5: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uintL’ [-Wformat]
    ../src/spvw_debug.d:188:13: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uintL’ [-Wformat]
    ../src/spvw_debug.d:188:13: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat]
    ../src/spvw_debug.d:188:13: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘unsigned int’ [-Wformat]
    ../src/spvw_debug.d:284:5: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat]
    ../src/spvw_debug.d:289:13: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘int’ [-Wformat]
    ../src/spvw_debug.d:289:13: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘int’ [-Wformat]
    ../src/spvw_debug.d:289:13: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 7 has type ‘long unsigned int’ [-Wformat]
    ../src/spvw_debug.d: In function ‘bt_out’:
    ../src/spvw_debug.d:362:11: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uintL’ [-Wformat]
    ../src/spvw_debug.d:371:13: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat]
    In file included from ../src/spvw.d:3996:0:
    ../src/spvw_memfile.d: In function ‘loadmem_from_handle’:
    ../src/spvw_memfile.d:1820:5: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uintL’ [-Wformat]
    In file included from ../src/error.d:502:0:
    ../src/errunix.d: In function ‘errno_out_low’:
    ../src/errunix.d:97:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uintL’ [-Wformat]

     
  • Jerry James
    Jerry James
    2012-09-27

    Format specifier patch v2

     
    Attachments
  • Jerry James
    Jerry James
    2012-09-27

    I have attached a second version of the patch. With this version, I see no format specifier warnings on either 32-bit or 64-bit x86. On the other hand, this patch is uglier than my first attempt. :-(