Skip to content

Instantly share code, notes, and snippets.

@sas
Created January 28, 2020 19:58
Show Gist options
  • Save sas/aff8c40a9094c05b321a3549de961857 to your computer and use it in GitHub Desktop.
Save sas/aff8c40a9094c05b321a3549de961857 to your computer and use it in GitHub Desktop.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35e3b349..262dcadb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
# C++ is by default. C99 is not supported.
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else ()
message(WARNING "Compiler not supported to enable C++11.")
diff --git a/Libraries/libcar/Headers/car/car_format.h b/Libraries/libcar/Headers/car/car_format.h
index 597cdc32..27f3af11 100755
--- a/Libraries/libcar/Headers/car/car_format.h
+++ b/Libraries/libcar/Headers/car/car_format.h
@@ -34,6 +34,7 @@
#include <libutil/CompilerSupport.h>
+#include <assert.h>
#include <stdint.h>
#ifdef __cplusplus
@@ -209,12 +210,13 @@ LIBUTIL_PACKED_STRUCT_BEGIN struct car_extended_metadata {
char contents[1024]; // string
} LIBUTIL_PACKED_STRUCT_END;
-LIBUTIL_PACKED_STRUCT_BEGIN struct car_key_format {
+struct car_key_format {
char magic[4]; // 'tmfk'
uint32_t reserved;
uint32_t num_identifiers;
uint32_t identifier_list[0];
-} LIBUTIL_PACKED_STRUCT_END;
+};
+static_assert(sizeof(struct car_key_format) == 12, "invalid size for struct car_key_format");
// length is key length
typedef char car_facet_key;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment