DECC on x86 getline, getdelim issue

OpenVMS x86 native compilers, cross compilers news and questions.

Topic author
arpadffy
Member
Posts: 9
Joined: Sun May 24, 2020 1:23 pm
Reputation: 0
Location: Stockholm, Sweden
Status: Offline

DECC on x86 getline, getdelim issue

Post by arpadffy » Fri Nov 24, 2023 3:31 pm

Hi,

I apologize for a stupid question, but even after few hours of reading the code and header files, I could not find any explanation for this phenomena.

Could somebody be kind and explain what is going on with the DECC on x86 around getline and getdelim functions?

Background: I am porting an open source project to x86VMS

The very same code works well on VAX, Alpha and Itanium.
Tested with the following compilers - and the program builds and works very well:
Compaq C V6.4-005 on OpenVMS VAX V7.3
HP C V7.3-020 on OpenVMS IA64 V8.4
Compaq C V6.5-001 on OpenVMS Alpha V7.3
VSI C V7.4-002 on OpenVMS Alpha V8.4-2L1

...but on x86 it fails with a very strange error.
I use: VSI C x86-64 X7.4-843 (GEM 50XB9) on OpenVMS x86_64 V9.2-1

Code: Select all

            line = cp->getline(c, cp->cookie, indent, options);
...............................^
%CC-W-TOOMANYACTLS, Too many actual parameters in the invocation of the macro "getline".

            line = cp->getline(c, cp->cookie, indent, options);
...................^
%CC-E-NEEDMEMBER, In this statement, "getdelim" is not a member of "cp".
First: as the very same code works on all other platforms and getline has not changed for ages it is strange that it complains about the number of arguments

Second: the getdelim function is not used anywhere in the code, regardless the compiler complies about a missing member.

Without getting deep in the far too complicated piece of code, let's describe the issue on a simple way:

There is a given structure:

Code: Select all

struct loop_cookie
{
    int		current_line;		
    int		repeating;		
    char_u	*(*getline)(int, void *, int, getline_opt_T);
    void	*cookie;
};

The struct is used in the following way:

struct loop_cookie  *cp = (struct loop_cookie *)cookie;
line = cp->getline(c, cp->cookie, indent, options);
In order to satisfy the compiler I went on (a lucid) changing the structure by adding the getdelim member.

Code: Select all

struct loop_cookie
{
    int		current_line;		
    int		repeating;	
    char_u	*(*getline)(int, void *, int, getline_opt_T);
#if defined (VMS) || defined (X86_64)
    char_u	*(*getdelim)(int, void *, int, getline_opt_T);
#endif
    void	*cookie;
};
After this change the compiler was mostly satisfied as the error vanished but the warning still persisted

Code: Select all

            line = cp->getline(c, cp->cookie, indent, options);
...............................^
%CC-W-TOOMANYACTLS, Too many actual parameters in the invocation of the macro "getline".
The executable was built with warnings. The program mostly works... but it has problems with the functionality that depends on this piece of code (while on all other platforms all works well).

The getline and getdelim basically differs just in number of parameters and what is the line delimiter. This might cause the issues... but I do not understand how the getdelim() comes into the picture at all (just in X86VMS)?

Any explanation or a workaround suggestion would be highly appreciated.

Thanks,
Z
Last edited by arpadffy on Fri Nov 24, 2023 3:44 pm, edited 4 times in total.


Topic author
arpadffy
Member
Posts: 9
Joined: Sun May 24, 2020 1:23 pm
Reputation: 0
Location: Stockholm, Sweden
Status: Offline

Re: DECC on x86 getline, getdelim issue

Post by arpadffy » Mon Nov 27, 2023 10:25 am

hb wrote:
Mon Nov 27, 2023 4:26 am
The final solution for what?
The proper solution would be to rename the getline function to something else in the struct (and in all places
it is used) - and avoiding to use POSIX function names in the structs, but this change would impact on all other operating systems in the project. This will be done in the near future.

Therefore, for now, I went for the temporary solution - that has been suggested above - to keep the __CRTL_VER under 80500000 level while the struct is not changed.
This implied few other issues around the isinf() that was easily solved.

Thank you for all help.
Z

Post Reply