]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix mostly spurious warnings
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 19 Feb 2018 21:31:57 +0000 (21:31 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 19 Feb 2018 21:32:49 +0000 (21:32 +0000)
src/main/regex.c
src/main/xlat_eval.c
src/modules/rlm_expr/rlm_expr.c

index 341a54b700686421804cb6e1fc76ac01786dd402..d3ae7af7bc0689fd18a08766e447686de37f22f3 100644 (file)
@@ -133,6 +133,17 @@ int regex_request_to_sub(TALLOC_CTX *ctx, char **out, REQUEST *request, uint32_t
        switch (ret) {
        case PCRE_ERROR_NOMEMORY:
                MEM(NULL);
+               /*
+                *      We can't really fall through, but GCC 7.3 is
+                *      too stupid to realise that we can never get
+                *      here despite _fr_exit_now being marked as
+                *      NEVER_RETURNS.
+                *
+                *      If we did anything else, compilers and static
+                *      analysis tools would probably complain about
+                *      code that could never be executed *sigh*.
+                */
+               /* FALL-THROUGH */
 
        /*
         *      Not finding a substring is fine
@@ -193,7 +204,17 @@ int regex_request_to_sub_named(TALLOC_CTX *ctx, char **out, REQUEST *request, ch
        switch (ret) {
        case PCRE_ERROR_NOMEMORY:
                MEM(NULL);
-
+               /*
+                *      We can't really fall through, but GCC 7.3 is
+                *      too stupid to realise that we can never get
+                *      here despite _fr_exit_now being marked as
+                *      NEVER_RETURNS.
+                *
+                *      If we did anything else, compilers and static
+                *      analysis tools would probably complain about
+                *      code that could never be executed *sigh*.
+                */
+               /* FALL-THROUGH */
        /*
         *      Not finding a substring is fine
         */
index f44af9eff81f8868fde29d0d720be9b76b9bc87d..65a306fc1482da9009ed03ba2d0be4ba49731ddb 100644 (file)
@@ -811,7 +811,6 @@ xlat_action_t xlat_frame_eval_repeat(TALLOC_CTX *ctx, fr_cursor_t *out,
                fr_cursor_t from;
 
                rad_assert(alternate);
-               rad_assert(child);
 
                /*
                 *      No result from the first child, try the alternate
index ecf6ee8ae168a8f9b42b79b0a7b8ec2ddcce261d..7ce3bddc548b30c844c997bd9aae5951e3d99324 100644 (file)
@@ -92,13 +92,8 @@ static int64_t fr_pow(int64_t base, int64_t exp)
        int64_t result = 1;
 
        if (exp > 63) {
-               if (base == 1) {
-                       return 1;
-               }
-
-               if (base == -1) {
-                       return 1 - 2 * (exp & 1);
-               }
+               if (base == 1) return 1;
+               if (base == -1) return 1 - 2 * (exp & 1);
                return 0;       /* overflow */
        }
 
@@ -107,24 +102,30 @@ static int64_t fr_pow(int64_t base, int64_t exp)
                if (exp & 1) result *= base;
                exp >>= 1;
                base *= base;
+               /* FALL-THROUGH */
        case 5:
                if (exp & 1) result *= base;
                exp >>= 1;
                base *= base;
+               /* FALL-THROUGH */
        case 4:
                if (exp & 1) result *= base;
                exp >>= 1;
                base *= base;
+               /* FALL-THROUGH */
        case 3:
                if (exp & 1) result *= base;
                exp >>= 1;
                base *= base;
+               /* FALL-THROUGH */
        case 2:
                if (exp & 1) result *= base;
                exp >>= 1;
                base *= base;
+               /* FALL-THROUGH */
        case 1:
                if (exp & 1) result *= base;
+               /* FALL-THROUGH */
        default:
                return result;
        }