Skip to content

Conversation

@devreal
Copy link
Contributor

@devreal devreal commented Jan 6, 2026

alignof was standardized in C11 and OMPI now requires it.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the codebase by replacing a custom alignment_of_long_double() helper function with the C11 standard alignof operator. The change removes legacy compatibility code now that the project requires C11.

Key changes:

  • Removed the custom alignment_of_long_double() function (lines 484-507 removed)
  • Updated two call sites to use alignof(long double) directly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


ldbl_is_aligned = 1;
int alignment_mask = alignment_of_long_double() - 1;
int alignment_mask = alignof(long double) - 1;
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The code uses alignof without including <stdalign.h>. In C11, alignof is a macro defined in <stdalign.h> that expands to _Alignof, while _Alignof is the actual keyword. For consistency with other parts of the codebase (see opal/include/opal/align.h line 33), and to avoid requiring <stdalign.h>, consider using _Alignof(long double) directly instead of alignof(long double).

Suggested change
int alignment_mask = alignof(long double) - 1;
int alignment_mask = _Alignof(long double) - 1;

Copilot uses AI. Check for mistakes.

ldbl_is_aligned = 1;
int alignment_mask = alignment_of_long_double() - 1;
int alignment_mask = alignof(long double) - 1;
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The code uses alignof without including <stdalign.h>. In C11, alignof is a macro defined in <stdalign.h> that expands to _Alignof, while _Alignof is the actual keyword. For consistency with other parts of the codebase (see opal/include/opal/align.h line 33), and to avoid requiring <stdalign.h>, consider using _Alignof(long double) directly instead of alignof(long double).

Suggested change
int alignment_mask = alignof(long double) - 1;
int alignment_mask = _Alignof(long double) - 1;

Copilot uses AI. Check for mistakes.
bosilca
bosilca previously approved these changes Jan 6, 2026
Copy link
Member

@bosilca bosilca left a comment

Choose a reason for hiding this comment

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

I like copilot suggestion

_Alignof was standardized in C11 which OMPI now requires.

Signed-off-by: Joseph Schuchart <[email protected]>
@devreal
Copy link
Contributor Author

devreal commented Jan 6, 2026

Agreed, makes it clear that it's a language feature. Force-pushed a change.

@bosilca bosilca merged commit af855d5 into open-mpi:main Jan 6, 2026
13 of 14 checks passed
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