Skip to content

Commit cc16380

Browse files
committed
Fixed nullptr error when command line group names are invalid.
Improved CMake. Updated copyright.
1 parent 9d0b1e8 commit cc16380

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+152
-157
lines changed

CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Top level makefile for Celero
33
#
4-
# Copyright 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 John Farrier
4+
# Copyright 2015-2023 John Farrier
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -27,13 +27,15 @@ macro(CeleroSetDefaultCompilerOptions)
2727
set_target_properties(${PROJECT_NAME} PROPERTIES
2828
POSITION_INDEPENDENT_CODE "${CELERO_COMPILE_PIC}"
2929
)
30-
if(MSVC)
30+
31+
if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
3132
target_compile_options(${PROJECT_NAME} PRIVATE /D_VARIADIC_MAX=10 )
3233
target_compile_options(${PROJECT_NAME} PRIVATE /D_CRT_SECURE_NO_WARNINGS)
3334
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
34-
target_compile_options(${PROJECT_NAME} PRIVATE /MP)
3535
target_compile_options(${PROJECT_NAME} PRIVATE /D_SCL_SECURE_NO_WARNINGS)
3636
target_compile_options(${PROJECT_NAME} PRIVATE /permissive-)
37+
target_compile_options(${PROJECT_NAME} PRIVATE /MP)
38+
target_compile_definitions(${PROJECT_NAME} PRIVATE /wd4251)
3739

3840
if (NOT CELERO_COMPILE_DYNAMIC_LIBRARIES)
3941
if(VCPKG_CRT_LINKAGE)
@@ -203,12 +205,13 @@ else()
203205
endif()
204206

205207
CeleroSetDefaultCompilerOptions()
208+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
206209

207210
target_link_libraries(${PROJECT_NAME} ${SYSLIBS})
208211

209212
target_include_directories(${PROJECT_NAME} PUBLIC
210-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
211-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}>
213+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
214+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
212215
)
213216

214217
# ---------------------------------------------------------------------------

experiments/DemoFileWrite/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ target_sources(${PROJECT_NAME} PRIVATE
2525
)
2626

2727
CeleroSetDefaultCompilerOptions()
28+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
29+
2830
target_link_libraries(${PROJECT_NAME} celero)
2931
include_directories(${HEADER_PATH})
3032

experiments/DemoFileWrite/DemoFileWrite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class StdFileFixture : public BaseFixture
4747
void setUp(const celero::TestFixture::ExperimentValue& x) override
4848
{
4949
BaseFixture::setUp(x);
50-
this->file = fopen("FileWrite.out", "wb");
50+
fopen_s(&this->file , "FileWrite.out", "wb");
5151
}
5252

5353
void tearDown() override

experiments/DemoMultithread/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ SET(PROJECT_NAME CeleroDemo-Multithread)
4444
target_link_libraries(${PROJECT_NAME} celero)
4545

4646
CeleroSetDefaultCompilerOptions()
47+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4748

4849
# Broiler Plate: Add Celer's include directories.
4950
include_directories(${HEADER_PATH})

experiments/DemoSimple/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ add_executable(${PROJECT_NAME}
4141
target_link_libraries(${PROJECT_NAME} celero)
4242

4343
CeleroSetDefaultCompilerOptions()
44+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4445

4546
# Broiler Plate: Add Celer's include directories.
4647
include_directories(${HEADER_PATH})

experiments/DemoSimpleJUnit/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ add_executable(${PROJECT_NAME}
4444
target_link_libraries(${PROJECT_NAME} celero)
4545

4646
CeleroSetDefaultCompilerOptions()
47+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4748

4849
# Broiler Plate: Add Celer's include directories.
4950
include_directories(${HEADER_PATH})

experiments/DemoSleep/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ add_executable(${PROJECT_NAME}
4141
target_link_libraries(${PROJECT_NAME} celero)
4242

4343
CeleroSetDefaultCompilerOptions()
44+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4445

4546
# Broiler Plate: Add Celer's include directories.
4647
include_directories(${HEADER_PATH})

experiments/DemoToString/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ add_executable(${PROJECT_NAME}
4444
target_link_libraries(${PROJECT_NAME} celero)
4545

4646
CeleroSetDefaultCompilerOptions()
47+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4748

4849
# Broiler Plate: Add Celer's include directories.
4950
include_directories(${HEADER_PATH})

experiments/DemoTransform/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ add_executable(${PROJECT_NAME}
4141
target_link_libraries(${PROJECT_NAME} celero)
4242

4343
CeleroSetDefaultCompilerOptions()
44+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4445

4546
# Broiler Plate: Add Celer's include directories.
4647
include_directories(${HEADER_PATH})

experiments/ExperimentCompressBools/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
4646
target_link_libraries(${PROJECT_NAME} celero)
4747

4848
CeleroSetDefaultCompilerOptions()
49+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4950

5051
# Broiler Plate: Add Celer's include directories.
5152
include_directories(${HEADER_PATH})

experiments/ExperimentCostDoNotOptimizeAway/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ add_executable(${PROJECT_NAME}
4444
target_link_libraries(${PROJECT_NAME} celero)
4545

4646
CeleroSetDefaultCompilerOptions()
47+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4748

4849
# Broiler Plate: Add Celer's include directories.
4950
include_directories(${HEADER_PATH})

experiments/ExperimentCostOfPimpl/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ add_executable(${PROJECT_NAME}
4444
target_link_libraries(${PROJECT_NAME} celero)
4545

4646
CeleroSetDefaultCompilerOptions()
47+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4748

4849
# Broiler Plate: Add Celer's include directories.
4950
include_directories(${HEADER_PATH})

experiments/ExperimentCostSharedPtr/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ SET(PROJECT_NAME CeleroExperiment-CostOfSharedPtr)
3838
target_link_libraries(${PROJECT_NAME} celero)
3939

4040
CeleroSetDefaultCompilerOptions()
41+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4142

4243
# Broiler Plate: Add Celer's include directories.
4344
include_directories(${HEADER_PATH})

experiments/ExperimentParameterPassing/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ add_executable(${PROJECT_NAME}
4444
target_link_libraries(${PROJECT_NAME} celero)
4545

4646
CeleroSetDefaultCompilerOptions()
47+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4748

4849
# Broiler Plate: Add Celer's include directories.
4950
include_directories(${HEADER_PATH})

experiments/ExperimentParticles/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ SET(PROJECT_NAME CeleroExperiment-Particles)
4545
target_link_libraries(${PROJECT_NAME} celero)
4646

4747
CeleroSetDefaultCompilerOptions()
48+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4849

4950
# Broiler Plate: Add Celer's include directories.
5051
include_directories(${HEADER_PATH})

experiments/ExperimentSimpleComparison/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ SET(PROJECT_NAME CeleroExperiment-SimpleComparison)
4444
target_link_libraries(${PROJECT_NAME} celero)
4545

4646
CeleroSetDefaultCompilerOptions()
47+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4748

4849
# Broiler Plate: Add Celer's include directories.
4950
include_directories(${HEADER_PATH})

experiments/ExperimentSortingRandomInts/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ add_executable(${PROJECT_NAME}
4444
target_link_libraries(${PROJECT_NAME} celero)
4545

4646
CeleroSetDefaultCompilerOptions()
47+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4748

4849
# Broiler Plate: Add Celer's include directories.
4950
include_directories(${HEADER_PATH})

experiments/ExperimentSortingRandomIntsUDM/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ add_executable(${PROJECT_NAME}
4545
target_link_libraries(${PROJECT_NAME} celero)
4646

4747
CeleroSetDefaultCompilerOptions()
48+
target_compile_options(${PROJECT_NAME} PRIVATE /wd4251)
4849

4950
# Broiler Plate: Add Celer's include directories.
5051
include_directories(${HEADER_PATH})

include/celero/Archive.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#ifndef H_CELERO_ARCHIVE_H
2-
#define H_CELERO_ARCHIVE_H
1+
#pragma once
32

43
///
54
/// \author John Farrier
65
///
7-
/// \copyright Copyright 2015-2021 John Farrier
6+
/// \copyright Copyright 2015-2023 John Farrier
87
///
98
/// Licensed under the Apache License, Version 2.0 (the "License");
109
/// you may not use this file except in compliance with the License.
@@ -96,5 +95,3 @@ namespace celero
9695
Pimpl<Impl> pimpl;
9796
};
9897
} // namespace celero
99-
100-
#endif

include/celero/Benchmark.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#ifndef H_CELERO_BENCHMARK_H
2-
#define H_CELERO_BENCHMARK_H
1+
#pragma once
32

43
///
54
/// \author John Farrier
65
///
7-
/// \copyright Copyright 2015-2021 John Farrier
6+
/// \copyright Copyright 2015-2023 John Farrier
87
///
98
/// Licensed under the Apache License, Version 2.0 (the "License");
109
/// you may not use this file except in compliance with the License.
@@ -109,4 +108,3 @@ namespace celero
109108
};
110109
} // namespace celero
111110

112-
#endif

include/celero/Callbacks.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
#ifndef H_CELERO_CALLBACKS_H
2-
#define H_CELERO_CALLBACKS_H
1+
#pragma once
32

43
///
54
/// \namespace celero
65
///
76
/// \author John Farrier
87
///
9-
/// \copyright Copyright 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 John Farrier
8+
/// \copyright Copyright 2015-2023 John Farrier
109
///
1110
/// Licensed under the Apache License, Version 2.0 (the "License");
1211
/// you may not use this file except in compliance with the License.
@@ -62,4 +61,3 @@ namespace celero
6261
} // namespace impl
6362
} // namespace celero
6463

65-
#endif

include/celero/Celero.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
#ifndef H_CELERO_CELERO_H
2-
#define H_CELERO_CELERO_H
1+
#pragma once
32

43
///
54
/// \namespace celero
65
///
76
/// \author John Farrier
87
///
9-
/// \copyright Copyright 2015-2021 John Farrier
8+
/// \copyright Copyright 2015-2023 John Farrier
109
///
1110
/// Licensed under the Apache License, Version 2.0 (the "License");
1211
/// you may not use this file except in compliance with the License.
@@ -312,4 +311,3 @@ namespace celero
312311
#define BASELINE_FIXED_T(groupName, baselineName, fixtureName, iterations, threads, useconds) \
313312
BASELINE_IMPL(groupName, baselineName, fixtureName, 1, iterations, threads, useconds)
314313

315-
#endif

include/celero/CommandLine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ namespace cmdline
159159
cmdline_error(const std::string &msg) : msg(msg)
160160
{
161161
}
162-
~cmdline_error() throw()
162+
~cmdline_error() noexcept
163163
{
164164
}
165165
const char *what() const throw()

include/celero/Console.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#ifndef H_CELERO_CONSOLE_H
2-
#define H_CELERO_CONSOLE_H
1+
#pragma once
32

43
///
54
/// \author John Farrier
65
///
7-
/// \copyright Copyright 2015-2021 John Farrier
6+
/// \copyright Copyright 2015-2023 John Farrier
87
///
98
/// Licensed under the Apache License, Version 2.0 (the "License");
109
/// you may not use this file except in compliance with the License.
@@ -62,4 +61,3 @@ namespace celero
6261
} // namespace console
6362
} // namespace celero
6463

65-
#endif

include/celero/Distribution.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#ifndef H_CELERO_DISTRIBUTION_H
2-
#define H_CELERO_DISTRIBUTION_H
1+
#pragma once
32

43
///
54
/// \author John Farrier
65
///
7-
/// \copyright Copyright 2015-2021 John Farrier
6+
/// \copyright Copyright 2015-2023 John Farrier
87
///
98
/// Licensed under the Apache License, Version 2.0 (the "License");
109
/// you may not use this file except in compliance with the License.
@@ -36,4 +35,3 @@ namespace celero
3635
CELERO_EXPORT void RunDistribution(uint64_t iterationsPerSample);
3736
}
3837

39-
#endif

include/celero/Exceptions.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#ifndef H_CELERO_EXCEPTIONS_H
2-
#define H_CELERO_EXCEPTIONS_H
1+
#pragma once
32

43
///
54
/// \author Peter Azmanov
65
///
7-
/// \copyright Copyright 2015-2021 John Farrier
6+
/// \copyright Copyright 2015-2023 John Farrier
87
///
98
/// Licensed under the Apache License, Version 2.0 (the "License");
109
/// you may not use this file except in compliance with the License.
@@ -61,4 +60,3 @@ namespace celero
6160
const celero::TestFixture::ExperimentValue& experimentValue);
6261
} // namespace celero
6362

64-
#endif

include/celero/Executor.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#ifndef H_CELERO_EXECUTOR_H
2-
#define H_CELERO_EXECUTOR_H
1+
#pragma once
32

43
///
54
/// \author John Farrier
65
///
7-
/// \copyright Copyright 2015-2021 John Farrier
6+
/// \copyright Copyright 2015-2023 John Farrier
87
///
98
/// Licensed under the Apache License, Version 2.0 (the "License");
109
/// you may not use this file except in compliance with the License.
@@ -79,4 +78,3 @@ namespace celero
7978
}
8079
}
8180

82-
#endif

include/celero/Experiment.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#ifndef H_CELERO_EXPERIMENT_H
2-
#define H_CELERO_EXPERIMENT_H
1+
#pragma once
32

43
///
54
/// \author John Farrier
65
///
7-
/// \copyright Copyright 2015-2021 John Farrier
6+
/// \copyright Copyright 2015-2023 John Farrier
87
///
98
/// Licensed under the Apache License, Version 2.0 (the "License");
109
/// you may not use this file except in compliance with the License.
@@ -192,4 +191,3 @@ namespace celero
192191
};
193192
} // namespace celero
194193

195-
#endif

include/celero/ExperimentResult.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#ifndef H_CELERO_EXPERIMENTRESULT_H
2-
#define H_CELERO_EXPERIMENTRESULT_H
1+
#pragma once
32

43
///
54
/// \author John Farrier
65
///
7-
/// \copyright Copyright 2015-2021 John Farrier
6+
/// \copyright Copyright 2015-2023 John Farrier
87
///
98
/// Licensed under the Apache License, Version 2.0 (the "License");
109
/// you may not use this file except in compliance with the License.
@@ -174,4 +173,3 @@ namespace celero
174173
};
175174
} // namespace celero
176175

177-
#endif

include/celero/Export.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#ifndef H_CELERO_EXPORT_H
2-
#define H_CELERO_EXPORT_H
1+
#pragma once
32

43
///
54
/// \author John Farrier
65
///
7-
/// \copyright Copyright 2015-2021 John Farrier
6+
/// \copyright Copyright 2015-2023 John Farrier
87
///
98
/// Licensed under the Apache License, Version 2.0 (the "License");
109
/// you may not use this file except in compliance with the License.
@@ -37,4 +36,3 @@
3736
#endif
3837
#endif
3938

40-
#endif

0 commit comments

Comments
 (0)