8000 compile correctly with -std=c99 by glennklockwood · Pull Request #101 · hpc/ior · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

compile correctly with -std=c99 #101

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
Oct 28, 2018

Conversation

glennklockwood
Copy link
Contributor

This patch enables correct compilation on both MacOS and Linux using only POSIX.1-2008-compliant C with XSI extensions. It also changes the travis build to explicitly use -std=c99 to catch noncompliant patches going forward.

This does not require a user compile with strict POSIX conformance though, and the general expectation is that most users will continue to build with various GNUisms enabled by default (and in fact, this is required to compile with --with-lustre). The intent here is just to curb any creeping dependence on a specific libc or compiler.

resolves #93

This patch enables correct compilation on both MacOS and Linux using only
POSIX.1-2008-compliant C with XSI extensions.

Specifically, POSIX.1-2008 is the minimum version because we use strdup(3);
explicit XSI is required to expose putenv from glibc.
@JulianKunkel
Copy link
Collaborator

Maybe the _XOPEN_SOURCE could be added to the CFLAGS instead of adding it to multiple files? Otherwise, great that you spend the time to get this done.

@glennklockwood
Copy link
Contributor Author

My preference is to keep this in source (somewhere) since it is a feature macro reflecting the features of the source. Should someone mess with the build process later on, the declaration of POSIX shouldn't go away.

That said, we can stick this in a config somewhere and be sure to load that before any other headers across all our source files. That may be easier to manage than sticking it in each source file that requires it. Would this be better?

@JulianKunkel
Copy link
Collaborator

Yes, I believe we can move this safely to config.h

@JulianKunkel JulianKunkel merged commit 3a4f2ea into hpc:master Oct 28, 2018
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.

ior does not build without CFLAGS=-std=gnu99
2 participants
0