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

Refactor udaLog from variadic function to variadic template #29

Open
maarten-ic opened this issue Feb 23, 2024 · 0 comments
Open

Refactor udaLog from variadic function to variadic template #29

maarten-ic opened this issue Feb 23, 2024 · 0 comments

Comments

@maarten-ic
Copy link
Contributor

Currently udaLog is a variadic function.

This has a number of downsides (as listed on cppreference.com). The current usage is also not strictly conformant to ISO C++11, as you can observe when adding the -Wpedantic flag:

/home/maarten/projects/UDA/source/client2/client.cpp:276:85: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
  276 |         UDA_LOG(UDA_LOG_DEBUG, "Receiving Hierarchical Data Structure from Server\n");

There's also an issue when compiling release 2.7.4 with the intel c++ compiler (icpc, version 2020.4.304), related to the same:

FAILED: source/client2/CMakeFiles/client2-objects.dir/client.cpp.o
<...>
icpc: command line warning #10148: option '-Wno-use-after-free' not supported
icpc: command line warning #10148: option '-Wno-mismatched-new-delete' not supported
/tmp/<...>/EasyBuild/UDA/2.7.4/iccifort-2020.4.304/UDA-2.7.4/source/client2/client.cpp(586): error #1595: non-POD (Plain Old Data) class type passed through ellipsis
              UDA_LOG(UDA_LOG_ERROR, "Error identifying the Data Source [%s]\n", data_source);
              ^compilation aborted for /tmp/<...>/EasyBuild/UDA/2.7.4/iccifort-2020.4.304/UDA-2.7.4/source/client2/client.cpp (code 2)

See https://jira.iter.org/browse/IMAS-5014 (behind login wall).

A better approach would be to use variadic templates as listed at the alternatives for variadic arguments

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

1 participant