Skip to content

MNT: Exorcise some compilation warnings in tables - #747

Merged
pllim merged 11 commits into
spacetelescope:mainfrom
pllim:tables-warns-begone
Nov 5, 2026
Merged

pllim merged 11 commits into
spacetelescope:mainfrom
pllim:tables-warns-begone

Conversation

@pllim

@pllim pllim commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Sequel of #746

A small step towards #35 . Some of the warnings addressed in #746 .

RT: https://github.com/spacetelescope/RegressionTests/actions/runs/42096909896

Comment thread tables/c_tbapt.c
(long)row, (long)first, (long)nelem, buffer, &status);
for (i = 0; i < nelem; i++) {
if (buffer[i] == IRAF_INDEFI) {
if (buffer[i] == (int) IRAF_INDEFI) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jhunkeler is casting like this safe? It is less disruptive than changing the func sig...

@jhunkeler jhunkeler Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's a great question.

In xtables.h:

# define IRAF_INDEFL (0x80000001)
# define IRAF_INDEFI IRAF_INDEFL

I assume this exists as negative value (maybe in general because there's no L suffix on IRAF_INDEFL). What's the expected use case for this define? Casting the value might lead to a change in behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There are two xtables.h and they are different...

  • include/xtables.h
  • tables/xtables.h

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am just gonna assume tables/xtables.h is the one used here...

@pllim pllim Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

According to the comment, that block of define is supposed to represent INF in the given data type, so presumably IRAF_INDEFI is meant to be like np.inf for signed integer?

/* Indefinite valued numbers. Taken from IRAF's $hlib/iraf.h */

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think I can change buffer data type. It is int. So either I cast RHS to int or we have to find a way to ask compiler to not complain about this line.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Based on our conversation earlier I think we agreed the cast to int is safe a long as the compiler never stores IRAF_INDEFL as a long type. Otherwise things will get very broken, very quickly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If IRAF_INDEFL does get a long type, I hope we would be careful enough to disassociate it from IRAF_INDEFI...

@pllim
pllim marked this pull request as ready for review September 30, 2026 14:29
@pllim
pllim requested a review from a team as a code owner September 30, 2026 14:29
Comment thread tables/c_tbtcre.c Resolved
Comment thread tables/c_tbcfnd1.c Resolved
Comment thread tables/c_imt.c Resolved
@pllim

pllim commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

The macos queue so slow, do we really need 2 of them?

@jhunkeler

Copy link
Copy Markdown
Contributor

If I could remove them both I would. Maybe it made sense to have two when one was x86_64 and the other was ARM64.

@jhunkeler jhunkeler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@pllim
pllim merged commit 5015983 into spacetelescope:main Nov 5, 2026
10 of 11 checks passed
@pllim
pllim deleted the tables-warns-begone branch November 5, 2026 20:34
@pllim

pllim commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Turns out macos14 is done anyway, see #754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants