Skip to content

C++17 Woes #170

@kab163

Description

@kab163

when we go to c++17, we get a bunch of camp warnings like:

/g/g0/belcher6/Umpire/src/tpl/umpire/camp/include/camp/resource/hip.hpp:181:11: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
  181 |           campHipErrchk(
      |           ^~~~~~~~~~~~~~
  182 |               hipStreamWaitEvent(get_stream(), hip_event->getHipEvent_t(), 0));
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/g/g0/belcher6/Umpire/src/tpl/umpire/camp/include/camp/defines.hpp:195:28: note: expanded from macro 'campHipErrchk'
  195 | #define campHipErrchk(ans) ::camp::hipAssert((ans), #ans, __FILE__, __LINE__)
      |                            ^~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and I can go in to all the function calls of campHipErrchk and add a (void) to the beginning of the line and that will resolve it, but then it continues on to

/g/g0/belcher6/Umpire/src/tpl/umpire/camp/test/resource.cpp:204:3: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
  204 |   hipStreamCreate(&stream1);
      |   ^~~~~~~~~~~~~~~ ~~~~~~~~

(And so on...)

So unless we use a -Wno-unused-result flag when building (or some other similar workaround), then it looks like C++17 wants every function return to be used.

Umpire would like to use C++17 in the next release, but this is creating a long list of warnings in addition to our own set of warnings (same type). How should we proceed?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions