RFR: 8256379: Replace SIZE_FORMAT with 'z' length modifier

Coleen Phillimore coleenp at openjdk.org
Thu Aug 3 19:13:38 UTC 2023


On Wed, 2 Aug 2023 01:31:43 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> Replace SIZE_FORMAT with %zu and SIZE_FORMAT_X with 0x%zx using a 4 line sed script:
> 
>   sed -e 's/" SIZE_FORMAT "/%zu/g' -e 's/" SIZE_FORMAT,/%zu",/' \
>       -e 's/print(SIZE_FORMAT "/print("%zu/g' \
>       -e 's/" SIZE_FORMAT_X "/0x%zx/g' -e 's/" SIZE_FORMAT_X,/0x%zx",/g' \
>       -e 's/" SIZE_FORMAT$/%zu"/' \
>        $f >$f.new
> 
> Minor fixups afterwards.  I didn't change SIZE_FORMAT_W(number) because it would have required a better sed script.
> 
> The definitions in globalDefinitions.hpp can be removed with a later PR, once all instances are cleaned out.  This is partial so that people start using %zu instead.
> 
> Tested with tier1 on Oracle supported platforms.

The %zu format looks much nicer than " SIZE_FORMAT " but I don't think we should do this either.  We can start using them with new code, or code we modify.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15115#issuecomment-1664492414


More information about the serviceability-dev mailing list