From 761e9cf0a388c5ff8e92a454de287d66fe79b041 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Thu, 27 Apr 2017 11:28:06 +0200
Subject: [PATCH] O0 optimisation for measurements test to work

---
 alib2common/makefile                                   | 3 ++-
 alib2common/test-src/measurements/MeasurementsTest.cpp | 2 --
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/alib2common/makefile b/alib2common/makefile
index 844acb01e3..14a7255ce0 100644
--- a/alib2common/makefile
+++ b/alib2common/makefile
@@ -149,8 +149,9 @@ obj-debug/: FORCE obj-debug/makefile
 obj-release/: FORCE obj-release/makefile
 	$(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE"
 
+# O0 here not to optimize measurement tests
 test-obj-debug/: FORCE test-obj-debug/makefile
-	$(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG"
+	$(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -O0 -DDEBUG"
 
 test-obj-release/: FORCE test-obj-release/makefile
 	$(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE"
diff --git a/alib2common/test-src/measurements/MeasurementsTest.cpp b/alib2common/test-src/measurements/MeasurementsTest.cpp
index cec34aef6b..71d33b9568 100644
--- a/alib2common/test-src/measurements/MeasurementsTest.cpp
+++ b/alib2common/test-src/measurements/MeasurementsTest.cpp
@@ -84,9 +84,7 @@ void MeasurementsTest::testMemoryMeasurements ( ) {
 
 	measurements::start ( "chunk1", measurements::Type::MAIN );
 	int * baz = new int[500];
-
 	measurements::end ( );
-
 	delete[] baz;
 
 	int * foo = new int[1000];
-- 
GitLab