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

Build with -std=c11 instead of -std=gnu11 #261

Closed
wants to merge 3 commits into from
Closed

Build with -std=c11 instead of -std=gnu11 #261

wants to merge 3 commits into from

Conversation

SoapZA
Copy link

@SoapZA SoapZA commented Oct 28, 2018

Hi @lh3
We generally like to build our codebases against ISO C as much as possible and avoid GNUisms. With this PR, minimap2 can be compiled with -std=c11 now. This makes bundling minimap2 in other codebases much easier.

* This struct is obsolete and passing `NULL`
  is the recommended approach.
  http://man7.org/linux/man-pages/man2/gettimeofday.2.html
* `asm` requires explicitly enabling GNUtensions,
  as `asm` is not a recognized C identifier.
* By defining `_XOPEN_SOURCE` to be 600, we do not
  have to pass `-std=gnu11` when building Minimap2,
  and can use `-std=c11` instead.
@lh3
Copy link
Owner

lh3 commented Nov 7, 2018

Minimap2 can be compiled with gcc/clang -std=c99/c11 and g++/clang++ -std=c++98/c++11/c++14. g++ -std=c++17 also works, but clang++ -std=c++17 fails as register is forbidden in C++17.

@SoapZA SoapZA deleted the less-gnuisms branch November 12, 2018 18:53
@SoapZA
Copy link
Author

SoapZA commented Nov 12, 2018

@lh3 very nice. Maybe we can remove register too, seeing that most compilers ignore it and do their own register allocation.

lh3 added a commit that referenced this pull request Nov 19, 2018
@lh3
Copy link
Owner

lh3 commented Nov 19, 2018

Done. minimap2 can now be compiled with "clang++ -std=c++17". Note that minimap2 still uses some compiler extensions like __sync_fetch_and_add() and __asm__.

@SoapZA
Copy link
Author

SoapZA commented Nov 19, 2018

@lh3 thanks for your dedication and commitment. Compiler extensions are fine, so long they don't include prohibited language features (such as register).

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