mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 23:45:51 +00:00
deploy: 3cbdf818a7
This commit is contained in:
@@ -122,35 +122,40 @@ $(document).ready(function() { init_codefold(0); });
|
||||
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span><span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> </div>
|
||||
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span><span class="preprocessor">#define XRPL_ASSERT ALWAYS_OR_UNREACHABLE</span></div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span><span class="comment">// How to use the instrumentation macros:</span></div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span><span class="comment">//</span></div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span><span class="comment">// * XRPL_ASSERT if cond must be true but the line might not be reached during</span></div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span><span class="comment">// fuzzing. Same like `assert` in normal use.</span></div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span><span class="comment">// * ALWAYS if cond must be true _and_ the line must be reached during fuzzing.</span></div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span><span class="comment">// Same like `assert` in normal use.</span></div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span><span class="comment">// * REACHABLE if the line must be reached during fuzzing</span></div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span><span class="comment">// * SOMETIMES a hint for the fuzzer to try to make the cond true</span></div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span><span class="comment">// * UNREACHABLE if the line must not be reached (in fuzzing or in normal use).</span></div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span><span class="comment">// Same like `assert(false)` in normal use.</span></div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span><span class="comment">//</span></div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span><span class="comment">// NOTE: XRPL_ASSERT has similar semantics as C `assert` macro, with only minor</span></div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span><span class="comment">// differences:</span></div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span><span class="comment">// * XRPL_ASSERT must have an unique name (naming convention in CONTRIBUTING.md)</span></div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span><span class="comment">// * during fuzzing, the program will continue execution past failed XRPL_ASSERT</span></div>
|
||||
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span><span class="preprocessor">#define XRPL_ASSERT_PARTS(cond, function, description, ...) \</span></div>
|
||||
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span><span class="preprocessor"> XRPL_ASSERT(cond, function " : " description)</span></div>
|
||||
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> </div>
|
||||
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span><span class="comment">// How to use the instrumentation macros:</span></div>
|
||||
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span><span class="comment">//</span></div>
|
||||
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span><span class="comment">// * XRPL_ASSERT if cond must be true but the line might not be reached during</span></div>
|
||||
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span><span class="comment">// fuzzing. Same like `assert` in normal use.</span></div>
|
||||
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span><span class="comment">// * XRPL_ASSERT_PARTS is for convenience, and works like XRPL_ASSERT, but</span></div>
|
||||
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span><span class="comment">// splits the message param into "function" and "description", then joins</span></div>
|
||||
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span><span class="comment">// them with " : " before passing to XRPL_ASSERT.</span></div>
|
||||
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span><span class="comment">// * ALWAYS if cond must be true _and_ the line must be reached during fuzzing.</span></div>
|
||||
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span><span class="comment">// Same like `assert` in normal use.</span></div>
|
||||
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span><span class="comment">// * REACHABLE if the line must be reached during fuzzing</span></div>
|
||||
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span><span class="comment">// * SOMETIMES a hint for the fuzzer to try to make the cond true</span></div>
|
||||
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span><span class="comment">// * UNREACHABLE if the line must not be reached (in fuzzing or in normal use).</span></div>
|
||||
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span><span class="comment">// Same like `assert(false)` in normal use.</span></div>
|
||||
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span><span class="comment">//</span></div>
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span><span class="comment">// We continue to use regular C `assert` inside unit tests and inside constexpr</span></div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span><span class="comment">// functions.</span></div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span><span class="comment">//</span></div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span><span class="comment">// NOTE: UNREACHABLE does *not* have the same semantics as std::unreachable.</span></div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span><span class="comment">// The program will continue execution past an UNREACHABLE in a Release build</span></div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span><span class="comment">// and during fuzzing (similar to failed XRPL_ASSERT).</span></div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span><span class="comment">// Also, the naming convention in UNREACHABLE is subtly different from other</span></div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span><span class="comment">// instrumentation macros - its name describes the condition which was _not_</span></div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span><span class="comment">// meant to happen, while name in other macros describes the condition that is</span></div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span><span class="comment">// meant to happen (e.g. as in "assert that this happens").</span></div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> </div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span><span class="preprocessor">#endif</span></div>
|
||||
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span><span class="comment">// NOTE: XRPL_ASSERT has similar semantics as C `assert` macro, with only minor</span></div>
|
||||
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span><span class="comment">// differences:</span></div>
|
||||
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span><span class="comment">// * XRPL_ASSERT must have an unique name (naming convention in CONTRIBUTING.md)</span></div>
|
||||
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span><span class="comment">// * during fuzzing, the program will continue execution past failed XRPL_ASSERT</span></div>
|
||||
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span><span class="comment">//</span></div>
|
||||
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span><span class="comment">// We continue to use regular C `assert` inside unit tests and inside constexpr</span></div>
|
||||
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span><span class="comment">// functions.</span></div>
|
||||
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span><span class="comment">//</span></div>
|
||||
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span><span class="comment">// NOTE: UNREACHABLE does *not* have the same semantics as std::unreachable.</span></div>
|
||||
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span><span class="comment">// The program will continue execution past an UNREACHABLE in a Release build</span></div>
|
||||
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span><span class="comment">// and during fuzzing (similar to failed XRPL_ASSERT).</span></div>
|
||||
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span><span class="comment">// Also, the naming convention in UNREACHABLE is subtly different from other</span></div>
|
||||
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span><span class="comment">// instrumentation macros - its name describes the condition which was _not_</span></div>
|
||||
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span><span class="comment">// meant to happen, while name in other macros describes the condition that is</span></div>
|
||||
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span><span class="comment">// meant to happen (e.g. as in "assert that this happens").</span></div>
|
||||
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
|
||||
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span><span class="preprocessor">#endif</span></div>
|
||||
<div class="ttc" id="acassert_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/header/cassert.html">cassert</a></div></div>
|
||||
</div><!-- fragment --></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
|
||||
Reference in New Issue
Block a user