Skip to content

Mark M2_flint_abort as FLINT_NORETURN - #4519

Open
d-torrance wants to merge 1 commit into
Macaulay2:developmentfrom
d-torrance:flint-no-return
Open

Mark M2_flint_abort as FLINT_NORETURN#4519
d-torrance wants to merge 1 commit into
Macaulay2:developmentfrom
d-torrance:flint-no-return

Conversation

@d-torrance

Copy link
Copy Markdown
Member

Otherwise, compilation can fail w/:

../../../../Macaulay2/d/main.cpp:92:3: fatal error: no matching function for call to 'flint_set_abort'
   92 |   flint_set_abort(M2_flint_abort);
      |   ^~~~~~~~~~~~~~~
/usr/include/flint/flint.h:222:6: note: candidate function not viable: no known conversion from 'void ()' to 'void (*)() __attribute__((noreturn))' for 1st argument
  222 | void flint_set_abort(FLINT_NORETURN void (*func)(void));
      |      ^               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I ran into this problem compiling M2 with clang 18.1.3 in Ubuntu 24.04.

@d-torrance d-torrance added the build issue platform specific issues involving compiling M2, generating examples, or running tests label Aug 4, 2026
Otherwise, compilation can fail w/:

    ../../../../Macaulay2/d/main.cpp:92:3: fatal error: no matching function for call to 'flint_set_abort'
       92 |   flint_set_abort(M2_flint_abort);
          |   ^~~~~~~~~~~~~~~
    /usr/include/flint/flint.h:222:6: note: candidate function not viable: no known conversion from 'void ()' to 'void (*)() __attribute__((noreturn))' for 1st argument
      222 | void flint_set_abort(FLINT_NORETURN void (*func)(void));
          |      ^               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@andrew-tawfeek andrew-tawfeek 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.

This looks good. FLINT_NORETURN matches the callback type expected by flint_set_abort, and applying it to both the declaration and definition is consistent with the fact that the function always calls abort(). I also checked that the macro exists throughout M2's supported FLINT range back to 2.6.3.

AI-assisted review comment made by GPT 4.6-Sol under Andrew's direction in order to observe deeper code reaches.

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

Labels

build issue platform specific issues involving compiling M2, generating examples, or running tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants