File tree Expand file tree Collapse file tree 3 files changed +13
-15
lines changed Expand file tree Collapse file tree 3 files changed +13
-15
lines changed Original file line number Diff line number Diff line change 1212#pragma once
1313
1414#include "assert.h"
15- #include <modm/architecture/interface/register.hpp>
1615%% if core.startswith("avr")
1716#include <modm/architecture/interface/accessor_flash.hpp>
1817%% endif
@@ -27,13 +26,13 @@ namespace modm
2726enum class
2827Abandonment : uint8_t
2928{
30- DontCare = Bit0 , ///< Do not care about failure.
31- Ignore = Bit1 , ///< Ignore this failure.
32- Fail = Bit2 , ///< This failure is reason for abandonment.
33- Debug = Bit7 ///< Only set for a debug-only failure.
29+ DontCare = 0b001 , ///< Do not care about failure.
30+ Ignore = 0b010 , ///< Ignore this failure.
31+ Fail = 0b100 , ///< This failure is reason for abandonment.
32+ Debug = 0x80, ///< Only set for a debug-only failure.
3433};
35- using AbandonmentBehavior = Flags8< Abandonment>;
36- MODM_TYPE_FLAGS( AbandonmentBehavior) ;
34+ /// Contains the superset of Abandonment behavior
35+ using AbandonmentBehavior = Abandonment ;
3736
3837/// Contains information about the failed assertion.
3938struct modm_packed
Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ class Assert(Module):
5353 default = "release" if platform == "hosted" else "debug" ,
5454 enumeration = ["off" , "debug" , "release" ]))
5555
56- module .depends (":architecture:register" )
5756 if platform == "avr" :
5857 module .depends (":architecture:accessor" )
5958 return True
Original file line number Diff line number Diff line change 5757modm_assert_report(_modm_assertion_info *cinfo)
5858{
5959 auto info = reinterpret_cast<modm::AssertionInfo *>(cinfo);
60- AbandonmentBehavior behavior(info->behavior);
60+ uint8_t behavior(uint8_t( info->behavior) );
6161
6262 for (const AssertionHandler *handler = &__assertion_table_start;
6363 handler < &__assertion_table_end; handler++)
6464 {
6565%% if core.startswith("avr")
66- behavior |= ((AssertionHandler)pgm_read_ptr(handler))(*info);
66+ behavior |= (uint8_t)( (AssertionHandler)pgm_read_ptr(handler))(*info);
6767%% else
68- behavior |= (*handler)(*info);
68+ behavior |= (uint8_t)( *handler)(*info);
6969%% endif
7070 }
7171
72- info->behavior = behavior;
73- behavior.reset (Abandonment::Debug);
74- if ((behavior == Abandonment::DontCare) or
75- (behavior & Abandonment::Fail))
72+ info->behavior = AbandonmentBehavior( behavior) ;
73+ behavior &= ~uint8_t (Abandonment::Debug);
74+ if ((behavior == uint8_t( Abandonment::DontCare) ) or
75+ (behavior & uint8_t( Abandonment::Fail) ))
7676 {
7777 modm_abandon(*info);
7878%% if core.startswith("cortex-m")
You can’t perform that action at this time.
0 commit comments