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

Remove usage of __has_include #561

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

msprotz
Copy link
Contributor

@msprotz msprotz commented May 27, 2022

@franziskuskiefer reported that our usage of __has_include was yet one more oddity that made support across compiler versions difficult.

I believe this used to be a an issue but with a recent change from Natalia, there is now a preprocessor guard that doesn't trigger __has_include unless we know we have it.

But simplifying this logic is good, and so I would like to remove our usage of __has_include. (There is one left for debugging purposes in libintvector.h that I believe is innocuous.)

There would need to be further changes, for instance:

  • fixing the local Makefiles to copy a dummy development config.h to enable all the features
  • making sure no dist relies on the absence of config.h (I know Mozilla has one now, but maybe election guard needs one...?)

Therefore, I'm leaving this as a draft PR for further discussion.

@msprotz
Copy link
Contributor Author

msprotz commented May 27, 2022

Unsurprisingly, this breaks windows where indeed, our CI does not generate a config.h (it should!).

@franziskuskiefer
Copy link
Member

I believe this used to be a an issue but with a recent change from Natalia, there is now a preprocessor guard that doesn't trigger __has_include unless we know we have it.

__has_include doesn't exist in older GCCs. So any GCC 4.8 build for example will not pick up the config.h.

Unsurprisingly, this breaks windows where indeed, our CI does not generate a config.h (it should!).

I'd suggest removing the CI. There's no point in trying to keep this broken build system around.

@msprotz
Copy link
Contributor Author

msprotz commented Jun 28, 2022

I think there is still some benefit to this, namely that we check that the C code generated by krml is syntactically correct for MSVC, so I'd like to keep this if we can. It's better than nothing, until we have more comprehensive Windows CI.

@msprotz msprotz marked this pull request as ready for review June 28, 2022 20:48
Copy link
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

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

Thanks!
It appears to work fine on Windows as well: https://github.com/cryspen/hacl-packages/actions/runs/2581290156

@msprotz
Copy link
Contributor Author

msprotz commented Jun 29, 2022

Thanks, I needed a couple more tweaks, hopefully this time is the right time.

@msprotz
Copy link
Contributor Author

msprotz commented Jun 29, 2022

So now make will error out if you don't have config.h and Makefile.config. You can still write these by hand (Mozilla does), but of course the suggestion is to run ./configure before invoking make.

The CI scripts have been updated to reflect this.

@msprotz msprotz requested review from tahina-pro and R1kM June 29, 2022 20:30
Copy link
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

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

lgtm, but some changes in gcc-compatible look unrelated?

@msprotz
Copy link
Contributor Author

msprotz commented Jun 30, 2022

Yeah that's because the nightly job for refreshing dist/ isn't running yet. So this PR contains a refresh of dist/ as well.

Currently blocked on a review, then I'll merge this.

@Frosne
Copy link
Contributor

Frosne commented Jul 1, 2022

If you don't mind, I will first check that the modification does not break anything in our code :)
I should be back with a definitive answer on Monday. In any case, I support any code simplifications.

@msprotz
Copy link
Contributor Author

msprotz commented Jul 1, 2022

Thanks, if this looks good for you on Monday, please go ahead and merge (I'll be off on vacation).

@Frosne
Copy link
Contributor

Frosne commented Jul 4, 2022

as promised, I am back.

It seems that everything works, but I would like to take more time to look at it.
I will be away as well, until 13th of July. As soon as I am back, it will be the first thing I will address :)

@msprotz msprotz marked this pull request as draft September 28, 2022 16:51
@msprotz
Copy link
Contributor Author

msprotz commented Oct 27, 2022

@Frosne can you confirm this looks good for you? I think we've pretty much committed to always having config.h now (even if it's hand-written), so __has_include can go I think.

@Frosne
Copy link
Contributor

Frosne commented Oct 27, 2022

IIUC, we (dist/mozilla) also should have a config.h file? Could we have it empty?

@Frosne
Copy link
Contributor

Frosne commented Oct 27, 2022

I would prefer not to have any predefined values there, because we do it in our build system.

@msprotz
Copy link
Contributor Author

msprotz commented Oct 27, 2022

Ok. Until now there was a config.h under version control for you guys, in dist/mozilla.

Are you saying you're ok to remove dist/mozilla/config.h?

@msprotz
Copy link
Contributor Author

msprotz commented Oct 27, 2022

@Frosne
Copy link
Contributor

Frosne commented Oct 27, 2022

We do not use it, so yes, I think it is ok :)

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.

None yet

3 participants