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

Fix bugs and improve that about HPX_HAVE_CXX11_AUTO_RETURN_VALUE of CMake. #2821

Merged
merged 6 commits into from Aug 14, 2017

Conversation

Projects
None yet
3 participants
@taeguk
Copy link
Member

taeguk commented Aug 12, 2017

This is related to #2720.

  1. When uses C++11, HPX_CXX11_AUTO_RETURN_VALUE_DEFAULT must be OFF.
  2. The auto return value is C++14 feature. So, renaming to HPX_HAVE_CXX14_AUTO_RETURN_VALUE seems better.

@hkaiser @gentryx Can you review this?

Added later)

  1. Add feature test.
  2. The formal naming of auto return value is 'return type deduction'. So, renaming to HPX_HAVE_CXX14_RETURN_TYPE_DEDUCTION seems better.
  3. Add cmake known feature test.
Fix a bug about HPX_HAVE_CXX11_AUTO_RETURN_VALUE.
When uses C++11, HPX_CXX11_AUTO_RETURN_VALUE_DEFAULT must be OFF.

@taeguk taeguk force-pushed the taeguk:tg_cmake_auto_return_value branch from cb18e0a to a49a7df Aug 12, 2017

@taeguk taeguk force-pushed the taeguk:tg_cmake_auto_return_value branch from a49a7df to f206f20 Aug 12, 2017

@hkaiser hkaiser added this to the 1.1.0 milestone Aug 12, 2017

@hkaiser

This comment has been minimized.

Copy link
Member

hkaiser commented Aug 12, 2017

1.When uses C++11, HPX_CXX11_AUTO_RETURN_VALUE_DEFAULT must be OFF.

I think it should be ON for conforming compilers. I agree, this is unusual, but we couldn't come up with a better name. We could however rename the PP constant to HPX_CXX11_NO_AUTO_RETURN_VALUE_DEFAULT and flip the flag.

Rename HPX_HAVE_CXX11_AUTO_RETURN_VALUE to HPX_HAVE_CXX14_AUTO_RETURN_VALUE.

The feature in question is a C++11 feature. C++11 allows for using auto on a function without specifying an explicit return type if the function consists of only a single return statement allowing for the compiler to deduce the return type from this.

@taeguk

This comment has been minimized.

Copy link
Member Author

taeguk commented Aug 12, 2017

The feature in question is a C++11 feature. C++11 allows for using auto on a function without specifying an explicit return type if the function consists of only a single return statement allowing for the compiler to deduce the return type from this.

@hkaiser Does the feature is a C++11 feature really?? But, I got compile errors related to auto return value with C++11... (https://gist.github.com/taeguk/a9a37590471f0c30a706ca6aea0a392f)
As I think, maybe you confused it with deduced return type for "lambda". (https://isocpp.org/wiki/faq/cpp14-language#generalized-return)

@hkaiser

This comment has been minimized.

Copy link
Member

hkaiser commented Aug 12, 2017

@taeguk, you're right - sorry for the confusion on my end. So this is a C++14 facility after all ...

@hkaiser
Copy link
Member

hkaiser left a comment

LGTM, thanks!

@gentryx

This comment has been minimized.

Copy link
Member

gentryx commented Aug 12, 2017

In this case we might want an overridable configure time test to detect whether this setting should on or off. We had one in 8599ce3

@taeguk

This comment has been minimized.

Copy link
Member Author

taeguk commented Aug 12, 2017

@gentryx Do you mean adding feature tests for auto return value?

@taeguk

This comment has been minimized.

Copy link
Member Author

taeguk commented Aug 13, 2017

Wait. What's the problem with CUDA?
Is it insufficient to use just feature test for detecting whether auto return value can be used?

@hkaiser

This comment has been minimized.

Copy link
Member

hkaiser commented Aug 13, 2017

Is it insufficient to use just feature test for detecting whether auto return value can be used?

We run the feature tests not for NVCC but for the compiler used by NVCC to generate the code. NVCC itself is just a preprocessor which generates C code from the C++ input.

@taeguk taeguk changed the title Fix a bug which related to HPX_HAVE_CXX11_AUTO_RETURN_VALUE in CMakeLists.txt. Fix bugs and improve that about HPX_HAVE_CXX11_AUTO_RETURN_VALUE of CMake. Aug 13, 2017

@gentryx

This comment has been minimized.

Copy link
Member

gentryx commented Aug 13, 2017

@taeguk Yes, that's what I meant.

@hkaiser hkaiser merged commit 0e250c4 into STEllAR-GROUP:master Aug 14, 2017

2 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment