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

Error with maybe_unused #39

Closed
abacolla opened this issue Jan 15, 2024 · 2 comments
Closed

Error with maybe_unused #39

abacolla opened this issue Jan 15, 2024 · 2 comments
Assignees

Comments

@abacolla
Copy link

I find these errors when trying to compile with a Makefile that uses CXX = mpicxx and CXXFLAGS = -std=c++17 -Wall -Wextra -O3. mpicxx --version is: g++ (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20). Are the errors raised by the version of the compiler? Thanks.

In file included from /tcga_data/include/mpl/mpl/mpl.hpp:51,
from vga_paramLayout_job.cpp:13:
/tcga_data/include/mpl/mpl/layout.hpp:383:17: error: expected unqualified-id before ‘[’ token
null_layout([[maybe_unused]] const null_layout &l) noexcept : null_layout() {
^
/tcga_data/include/mpl/mpl/layout.hpp:383:17: error: expected ‘)’ before ‘[’ token
null_layout([[maybe_unused]] const null_layout &l) noexcept : null_layout() {
~^
)
/tcga_data/include/mpl/mpl/layout.hpp:386:17: error: expected unqualified-id before ‘[’ token
null_layout([[maybe_unused]] null_layout &&l) noexcept : null_layout() {
^
/tcga_data/include/mpl/mpl/layout.hpp:386:17: error: expected ‘)’ before ‘[’ token
null_layout([[maybe_unused]] null_layout &&l) noexcept : null_layout() {
~^
)
In file included from /tcga_data/include/mpl/mpl/mpl.hpp:57,
from vga_paramLayout_job.cpp:13:
/tcga_data/include/mpl/mpl/comm_group.hpp:4059:27: error: expected unqualified-id before ‘[’ token
explicit communicator([[maybe_unused]] comm_collective_tag comm_collective,
^
/tcga_data/include/mpl/mpl/comm_group.hpp:4059:27: error: expected ‘)’ before ‘[’ token
explicit communicator([[maybe_unused]] comm_collective_tag comm_collective,
~^
)
/tcga_data/include/mpl/mpl/comm_group.hpp:4072:27: error: expected unqualified-id before ‘[’ token
explicit communicator([[maybe_unused]] group_collective_tag group_collective,
^
/tcga_data/include/mpl/mpl/comm_group.hpp:4072:27: error: expected ‘)’ before ‘[’ token
explicit communicator([[maybe_unused]] group_collective_tag group_collective,
~^
)
/tcga_data/include/mpl/mpl/comm_group.hpp:4073:89: error: expected unqualified-id before ‘)’ token
const communicator &other, const group &gr, tag_t t = tag_t{0}) {
^
/tcga_data/include/mpl/mpl/comm_group.hpp:4088:27: error: expected unqualified-id before ‘[’ token
explicit communicator([[maybe_unused]] split_tag split, const communicator &other,
^
/tcga_data/include/mpl/mpl/comm_group.hpp:4088:27: error: expected ‘)’ before ‘[’ token
explicit communicator([[maybe_unused]] split_tag split, const communicator &other,
~^
)
/tcga_data/include/mpl/mpl/comm_group.hpp:4107:27: error: expected unqualified-id before ‘[’ token
explicit communicator([[maybe_unused]] split_shared_memory_tag split_shared_memory,
^
/tcga_data/include/mpl/mpl/comm_group.hpp:4107:27: error: expected ‘)’ before ‘[’ token
explicit communicator([[maybe_unused]] split_shared_memory_tag split_shared_memory,
~^
)

@rabauke
Copy link
Owner

rabauke commented Jan 15, 2024

I understand the error message in the way that the compiler does not recognize the [[maybe_unused]] attribute, which is a C++17 feature. GCC is C++17 feature complete since version 8. This means your compiler GCC 8.5 should support [[maybe_unused]]. Though, GCC 8.5 uses C++14 by default. Thus I suspect that the compiler does not see the -std=c++17 option.

Can you please double check your Makefiles?

What happens if you add

#if __cplusplus < 201703L 
#error "C++17 or better required\n"
#endif

to your sources?

@abacolla
Copy link
Author

Thank you, the Makefile was fine and the issue is resolved, thank you for your help.

@rabauke rabauke self-assigned this Mar 19, 2024
@rabauke rabauke closed this as completed Mar 19, 2024
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

No branches or pull requests

2 participants