BCX 8.0.7 & unicode

Started by jcfuller, December 11, 2023, 07:58:56 AM

Previous topic - Next topic

Robert

Quote from: MrBcx on December 11, 2023, 05:15:28 PM
Quote from: Robert on December 11, 2023, 03:22:41 PM
Hi MrBCX:

If it's not too much trouble, could you post an example which throws the MINGW/CLANG warnings that the casts eliminated.

Hi Robert,

The warnings appeared immediately and with countless examples, including BCX itself, after
I dropped Equation Solutions Mingw package and switched to Martin Storjo's Clang/Ming32 package. 
That was over two months ago and since then I have upgraded one or two versions, the more recent
being about 2 weeks ago.

Guess what?

When I remove the (void*) casts, I no longer get warnings.  This strongly suggests that I can remove
the casts that were added in 807, along with the conditionals that I added today.  What a waste of time
that turned out to be.


ref: https://github.com/mstorsjo/llvm-mingw/releases

Great. Good news is always welcome.

Things were getting pretty cluttered with the casts and exceptions. When I tested could see no problem, so I was really wondering what was up.


MrBcx

Quote from: Robert on December 11, 2023, 03:22:41 PM
Hi MrBCX:

If it's not too much trouble, could you post an example which throws the MINGW/CLANG warnings that the casts eliminated.

Hi Robert,

The warnings appeared immediately and with countless examples, including BCX itself, after
I dropped Equation Solutions Mingw package and switched to Martin Storjo's Clang/Ming32 package. 
That was over two months ago and since then I have upgraded one or two versions, the more recent
being about 2 weeks ago.

Guess what?

When I remove the (void*) casts, I no longer get warnings.  This strongly suggests that I can remove
the casts that were added in 807, along with the conditionals that I added today.  What a waste of time
that turned out to be.


ref: https://github.com/mstorsjo/llvm-mingw/releases

Robert

Quote from: MrBcx on December 11, 2023, 08:44:30 AM
James,

The void pointer casts were added to several runtime functions to silence MINGW/CLANG warnings.
Since Unicode Lexer seems incapable of handling those situations, I'll conditionally omit the
casts, based on the internal Use_UNICODE flag that BCX uses during translation.

On a related point, your post: https://bcxbasiccoders.com/smf/index.php?topic=455.msg1964#msg1964
seems lacking to me.

Hi MrBCX:

If it's not too much trouble, could you post an example which throws the MINGW/CLANG warnings that the casts eliminated.

jcfuller

Kevin,
  Looks ok although I still have issues I think are unrelated to Bcx?
I'm not doing any coding at present but I do try to run through a few tests on each Bcx  and MSVC release.

James

MrBcx


MrBcx

#3
James,

The void pointer casts were added to several runtime functions to silence MINGW/CLANG warnings.
Since Unicode Lexer seems incapable of handling those situations, I'll conditionally omit the
casts, based on the internal Use_UNICODE flag that BCX uses during translation.

On a related point, your post: https://bcxbasiccoders.com/smf/index.php?topic=455.msg1964#msg1964
seems lacking to me.


jcfuller


jcfuller

Kevin,
  Issue with 8.0.7 translation

James

BCX 8.0.6 works as it always has

_TCHAR *left (LPCTSTR szSrc, int length)
{
    size_t tmplen = _tcslen(szSrc);
    if (length < 1) return BCX_TmpStr(1);
    if (length < (int)tmplen) tmplen = length;
    _TCHAR *strtmp = BCX_TmpStr(tmplen);
    return (_TCHAR*)wmemcpy(strtmp, szSrc, tmplen);
}

BCX 8.0.7

_TCHAR *left (LPCTSTR szSrc, int length)
{
    size_t tmplen = _tcslen(szSrc);
    if (length < 1) return BCX_TmpStr(1);
    if (length < (int)tmplen) tmplen = length;
    _TCHAR *strtmp = BCX_TmpStr(tmplen);
    return (_TCHAR*)wmemcpy((void*)strtmp, (void*)szSrc, tmplen);
}

Str_1211.cpp(229): error C2664: 'wchar_t *wmemcpy(wchar_t *,const wchar_t *,size_t)': cannot convert argument 1 from 'void *' to 'wchar_t *'
Str_1211.cpp(229): note: Conversion from 'void*' to pointer to non-'void' requires an explicit cast
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\wchar.h(229): note: see declaration of 'wmemcpy'
Str_1211.cpp(229): note: while trying to match the argument list '(void *, void *, size_t)'