On 22/12/20 18:27 -0300, Alexandre Oliva wrote:
This change extracts apart the wchar specific parts of character conversion tests to allow conditonalizating these parts on actual wchar support while applying the rest more generally. This turned out useful during our work on the libstdc++ support for VxWorks, to expose the problematic areas more precisely. Regstrapped on x86_64-linux-gnu, and tested with -x-arm-wrs-vxworks7r2. Ok to install? (dg-requires-wchars is added by another patch by Corentin, that I posted a few minutes ago) While updating Corentin's patch for mainline, I brought over to the split-out test even the preprocessor conditional that is present in the current version of the test, but required/implied by dg-requires-wchars. Maybe that's excessive. Maybe the whole patch is excessive, given that conditional, but I didn't want to just drop it without asking for others' thoughts.
I do think this is excessive. The point of the test is only to verify that calling from_chars with wchar_t gives an error. I don't think we need to make that conditional on whether wchar_t is supported or not. Adding a whole new test and checking the dg-requires... condition adds non-zero overhead to the testsuite. Following the theme of my other replies, maybe _GLIBCXX_USE_WCHAR_T isn't even the right thing to check here. We don't require any support for wchar_t in this test, we only require the type to be defined. Simple changing _GLIBCXX_USE_WCHAR_T to __SIZEOF_WCHAR_T__ seems like a better fix. That will mean that we use the type if it's defined, and not otherwise. We don't care if the library actually supports wchar_t specializations for std::char_traits etc. because we are expecting to get an error anyway.