Integrated: 8297963: Partially fix string expansion issues in UTIL_DEFUN_NAMED and related macros

Julian Waters jwaters at openjdk.org
Tue Dec 6 08:46:52 UTC 2022


On Thu, 1 Dec 2022 16:15:51 GMT, Julian Waters <jwaters at openjdk.org> wrote:

> The UTIL macros have several problematic flaws that may not seem apparent initially, the worst of which include parsing commas as actual argument separators to the underlying m4 macros, and completely, but very subtly wrecking shell constructs. I've done my best here to fix some of these issues in this commit, so others don't end up suffering like I did while I was trying to implement [8296478](https://github.com/openjdk/jdk/pull/11020). Most notably, DESC and CHECKING_MSG should now function correctly when a comma is included as part of their description strings (Other named arguments do not yet have this fix implemented, it was simply far too tedious, but it should be straightforward after this commit to fix those as well). I've also fixed several bugs that seem to have flown under the radar (Such as UTIL_DEFUN_NAMED always adding an extra space in between the parameter name and actual value, even if not required). Majority of the fix involved UTIL_DEFUN_NAMED, however while it n
 ow properly passes along arguments it receives to macros that use it to implement their logic, the latter still need to be mindful of macro expansions inside their _own_ body
> 
> 
> 
> A couple of limitations from the original implementation still remain: You still cannot have the parameter specifier inside its own block, for instance IF_GIVEN: [IF_GIVEN: []] would not work properly (IF_GIVEN: [IF_GIVEN []] without the colon in the inner string will, however). Additionally, if a space is not given in between the parameter and its value (Eg DEFAULT:[] instead of the usual DEFAULT: []) the processing that UTIL_DEFUN_NAMED performs to correct this problem will still interfere with shell code that relies on the : token. Unfortunately, despite my best efforts I was unable to properly resolve these last 2 limitations

This pull request has now been integrated.

Changeset: f8f46305
Author:    Julian Waters <jwaters at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/f8f46305ef0d1c12154075c7a7d4dc75f91529b5
Stats:     29 lines in 2 files changed: 5 ins; 0 del; 24 mod

8297963: Partially fix string expansion issues in UTIL_DEFUN_NAMED and related macros

Reviewed-by: ihse

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

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



More information about the build-dev mailing list