From b98bc034ae08e906aefa156eb19728612f7ff605 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 18 Apr 2017 15:26:27 -0500 Subject: [PATCH] Replace c_assert hack with static_assert --- Marlin/configuration_store.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index c87a15867c..cc8546b664 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -339,7 +339,10 @@ void MarlinSettings::postprocess() { #if ENABLED(MESH_BED_LEVELING) // Compile time test that sizeof(mbl.z_values) is as expected - typedef char c_assert[(sizeof(mbl.z_values) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(dummy)) ? 1 : -1]; + static_assert( + sizeof(mbl.z_values) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(mbl.z_values[0][0]), + "MBL Z array is the wrong size." + ); const bool leveling_is_on = TEST(mbl.status, MBL_STATUS_HAS_MESH_BIT); const uint8_t mesh_num_x = GRID_MAX_POINTS_X, mesh_num_y = GRID_MAX_POINTS_Y; EEPROM_WRITE(leveling_is_on); @@ -381,7 +384,10 @@ void MarlinSettings::postprocess() { #if ENABLED(AUTO_BED_LEVELING_BILINEAR) // Compile time test that sizeof(bed_level_grid) is as expected - typedef char c_assert[(sizeof(bed_level_grid) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(dummy)) ? 1 : -1]; + static_assert( + sizeof(bed_level_grid) == (GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y) * sizeof(bed_level_grid[0][0]), + "Bilinear Z array is the wrong size." + ); const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y; EEPROM_WRITE(grid_max_x); // 1 byte EEPROM_WRITE(grid_max_y); // 1 byte