On 08/21/18 00:49, Joseph Myers wrote:
> On Mon, 20 Aug 2018, Jeff Law wrote:
>
>>> If you do that, probably you want to move
>>> fortran/trans-types.c:get_typenode_from_name (which converts the strings
>>> used in target macros such as WCHAR_TYPE to the corresponding types) into
>>> generic code.
>> I think we ultimately have to go down that path. Or we have to make the
>> wchar types language independent.
>>
>> My initial fooling around does something like this:
>>
>> count_by = 1;
>> if (dir.specifier == 'S' || dir.modifier == FMT_LEN_l)
>> {
>> tree node = get_identifier (MODIFIED_WCHAR_TYPE);
>
> I expect this get_identifier use may only work properly in C-family
> languages.
>
If that type is not available, you can set count_b = 0, then c_strlen will
not return wrong information.
For other languages that is certainly good enough.
> (There's another version of that get_typenode_from_name logic in
> tree.c:build_common_tree_nodes for SIZE_TYPE and PTRDIFF_TYPE, which only
> considers types of the right signedness in those cases, but does handle
> __intN types.)
>