Skip to content

Commit

Permalink
C++20 related fixes
Browse files Browse the repository at this point in the history
- Drop unneeded pragma
- Use std compliant __VA_OPT__ rather than ##__VA_ARGS__ extension.
  • Loading branch information
ktf committed Jan 13, 2025
1 parent 92166c6 commit d5d6af8
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 33 deletions.
3 changes: 0 additions & 3 deletions Framework/Core/src/ArrowSupport.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
#include <boost/program_options/variables_map.hpp>
#include <csignal>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
namespace o2::framework
{

Expand Down Expand Up @@ -596,4 +594,3 @@ o2::framework::ServiceSpec ArrowSupport::arrowTableSlicingCacheSpec()
}

} // namespace o2::framework
#pragma GGC diagnostic pop
4 changes: 0 additions & 4 deletions Framework/Core/src/CallbacksPolicy.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
#include <cstdlib>
#include <uv.h>

// This is to allow C++20 aggregate initialisation
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"

namespace o2::framework
{

Expand Down
4 changes: 0 additions & 4 deletions Framework/Core/src/CommonMessageBackends.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
#include <boost/program_options/variables_map.hpp>
#include <csignal>

// This is to allow C++20 aggregate initialisation
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"

namespace o2::framework
{

Expand Down
5 changes: 0 additions & 5 deletions Framework/Core/src/CommonServices.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ using Metric = o2::monitoring::Metric;
using Key = o2::monitoring::tags::Key;
using Value = o2::monitoring::tags::Value;

// This is to allow C++20 aggregate initialisation
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"

O2_DECLARE_DYNAMIC_LOG(data_processor_context);
O2_DECLARE_DYNAMIC_LOG(stream_context);
O2_DECLARE_DYNAMIC_LOG(async_queue);
Expand Down Expand Up @@ -1327,4 +1323,3 @@ std::vector<ServiceSpec> CommonServices::arrowServices()
}

} // namespace o2::framework
#pragma GCC diagnostic pop
3 changes: 0 additions & 3 deletions Framework/Core/src/runDataProcessing.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@
#include <unistd.h>
#include <execinfo.h>
#include <cfenv>
// This is to allow C++20 aggregate initialisation
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#if defined(__linux__) && __has_include(<sched.h>)
#include <sched.h>
#elif __has_include(<linux/getcpu.h>)
Expand Down
4 changes: 0 additions & 4 deletions Framework/Core/test/test_ComputingQuotaEvaluator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include "Framework/ServiceRegistryHelpers.h"
#include "uv.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
using namespace o2::framework;

TEST_CASE("TestComputingQuotaEvaluator")
Expand Down Expand Up @@ -219,5 +217,3 @@ TEST_CASE("TestComputingQuotaEvaluator")
REQUIRE(evaluator.mOffers[1].valid == false);
REQUIRE(evaluator.mOffers[2].valid == false);
}

#pragma GGC diagnostic pop
5 changes: 0 additions & 5 deletions Framework/Core/test/test_DataProcessorSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#include "Framework/DataProcessorSpecHelpers.h"
#include "Framework/ConfigParamSpec.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"

TEST_CASE("TestDataProcessorSpecHelpers")
{
using namespace o2::framework;
Expand All @@ -35,5 +32,3 @@ TEST_CASE("TestDataProcessorSpecHelpers")
REQUIRE(DataProcessorSpecHelpers::hasLabel(spec, "label2") == false);
REQUIRE(DataProcessorSpecHelpers::hasLabel(spec, "label3") == true);
}

#pragma diagnostic pop
9 changes: 4 additions & 5 deletions Framework/Foundation/include/Framework/Signpost.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ o2_log_handle_t* o2_walk_logs(bool (*callback)(char const* name, void* log, void
#include <os/log.h>
#include <os/signpost.h>
#include <cstring>
#define O2_LOG_DEBUG_MAC(log, ...) os_log_debug(private_o2_log_##log, __VA_ARGS__)
// FIXME: use __VA_OPT__ when available in C++20
#define O2_SIGNPOST_EVENT_EMIT_MAC(log, id, name, format, ...) os_signpost_event_emit(private_o2_log_##log->os_log, (uint64_t)id.value, name, format, ##__VA_ARGS__)
#define O2_SIGNPOST_START_MAC(log, id, name, format, ...) os_signpost_interval_begin(private_o2_log_##log->os_log, (uint64_t)id.value, name, format, ##__VA_ARGS__)
#define O2_SIGNPOST_END_MAC(log, id, name, format, ...) os_signpost_interval_end(private_o2_log_##log->os_log, (uint64_t)id.value, name, format, ##__VA_ARGS__)
#define O2_LOG_DEBUG_MAC(log, format, ...) os_log_debug(private_o2_log_##log, format __VA_OPT__(, ) __VA_ARGS__)
#define O2_SIGNPOST_EVENT_EMIT_MAC(log, id, name, format, ...) os_signpost_event_emit(private_o2_log_##log->os_log, (uint64_t)id.value, name, format __VA_OPT__(, ) __VA_ARGS__)
#define O2_SIGNPOST_START_MAC(log, id, name, format, ...) os_signpost_interval_begin(private_o2_log_##log->os_log, (uint64_t)id.value, name, format __VA_OPT__(, ) __VA_ARGS__)
#define O2_SIGNPOST_END_MAC(log, id, name, format, ...) os_signpost_interval_end(private_o2_log_##log->os_log, (uint64_t)id.value, name, format __VA_OPT__(, ) __VA_ARGS__)
#define O2_SIGNPOST_ENABLED_MAC(log) os_signpost_enabled(private_o2_log_##log->os_log)
#else
// These are no-ops on linux.
Expand Down

0 comments on commit d5d6af8

Please sign in to comment.