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

Compiler warning about HPX_NODISCARD when building with APEX #5469

Closed
khuck opened this issue Jul 26, 2021 · 2 comments
Closed

Compiler warning about HPX_NODISCARD when building with APEX #5469

khuck opened this issue Jul 26, 2021 · 2 comments
Milestone

Comments

@khuck
Copy link
Contributor

khuck commented Jul 26, 2021

Expected Behavior

compilation without warnings

Actual Behavior

When HPX is configured with APEX, the APEX source files all give this warning when compiled (for example):

[ 68%] Building CXX object apex/src/apex/CMakeFiles/apex.dir/otf2_listener.cpp.o
In file included from /scratch/khuck/hpx/build/libs/core/threading_base/include/hpx/modules/threading_base.hpp:14:0,
                 from /scratch/khuck/hpx/src/libs/core/synchronization/include/hpx/synchronization/mutex.hpp:14,
                 from /scratch/khuck/hpx/src/libs/core/synchronization/include/hpx/synchronization/condition_variable.hpp:16,
                 from /scratch/khuck/hpx/src/libs/parallelism/futures/include/hpx/futures/detail/future_data.hpp:20,
                 from /scratch/khuck/hpx/src/libs/parallelism/async_combinators/include/hpx/async_combinators/wait_all.hpp:108,
                 from /scratch/khuck/hpx/src/libs/parallelism/execution/include/hpx/execution/executors/execution.hpp:17,
                 from /scratch/khuck/hpx/src/libs/parallelism/executors/include/hpx/executors/execution_policy.hpp:14,
                 from /scratch/khuck/hpx/src/libs/parallelism/algorithms/include/hpx/parallel/algorithms/adjacent_find.hpp:124,
                 from /scratch/khuck/hpx/src/libs/parallelism/algorithms/include/hpx/parallel/algorithm.hpp:17,
                 from /scratch/khuck/hpx/src/libs/full/include_local/include/hpx/local/algorithm.hpp:10,
                 from /scratch/khuck/hpx/src/libs/full/include/include/hpx/algorithm.hpp:9,
                 from /scratch/khuck/hpx/src/libs/full/include/include/hpx/hpx.hpp:10,
                 from /scratch/khuck/hpx/build/_deps/apex-src/src/apex/otf2_listener.cpp:11:
/scratch/khuck/hpx/src/libs/core/threading_base/include/hpx/threading_base/annotated_function.hpp:72:26: warning: ‘warn_unused_result’ attribute only applies to function types [-Wattributes]
     struct HPX_NODISCARD annotate_function
                          ^~~~~~~~~~~~~~~~~

Steps to Reproduce the Problem

  1. configure HPX with -DHPX_WITH_APEX=TRUE
  2. make core

Specifications

  • HPX Version: current master
  • Platform (compiler, OS): all platforms, gcc compiler
@msimberg
Copy link
Contributor

@khuck I believe this is "fixed" after #5283 was merged.

What happened was that HPX_NODISCARD mapped to [[nodiscard]] if the attribute is available, and to __attribute__((warn_unused_result)) on GCC if [[nodiscard]] isn't available. The former applies to structs, classes, and functions, whereas the latter only applies to functions. However, we used HPX_NODISCARD assuming it can be used everywhere. After #5283 we assume [[nodiscard]] is always available since we require C++17. #5283 was merged yesterday. Would you mind trying again with latest master?

@msimberg
Copy link
Contributor

@khuck I'll close this with the assumption that it's fixed. Please reopen if that's not the case.

@msimberg msimberg added this to the 1.8.0 milestone Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants