File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5353#undef Expects
5454#undef Ensures
5555
56- #define Expects (cond ) \
57- do { \
58- if (UNLIKELY (not (cond))) { \
59- std::cerr << " OS: Precondition (" OS_STRINGIFY (cond) \
60- << " ) failed...\n " << " \t ...in function: " \
61- << __func__ << " @" << __FILE__ << " :" \
62- << __LINE__ << ' \n ' ; \
63- std::terminate (); \
64- } \
65- } while (0 )
56+ #define Expects (cond ) \
57+ assert (LIKELY(cond) && " OS: Precondition failed" )
6658
67- #define Ensures (cond ) \
68- do { \
69- if (UNLIKELY (not (cond))) { \
70- std::cerr << " OS: Postcondition (" OS_STRINGIFY (cond) \
71- << " ) failed...\n " << " \t ...in function: " \
72- << __func__ << " @" << __FILE__ << " :" \
73- << __LINE__ << ' \n ' ; \
74- std::terminate (); \
75- } \
76- } while (0 )
59+ #define Ensures (cond ) \
60+ assert (LIKELY(cond) && " OS: Postcondition failed" )
7761
7862#endif // < defined(OS_TERMINATE_ON_CONTRACT_VIOLATION)
7963
Original file line number Diff line number Diff line change @@ -105,13 +105,11 @@ namespace net {
105105
106106 Byte* ip_data () noexcept __attribute__((assume_aligned(4 )))
107107 {
108- Expects ((size_t )(data_end () - layer_begin ()) >= sizeof (IP4::header));
109108 return layer_begin () + ip_header_length ();
110109 }
111110
112111 const Byte* ip_data () const noexcept __attribute__((assume_aligned(4 )))
113112 {
114- Expects ((size_t )(data_end () - layer_begin ()) >= sizeof (IP4::header));
115113 return layer_begin () + ip_header_length ();
116114 }
117115
You can’t perform that action at this time.
0 commit comments