Skip to content

Ensure everything compiles individually & sort includes #4

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

Merged
merged 1 commit into from
Jun 27, 2017

Conversation

aleksejspopovs
Copy link
Collaborator

Just like in libff pull request 9, I have made almost every file in libfqfft compile individually by adding all missing includes, and also sorted all includes.

Additionally, I added a helpful compilation error message in case someone tries to compile libfqfft/profiling/profile/profile.cpp without -DPROFILE_OP_COUNTS.

Now for the almost in that first paragraph. There is a set of files, all in libfqfft/evaluation_domain, that still cannot be compiled individually, and this cannot be fixed easily because they have circular dependencies (files in domains/* depend on evaluation_domain.hpp, and vice-versa).

I see two solutions to this:

  • add an explicit compiler error message to each file in domains/* saying that it cannot be compiled or included individually and must only be used by including evaluation_domain.hpp

  • move get_evaluation_domain() from evaluation_domain.hpp to a separate file, like get_evaluation_domain.hpp, eliminating the circular dependency

Personally, I support the second solution, because I don't see why a user should be unable to include a specific evalution domain if they want to. However, this would be a breaking change for all users of libfqfft (so, basically, libsnark), although it would also be really easy to fix (by adding/replacing just one include).

I invite everybody else to discuss this issue in the comments for this pull request. If there is support for either of the solutions, I will implement it and submit another PR to libfqfft (or just add more commits to this one), and also implement the necessary changes in libsnark if there are any.

I have added a couple missing includes, so that every *.cpp or *.hpp
file in the repository can now be compiled individually^. I also grouped
all includes (by stdlib/external libs/libfqfft) and sorted them.

^ With the exception of libfqfft/evaluation_domain/domains/*, which are
  to be refactored soon (because of a cyclic dependency).
@madars
Copy link
Member

madars commented Jun 27, 2017

This looks great! Regarding the circular dependency, I think we should factor out get_evaluation_domain() (@popoffka's second proposal).

For all of our users this would mean one line insertion:
#include <libfqfft/evaluation_domain/get_evaluation_domain.hpp>
right after:
#include <libfqfft/evaluation_domain/evaluation_domain.hpp>
which is a truly minor change.

@tromer
Copy link
Member

tromer commented Jun 27, 2017

I agree.

@madars madars merged commit 01c5201 into scipr-lab:master Jun 27, 2017
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.

3 participants