On Wed, 7 Dec 2022 21:25:11 GMT, Xue-Lei Andrew Fan <[email protected]> wrote:

>> Hi,
>> 
>> May I have this update reviewed?
>> 
>> The sprintf is deprecated in Xcode 14 because of security concerns, and the 
>> use of it causing building failure.  The build could pass if warnings are 
>> disabled for codes that use sprintf method.  For the long run, the sprintf 
>> could be replaced with snprintf.  This patch is trying to check if snprintf 
>> could be used.
>> 
>> Thanks,
>> Xuelei
>
> Xue-Lei Andrew Fan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   update on review feedback

Looks good.  A couple of minor nits that you can address or not.

src/hotspot/share/adlc/formssel.cpp line 28:

> 26: #include "adlc.hpp"
> 27: 
> 28: #define remaining_buflen(buffer, position) (sizeof(buffer) - (position - 
> buffer))

Consider additional parenthesis, e.g. `((position) - (buffer))`.

src/hotspot/share/adlc/formssel.cpp line 1538:

> 1536:       }
> 1537:       // Add predicate to working buffer
> 1538:       snprintf_checked(s, remaining_buflen(buf, s), 
> "/*%s*/(",(char*)i._key);

[pre-existing] the result from this snprintf could be used instead of strlen in 
the next line.

src/hotspot/share/adlc/output_c.cpp line 546:

> 544:     char* args = new char [36 + 1];
> 545: 
> 546:     snprintf_checked(args, 37, "0x%x, 0x%x, %u",

Instead of 37, consider `36 + 1` to be clearly from the line above.  Or give 
that value a name.

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

Marked as reviewed by kbarrett (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11115

Reply via email to