Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Compiler warning/inconsistant error-message in TIP #656 implementation

Closed / Fixed40c61a5d10e9b6478a096723bfc78fd85664f637Created 4 years agoUpdated 4 years ago
Descriptionwiki2023-02-23 07:36:46
Compiling the tip-656 branch, I see the following warning:
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

Referenced by2
jan.nijtmans Ticket [40c61a5d10]: 3 changes [History diff]2023-02-23 07:37:02
apnadkarnimarkdown2023-02-23 09:54:18

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

apnadkarniplain2023-02-23 10:24:47
Fixed in [00b03d47c5]
jan.nijtmanswiki2023-02-23 11:47:49

> 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 ☺

apnadkarnimarkdown2023-02-24 03:00:45

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

apnadkarni Ticket [40c61a5d10]: 3 changes [History diff]2023-02-24 03:36:20
apnadkarni Closed ticket [40c61a5d10]. [History diff]2023-02-24 03:37:17
Log in (anonymous is fine) to add a comment.