Compiler warning/inconsistant error-message in TIP #656 implementation
tclCmdAH.c: In function ‘EncodingConvertParseOptions’: tclCmdAH.c:592:14: warning: trigraph ??- ignored, use -trigraphs to enable [-Wtrigraphs] 592 | "??-profile profile? ?-failindex var? ?encoding?? data");
Also, when running this:
% encoding convertfrom -profile tcl ascii wrong # args: should be "::tcl::encoding::convertfrom ??-profile profile? ?-failindex var? ?encoding?? data"
This doesn't correspond with the TIP text, making 'encoding' mandatory when any other option is used.
Suggested solution, see here
ebf20c29bdBug [40c61a5d10]. Fix syntax error message. check-in2023-02-24 03:35:3100b03d47c5Fix gcc warnings and encoding error message (bug [40c61a5d10]) check-in2023-02-23 10:22:58
Ah, trigraphs, first time I'm encountering them (inadvertently). I'll fix that.
With respect to your second point, I think the ? around encoding needs to be removed but outermost ? preserved. (Your edit removes the outermost ? which is not the same thing because it makes encoding always mandatory and disallows the 8.6 syntax encoding convertfrom abc.
Thanks for pointing this out.
By the way, TIP and implementation are still WIP. I hope to be done before the weekend.
/Ashok
Fixed in [00b03d47c5]
> Your edit removes the outermost ? which is not the same thing ...
Did you notice the usage of "INTERP_ALTERNATE_WRONG_ARGS"? Most likely you are not aware of this feature. It's what other commands (like "socket") use when the syntax has multiple alternatives.
% encoding convertfrom -profile tcl ascii wrong # args: should be "::tcl::encoding::convertfrom ?-profile profile? ?-failindex var? encoding data" or "::tcl::encoding::convertfrom data"
This way, we put the prefered syntax (making 'encoding' mandatory) first, and the alternative (for 8.6 compatibility) second ☺
Sorry, you're right on all counts. I didn't know about the INTERP_ALTERNATE_WRONG_ARGS feature, didn't notice it in your patch and message. Should have looked more closely.
It is indeed better. Will make that fix. Thanks.
/Ashok