Skip to content

Commit 27da4cf

Browse files
committed
remove custom define "DEBUG_BUILD" and use standard define NDEBUG
1 parent f871505 commit 27da4cf

File tree

10 files changed

+14
-23
lines changed

10 files changed

+14
-23
lines changed

src/application.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "helper/console_helpers.hpp"
2121
#endif
2222

23-
#ifdef DEBUG_BUILD
23+
#if !defined(NDEBUG)
2424
#include "graphics/text.hpp"
2525
#endif
2626

@@ -58,7 +58,7 @@ Application::Application(std::shared_ptr<Window>&& window, const std::vector<std
5858
void Application::run() {
5959
m_event_dispatcher.register_listener(this);
6060

61-
#ifdef DEBUG_BUILD
61+
#if !defined(NDEBUG)
6262
auto start_time = SDL_GetPerformanceCounter();
6363
const auto update_time = SDL_GetPerformanceFrequency() / 2; //0.5 s
6464
const auto count_per_s = static_cast<double>(SDL_GetPerformanceFrequency());
@@ -84,7 +84,7 @@ void Application::run() {
8484
render();
8585
m_renderer.present();
8686

87-
#ifdef DEBUG_BUILD
87+
#if !defined(NDEBUG)
8888
++frame_counter;
8989

9090
const Uint64 current_time = SDL_GetPerformanceCounter();
@@ -244,7 +244,7 @@ void Application::render() const {
244244
for (const auto& scene : m_scene_stack) {
245245
scene->render(*this);
246246
}
247-
#ifdef DEBUG_BUILD
247+
#if !defined(NDEBUG)
248248
m_fps_text->render(*this);
249249
#endif
250250
}
@@ -266,7 +266,7 @@ void Application::initialize() {
266266

267267
this->load_resources();
268268

269-
#ifdef DEBUG_BUILD
269+
#if !defined(NDEBUG)
270270
m_fps_text = std::make_unique<ui::Label>(
271271
this, "FPS: ?", font_manager().get(FontId::Default), Color::white(),
272272
std::pair<double, double>{ 0.95, 0.95 },

src/application.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct Application final : public EventListener, public ServiceProvider {
3434
std::unique_ptr<FontManager> m_font_manager;
3535

3636

37-
#ifdef DEBUG_BUILD
37+
#if !defined(NDEBUG)
3838
std::unique_ptr<ui::Label> m_fps_text{ nullptr };
3939
#endif
4040

src/discord/core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void DiscordInstance::after_setup() {
5050

5151

5252
core->SetLogHook(
53-
#ifdef DEBUG_BUILD
53+
#if !defined(NDEBUG)
5454
discord::LogLevel::Debug
5555
#else
5656
discord::LogLevel::Error

src/game/tetrion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ void Tetrion::lock_active_tetromino(const SimulationStep simulation_step_index)
452452
reset_lock_delay(simulation_step_index);
453453

454454
// save a snapshot on every freeze (only in debug builds)
455-
#ifdef DEBUG_BUILD
455+
#if !defined(NDEBUG)
456456
if (m_recording_writer) {
457457
spdlog::debug("adding snapshot at step {}", simulation_step_index);
458458
(*m_recording_writer)->add_snapshot(m_tetrion_index, simulation_step_index, core_information());

src/helper/parse_json.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11

22
#pragma once
33

4-
#ifdef DEBUG_BUILD
4+
#if !defined(NDEBUG)
55
// better json error messages, see https://json.nlohmann.me/api/macros/json_diagnostics/
66
#define JSON_DIAGNOSTICS 1 // NOLINT(cppcoreguidelines-macro-usage)
77
#endif
8+
89
#include <nlohmann/json.hpp>
910

1011
#include "helper/expected.hpp"

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main(int argc, char** argv) {
4141
auto combined_logger = std::make_shared<spdlog::logger>("combined_logger", begin(sinks), end(sinks));
4242
spdlog::set_default_logger(combined_logger);
4343

44-
#ifdef DEBUG_BUILD
44+
#if !defined(NDEBUG)
4545
spdlog::set_level(spdlog::level::debug);
4646
#else
4747
spdlog::set_level(spdlog::level::err);

src/manager/music_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void MusicManager::hook_music_finished() {
241241

242242

243243
[[nodiscard]] helper::optional<double> MusicManager::get_volume() const {
244-
#ifdef DEBUG_BUILD
244+
#if !defined(NDEBUG)
245245
int result = Mix_VolumeMusic(-1);
246246
if (result == 0) {
247247
return helper::nullopt;

src/scenes/about_page/about_page.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace scenes {
2525

2626
auto focus_helper = ui::FocusHelper{ 1 };
2727

28-
#ifdef DEBUG_BUILD
28+
#if !defined(NDEBUG)
2929
m_main_grid.add<ui::Label>(
3030
service_provider, fmt::format("Git Commit: {}", utils::git_commit()),
3131
service_provider->font_manager().get(FontId::Default), Color::white(),

src/ui/layouts/focus_layout.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ ui::FocusLayout::handle_event_result(const helper::optional<ui::Widget::InnerSta
231231
}
232232
}
233233

234-
#ifdef DEBUG_BUILD
234+
#if !defined(NDEBUG)
235235
// this works, since result is sorted already
236236
const auto duplicates = std::ranges::adjacent_find(result);
237237
if (duplicates != result.cend()) {

tools/options/meson.build

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,3 @@ elif cpp.get_id() == 'clang'
6161
endif
6262

6363
endif
64-
65-
if (
66-
get_option('buildtype') == 'debug'
67-
or get_option('buildtype') == 'debugoptimized'
68-
)
69-
#TODO: replace with ! NDEBUG in cpp files and remove this
70-
core_lib += {
71-
'compile_args': [core_lib.get('compile_args'), '-DDEBUG_BUILD'],
72-
}
73-
endif

0 commit comments

Comments
 (0)