]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Move unwind frame flags into an enum
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 29 Apr 2025 23:08:14 +0000 (19:08 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 30 Apr 2025 20:22:48 +0000 (16:22 -0400)
src/lib/unlang/unlang_priv.h
src/tests/keywords/timeout-catch [deleted file]

index 01e9f4c0eb70d4b1c3ad46f18e548a6d099f53e9..1e8f345d27a7525ba042a3bf345fbb6be73da566 100644 (file)
@@ -95,6 +95,19 @@ typedef enum {
 #define UNLANG_DETACHABLE      (true)
 #define UNLANG_NORMAL_CHILD    (false)
 
+DIAG_OFF(attributes)
+typedef enum CC_HINT(flag_enum) {
+       UNWIND_FRAME_FLAG_NONE                  = 0x00,                 //!< No flags.
+       UNWIND_FRAME_FLAG_REPEAT                = 0x01,                 //!< Repeat the frame on the way up the stack.
+       UNWIND_FRAME_FLAG_TOP_FRAME             = 0x02,                 //!< are we the top frame of the stack?
+                                                                       ///< If true, causes the interpreter to stop
+                                                                       ///< interpreting and return, control then passes
+                                                                       ///< to whatever called the interpreter.
+       UNWIND_FRAME_FLAG_YIELDED               = 0x04,                 //!< frame has yielded
+       UNWIND_FRAME_FLAG_CANCEL                = 0x08,                 //!< This frame has been marked up for cancellation.
+} unlang_frame_flag_t;
+DIAG_ON(attributes)
+
 typedef struct unlang_s unlang_t;
 typedef struct unlang_stack_frame_s unlang_stack_frame_t;
 
@@ -305,8 +318,7 @@ struct unlang_stack_frame_s {
        rindent_t               indent;                         //!< Indent level of the request when the frame was
                                                                ///< created.  This is used to restore the indent
                                                                ///< level when the stack is being forcefully unwound.
-       uint8_t                 uflags;                         //!< Unwind markers
-
+       unlang_frame_flag_t     uflags;                         //!< Unwind flags
 
 #ifdef WITH_PERF
        fr_time_tracking_t      tracking;                       //!< track this instance of this instruction
@@ -336,16 +348,6 @@ extern unlang_op_t unlang_ops[];
 extern fr_table_num_sorted_t const mod_rcode_table[];
 extern size_t mod_rcode_table_len;
 
-#define UNWIND_FRAME_FLAG_NONE                 0x00                    //!< No flags.
-#define UNWIND_FRAME_FLAG_REPEAT               0x01                    //!< Repeat the frame on the way up the stack.
-#define UNWIND_FRAME_FLAG_TOP_FRAME            0x02                    //!< are we the top frame of the stack?
-                                                                       ///< If true, causes the interpreter to stop
-                                                                       ///< interpreting and return, control then passes
-                                                                       ///< to whatever called the interpreter.
-#define UNWIND_FRAME_FLAG_BREAK_POINT          0x04                    //!< 'break' stops here.
-#define UNWIND_FRAME_FLAG_RETURN_POINT         0x08                    //!< 'return' stops here.
-#define UNWIND_FRAME_FLAG_NO_CLEAR             0x10                    //!< Keep unwinding, don't clear the unwind flag.
-#define UNWIND_FRAME_FLAG_YIELDED              0x20                    //!< frame has yielded
 
 static inline void repeatable_set(unlang_stack_frame_t *frame)         { frame->uflags |= UNWIND_FRAME_FLAG_REPEAT; }
 static inline void top_frame_set(unlang_stack_frame_t *frame)          { frame->uflags |= UNWIND_FRAME_FLAG_TOP_FRAME; }
diff --git a/src/tests/keywords/timeout-catch b/src/tests/keywords/timeout-catch
deleted file mode 100644 (file)
index d085232..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# PRE: timeout
-#
-
-#
-#  @todo - we have to add a leading '0' here, otherwise cf_file.c complains
-#
-timeout 0.1s {
-       delay_10s
-}
-catch timeout {
-       success
-}