Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function declarations in atoe.c for Open XL #7690

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Deigue
Copy link
Contributor

@Deigue Deigue commented Mar 13, 2025

Open XL on z/OS throws undeclared function errors when a function is used before it has been declared or defined. The changes here reorder the function definitions so that these errors are addressed.

i.e. The function definitions are moved above, so that their definitions are available before their respective usages.

/omr/util/a2e/atoe.c:1343:8: error: call to undeclared function 'atoe_vfprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]                                                                                                              
 1343 |         len = atoe_vfprintf(file, ascii_chars, args);
      |               ^
      
omr/util/a2e/atoe.c:1362:8: error: call to undeclared function 'atoe_vfprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
 1362 |         len = atoe_vfprintf(stdout, ascii_chars, args);
      |               ^
omr/util/a2e/atoe.c:1404:8: error: call to undeclared function 'atoe_vsprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
 1404 |         len = atoe_vsprintf(buf, ascii_chars, args);
      |               ^

omr/util/a2e/atoe.c:1451:8: error: call to undeclared function 'atoe_vsprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
 1451 |         len = atoe_vsprintf(buf, ascii_chars, args);
      |               ^

@Deigue Deigue requested review from mstoodle and 0xdaryl as code owners March 13, 2025 15:06
@Deigue
Copy link
Contributor Author

Deigue commented Mar 13, 2025

@keithc-ca @babsingh Found a few new undeclared function errors with Open XL, when rebasing the latest changes from master, just needed some reordering of functions in atoe.c ... Tagging to get this noticed earlier.

util/a2e/atoe.c Outdated
@@ -1327,6 +1327,53 @@ atoe_putchar(int ch)
return putchar((int)a2e_tab[ch]);
}

/**************************************************************************
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than reordering, suggest just adding declarations for those functions which are referenced before they are defined (we already have some such declarations near line 161).

Open XL on z/OS throws undeclared function errors when a
function is used before it has been declared or defined.
This adds function declarations for those situations:
- atoe_vfprintf()
- atoe_vsfprintf()

Signed-off-by: Gaurav Chaudhari <[email protected]>
@Deigue Deigue changed the title Reorder functions in atoe.c for Open XL Add function declarations in atoe.c for Open XL Mar 21, 2025
@Deigue
Copy link
Contributor Author

Deigue commented Mar 21, 2025

Thanks, reverted the reordering, added the declarations and corrected the commit description/title accordingly.

@Deigue Deigue requested a review from keithc-ca March 21, 2025 17:48
Comment on lines 161 to +164
int atoe_fprintf(FILE *, const char *, ...);
int atoe_vfprintf(FILE *, const char *, va_list);
int atoe_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
int atoe_vsprintf(char *, const char *, va_list);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest the parameters should have names or be improved:

int   atoe_fprintf(FILE *file, const char *fmt, ...);
int   atoe_vfprintf(FILE *file, const char *fmt, va_list args);
int   atoe_vsnprintf(char *buf, size_t buflen, const char *fmt, va_list args);
int   atoe_vsprintf(char *buf, const char *fmt, va_list args);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants