Fix warnings on clang 8 / GCC 9 (#645)

* Fix warnings on clang 8 / GCC 9

* Fix clangformat

* Update src/record/internal/matroska_read.cpp

Co-Authored-By: Matt Schulte <schultetwin1@gmail.com>
This commit is contained in:
Jacob Wirth 2019-08-15 16:00:36 -04:00 коммит произвёл GitHub
Родитель efbc942ca0
Коммит 13e9c07308
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 31 добавлений и 17 удалений

Просмотреть файл

@ -29,6 +29,11 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
# Added in clang 5
list(APPEND CLANG_ALL_WARNINGS "-Wno-zero-as-null-pointer-constant") # Allow zero as nullptr
endif()
if (NOT (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "8.0.0"))
# Added in clang 8
list(APPEND CLANG_ALL_WARNINGS "-Wno-extra-semi-stmt") # Allow semi-colons to be used after #define's
list(APPEND CLANG_ALL_WARNINGS "-Wno-atomic-implicit-seq-cst") # Allow use of __sync_add_and_fetch() atomic
endif()
set(CLANG_WARNINGS_AS_ERRORS "-Werror")
add_compile_options(${CLANG_ALL_WARNINGS})
add_compile_options(${CLANG_WARNINGS_AS_ERRORS})

2
extern/imgui/src поставляемый

@ -1 +1 @@
Subproject commit e0cab5664adf02c030f9cf2a05d2c334638a85f8
Subproject commit 6a0d0dab5a9f0b9518a2bc9bb456a69895ae0962

Просмотреть файл

@ -730,12 +730,15 @@ struct calibration : public k4a_calibration_t
*/
static calibration get_from_raw(char *raw_calibration,
size_t raw_calibration_size,
k4a_depth_mode_t depth_mode,
k4a_color_resolution_t color_resolution)
k4a_depth_mode_t target_depth_mode,
k4a_color_resolution_t target_color_resolution)
{
calibration calib;
k4a_result_t result =
k4a_calibration_get_from_raw(raw_calibration, raw_calibration_size, depth_mode, color_resolution, &calib);
k4a_result_t result = k4a_calibration_get_from_raw(raw_calibration,
raw_calibration_size,
target_depth_mode,
target_color_resolution,
&calib);
if (K4A_RESULT_SUCCEEDED != result)
{
@ -751,13 +754,13 @@ struct calibration : public k4a_calibration_t
*/
static calibration get_from_raw(uint8_t *raw_calibration,
size_t raw_calibration_size,
k4a_depth_mode_t depth_mode,
k4a_color_resolution_t color_resolution)
k4a_depth_mode_t target_depth_mode,
k4a_color_resolution_t target_color_resolution)
{
return get_from_raw(reinterpret_cast<char *>(raw_calibration),
raw_calibration_size,
depth_mode,
color_resolution);
target_depth_mode,
target_color_resolution);
}
/** Get the camera calibration for a device from a raw calibration blob.
@ -766,13 +769,13 @@ struct calibration : public k4a_calibration_t
* \sa k4a_calibration_get_from_raw
*/
static calibration get_from_raw(std::vector<uint8_t> &raw_calibration,
k4a_depth_mode_t depth_mode,
k4a_color_resolution_t color_resolution)
k4a_depth_mode_t target_depth_mode,
k4a_color_resolution_t target_color_resolution)
{
return get_from_raw(reinterpret_cast<char *>(raw_calibration.data()),
raw_calibration.size(),
depth_mode,
color_resolution);
target_depth_mode,
target_color_resolution);
}
};

Просмотреть файл

@ -21,6 +21,12 @@ typedef void(k4a_init_once_function_t)(void);
void global_init_once(k4a_init_once_t *init_once, k4a_init_once_function_t *init_function);
#ifdef __cplusplus
#define DEFAULT_INIT(type, field) field = type()
#else
#define DEFAULT_INIT(type, field) memset(&field, 0, sizeof(field))
#endif
/** Declares an initialized global context
*
* \param _global_type_
@ -41,7 +47,7 @@ void global_init_once(k4a_init_once_t *init_once, k4a_init_once_function_t *init
static _global_type_ _##_global_type_##_private; \
static void fn_##_global_type_##_init_function(void) \
{ \
memset(&_##_global_type_##_private, 0, sizeof(_##_global_type_##_private)); \
DEFAULT_INIT(_global_type_, _##_global_type_##_private); \
_init_function_(&_##_global_type_##_private); \
return; \
} \

Просмотреть файл

@ -193,7 +193,7 @@ k4a_result_t parse_mkv(k4a_playback_context_t *context)
if (check_element_type(e, &seek))
{
KaxSeekID &seek_id = GetChild<KaxSeekID>(*seek);
EbmlId ebml_id(seek_id.GetBuffer(), (const unsigned int)seek_id.GetSize());
EbmlId ebml_id(seek_id.GetBuffer(), static_cast<unsigned int>(seek_id.GetSize()));
int64_t seek_location = seek->Location();
assert(seek_location >= 0);
match_ebml_id(context, ebml_id, (uint64_t)seek_location);

Просмотреть файл

@ -495,7 +495,7 @@ TEST_F(depthmcu_ut, depthmcu_get_serialnum_non_ascii)
// Create a serial number with non-ACII characters
char mockSerialNumber[20];
memcpy(mockSerialNumber, "12\145\t67890\0WXYZ", sizeof("1234567890\0WXYZ"));
memcpy(mockSerialNumber, "12\145\t67890\0WXYZ", sizeof("12\145\t67890\0WXYZ"));
// If the implementation caches the result, only a single call may be made. Otherwise it may be called multiple
// times

Просмотреть файл

@ -92,7 +92,7 @@ void K4APointCloudWindow::Show(K4AWindowPlacementInfo placementInfo)
}
ImGui::SameLine();
ImGui::VerticalSeparator();
ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical);
ImGui::SameLine();
ImGui::TextDisabled("[Show Controls]");
const char *controlsHelpMessage = "Rotate: [Left Mouse] + Drag\n"