-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Adds XOPEN_SOURCE for PATH_MAX and POSIX 1993 for stat #5529
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
Conversation
These are the only two required extension for compilation of flatbuffers using -std=c++11 instead of gnu++11.
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
@googlebot I fixed it |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
Can you point to documentation why these defines are needed, and why the headers can't work without them when using -std=c++11 ? This seems strange, never seen this needed before. What OS/compiler are you on? @vglavnyy have you seen this before? |
|
Probably this connected to CYWIN (MinGW). Can we replace |
|
Indeed these items are not part of the C++ standard. This means that if you compile according to strict C++ compilation will fail. By setting these feature macros you can enable parts again for a specific file. I think this is a better approach than bluntly enabling all GCC extensions, which is what happens a lot. This way you make clear what part of your program is pure C++, what is POSIX, etc. As for my use case, I want to use flatbuffers for communication between some industrial equipment and an HMI. For the software on the equipment you want to maximize portability and minimize the amount of non-standard stuff you pull in. This means we compile all code using pure C++. As for OS and compiler I am on Windows compiling with GCC to QNX. But I would expect that you see this with every compiler. Why most of the times you do not notice this is because CMake uses -std=gnu++11 instead of -std=c++11 when you set a standard using CXX_STANDARD as compiler specific extensions are enabled by default: https://cmake.org/cmake/help/latest/prop_tgt/CXX_EXTENSIONS.html#prop_tgt:CXX_EXTENSIONS https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html |
|
Fair enough, I'll merge it then! @vglavnyy we can use a larger buffer for |
* Adds XOPEN_SOURCE for PATH_MAX and POSIX 1993 for stat These are the only two required extension for compilation of flatbuffers using -std=c++11 instead of gnu++11. * Sets _XOPEN_SOURCE to 600 and enable POSIX2001 for fseeko
These are the only two required extension for compilation of flatbuffers using -std=c++11 instead of gnu++11. This makes it explicit where and why these extensions are required.