Skip to content

Commit 6085213

Browse files
committed
[C++]: address aeron-io#273 by adding virtual destructors to some interface classes. Add rt link for those Linuxes that need it. Add more STDC_LIMIT_MACROS sets to build.
1 parent 5fb0009 commit 6085213

File tree

12 files changed

+29
-3
lines changed

12 files changed

+29
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
1717

1818
include(ExternalProject)
19+
include(CheckLibraryExists)
1920

2021
enable_testing()
2122

examples/cpp98/SbeOtfDecoder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
#include <stdlib.h>
2121
#include <stdint.h>
2222
#else
23+
#define __STDC_LIMIT_MACROS 1
24+
#include <stdint.h>
2325
#include <sys/types.h>
2426
#include <sys/uio.h>
2527
#include <unistd.h>
2628
#include <sys/stat.h>
2729
#include <stdio.h>
2830
#include <stdlib.h>
29-
#include <stdint.h>
3031
#endif /* WIN32 */
3132

3233
#include <iostream>

main/cpp/otf_api/Ir.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
#define __STDC_LIMIT_MACROS 1
18+
#include <stdint.h>
1719
#include <stdio.h>
1820
#include <iostream>
1921
#include <sys/types.h>

main/cpp/otf_api/Ir.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#ifndef _IR_H_
1717
#define _IR_H_
1818

19+
#define __STDC_LIMIT_MACROS 1
1920
#include <stdint.h>
2021
#include <string.h>
2122

@@ -143,6 +144,8 @@ class Ir
143144
* \return Ir for the message
144145
*/
145146
virtual Ir *irForTemplateId(const int templateId, const int version) = 0;
147+
148+
virtual ~Callback() {}
146149
};
147150

148151
// constructors and destructors

main/cpp/otf_api/Listener.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef _LISTENER_H_
1818
#define _LISTENER_H_
1919

20+
#define __STDC_LIMIT_MACROS 1
2021
#include <stdint.h>
2122
#include <string.h>
2223

@@ -115,6 +116,8 @@ class Listener
115116
return *this;
116117
}
117118

119+
virtual ~Listener() {}
120+
118121
/**
119122
* \brief Reset state and initialize for decode of the given buffer.
120123
*

main/cpp/otf_api/OnCompleted.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class OnCompleted
3131
* \return 0 for success and -1 for failure
3232
*/
3333
virtual int onCompleted(void) = 0;
34+
35+
virtual ~OnCompleted() {}
3436
};
3537

3638
} // namepsace on_the_fly

main/cpp/otf_api/OnError.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class OnError
5252
* \sa Error
5353
*/
5454
virtual int onError(const Error &error) = 0;
55+
56+
virtual ~OnError() {}
5557
};
5658

5759
} // namepsace on_the_fly

main/cpp/otf_api/OnNext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ class OnNext
4545
* \sa Group
4646
*/
4747
virtual int onNext(const Group &group) = 0;
48+
49+
virtual ~OnNext() {}
4850
};
4951

5052
} // namepsace on_the_fly

main/cpp/sbe/sbe.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#ifndef _SBE_HPP_
1717
#define _SBE_HPP_
1818

19+
#define __STDC_LIMIT_MACROS 1
1920
#include <string.h>
20-
#define __STDC_LIMIT_MACROS
2121
#include <stdint.h>
2222
#include <limits.h>
2323
#include <stdexcept>

perf/cpp/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
find_package(Java REQUIRED)
1818
find_package(Protobuf)
1919

20+
CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
21+
2022
if(CMAKE_BUILD_TYPE STREQUAL "Release")
2123
message("Build type(${CMAKE_BUILD_TYPE}): perf tests turning OFF bounds checks")
2224
add_definitions(-DNDEBUG)
@@ -47,6 +49,11 @@ add_executable(benchlet-sbe-md-runner ${SRCS_BENCHLET_MAIN} MarketDataBench.cpp)
4749
add_dependencies(benchlet-sbe-md-runner perf_codecs)
4850
add_dependencies(benchlet-sbe-car-runner perf_codecs)
4951

52+
if (HAVE_CLOCK_GETTIME_RT)
53+
target_link_libraries(benchlet-sbe-md-runner rt)
54+
target_link_libraries(benchlet-sbe-car-runner rt)
55+
endif (HAVE_CLOCK_GETTIME_RT)
56+
5057
if(USE_PROTOBUF)
5158
set(PROTOBUF_CAR_SCHEMA ${CODEC_TARGET_DIR}/protobuf/car.proto)
5259
set(PROTOBUF_MD_SCHEMA ${CODEC_TARGET_DIR}/protobuf/fix-messages.proto)

0 commit comments

Comments
 (0)