Add TEST_COMPARE_STRING_WIDE to support/check.h

Florian Weimer fw@deneb.enyo.de
Tue Oct 12 06:15:37 GMT 2021


* Joseph Myers:

> I'd like to be able to test narrow and wide string interfaces, with
> the narrow string tests using TEST_COMPARE_STRING and the wide string
> tests using something analogous (possibly generated using macros from
> a common test template for both the narrow and wide string tests where
> appropriate).
>
> Add such a TEST_COMPARE_STRING_WIDE, along with functions
> support_quote_blob_wide and support_test_compare_string_wide that it
> builds on.  Those functions are built using macros from common
> templates shared by the narrow and wide string implementations, though
> I didn't do that for the tests of test functions.  In
> support_quote_blob_wide, I chose to use the \x{} delimited escape
> sequence syntax proposed for C2X in N2785, rather than e.g. trying to
> generate the end of a string and the start of a new string when
> ambiguity would result from undelimited \x (when the next character
> after such an escape sequence is valid hex) or forcing an escape
> sequence to be used for the next character in the case of such
> ambiguity.

Patch looks okay to me.  I don't like these preprocessor hacks, but I
don't see any other way to avoid the code duplication.


More information about the Libc-alpha mailing list