Skip to content

Commit

Permalink
refactored refl-cpp and (de-)serialiser to be an optional dependency
Browse files Browse the repository at this point in the history
* fixed some implicit conversion warnings
* suppressed clang and gcc warnings for external dependencies

N.B. GR4 uses now it's own mini reflection library and yaml-(de-)serialiser -> perhaps this could be eventually upstreamed as well.

Signed-off-by: Ralph J. Steinhagen <r.steinhagen@gsi.de>
  • Loading branch information
RalphSteinhagen committed Dec 6, 2024
1 parent 6d08b2c commit daa7703
Show file tree
Hide file tree
Showing 14 changed files with 641 additions and 628 deletions.
16 changes: 15 additions & 1 deletion bench/bm_pmt_dict_pack_unpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@
#include <iostream>
#include <string>

#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic push // ignore warning of external libraries that from this lib-context we do not have any control over
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion"
#ifndef __clang__ // only for GCC, not Clang
#pragma GCC diagnostic ignored "-Wuseless-cast"
#endif
#endif

#include "CLI/App.hpp"
#include "CLI/Config.hpp"
#include "CLI/Formatter.hpp"

#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#include <pmtv/pmt.hpp>
#include <pmtv/format.hpp>

Expand Down Expand Up @@ -74,7 +88,7 @@ int main(int argc, char* argv[])
auto valid = run_test(samples, items);

auto t2 = std::chrono::steady_clock::now();
auto time = 1e-9 * static_cast<long double>(std::chrono::duration_cast<std::chrono::nanoseconds>(t2 - t1).count());
auto time = static_cast<long double>(1e-9) * static_cast<long double>(std::chrono::duration_cast<std::chrono::nanoseconds>(t2 - t1).count());

std::cout << "[PROFILE_TIME]" << time << "[PROFILE_TIME]" << std::endl;
std::cout << "[PROFILE_VALID]" << valid << "[PROFILE_VALID]" << std::endl;
Expand Down
16 changes: 15 additions & 1 deletion bench/bm_pmt_dict_ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@
#include <iostream>
#include <string>

#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic push // ignore warning of external libraries that from this lib-context we do not have any control over
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion"
#ifndef __clang__ // only for GCC, not Clang
#pragma GCC diagnostic ignored "-Wuseless-cast"
#endif
#endif

#include "CLI/App.hpp"
#include "CLI/Config.hpp"
#include "CLI/Formatter.hpp"

#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#include <pmtv/pmt.hpp>
#include <pmtv/format.hpp>

Expand Down Expand Up @@ -66,7 +80,7 @@ int main(int argc, char* argv[])
auto valid = run_test(samples, d, index);

auto t2 = std::chrono::steady_clock::now();
auto time = 1e-9 * static_cast<long double>(std::chrono::duration_cast<std::chrono::nanoseconds>(t2 - t1).count());
auto time = static_cast<long double>(1e-9) * static_cast<long double>(std::chrono::duration_cast<std::chrono::nanoseconds>(t2 - t1).count());

std::cout << "[PROFILE_TIME]" << time << "[PROFILE_TIME]" << std::endl;
std::cout << "[PROFILE_VALID]" << valid << "[PROFILE_VALID]" << std::endl;
Expand Down
17 changes: 16 additions & 1 deletion bench/bm_pmt_serialize_uvec.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
#include <chrono>
#include <iostream>

#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic push // ignore warning of external libraries that from this lib-context we do not have any control over
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wimplicit-int-float-conversion"
#ifndef __clang__ // only for GCC, not Clang
#pragma GCC diagnostic ignored "-Wuseless-cast"
#endif
#endif

#include "CLI/App.hpp"
#include "CLI/Config.hpp"
#include "CLI/Formatter.hpp"

#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#include <pmtv/pmt.hpp>
#include <pmtv/serialiser.hpp>

using namespace pmtv;

Expand Down Expand Up @@ -49,7 +64,7 @@ int main(int argc, char* argv[])
auto valid = run_test(samples, data);

auto t2 = std::chrono::steady_clock::now();
auto time = 1e-9 * static_cast<long double>(std::chrono::duration_cast<std::chrono::nanoseconds>(t2 - t1).count());
auto time = static_cast<long double>(1e-9) * static_cast<long double>(std::chrono::duration_cast<std::chrono::nanoseconds>(t2 - t1).count());

std::cout << "[PROFILE_TIME]" << time << "[PROFILE_TIME]" << std::endl;
std::cout << "[PROFILE_VALID]" << valid << "[PROFILE_VALID]" << std::endl;
Expand Down
1 change: 1 addition & 0 deletions include/pmtv/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ files = [
'pmt.hpp',
'rva_variant.hpp',
'type_helpers.hpp',
'serialiser.hpp',
'version.hpp'
]

Expand Down
Loading

0 comments on commit daa7703

Please sign in to comment.