This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Consistently use NOT_REACHED; /* NOTREACHED */
authorJarkko Hietaniemi <jhi@iki.fi>
Wed, 4 Mar 2015 12:37:33 +0000 (07:37 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 4 Mar 2015 13:01:39 +0000 (08:01 -0500)
Both needed: the macro is for compilers, the comment for static checkers.

(This doesn't address whether each spot is correct and necessary.)

hv.c
op.c
regcomp.c
regexec.c
universal.c
utf8.c
util.c

diff --git a/hv.c b/hv.c
index 5195ca2..c11566f 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -1726,7 +1726,7 @@ S_clear_placeholders(pTHX_ HV *hv, U32 items)
     } while (--i >= 0);
     /* You can't get here, hence assertion should always fail.  */
     assert (items == 0);
-    NOT_REACHED;
+    NOT_REACHED; /* NOTREACHED */
 }
 
 STATIC void
diff --git a/op.c b/op.c
index e6b6069..5adc788 100644 (file)
--- a/op.c
+++ b/op.c
@@ -11654,7 +11654,7 @@ Perl_ck_entersub_args_core(pTHX_ OP *entersubop, GV *namegv, SV *protosv)
                                   )
                                );
        }
-       NOT_REACHED;
+       NOT_REACHED; /* NOTREACHED */
     }
     else {
        OP *prev, *cvop, *first, *parent;
@@ -11712,7 +11712,7 @@ Perl_ck_entersub_args_core(pTHX_ OP *entersubop, GV *namegv, SV *protosv)
            return op_convert_list(opnum,0,aop);
        }
     }
-    NOT_REACHED;
+    NOT_REACHED; /* NOTREACHED */
     return entersubop;
 }
 
@@ -12288,7 +12288,7 @@ S_maybe_multideref(pTHX_ OP *start, OP *orig_o, UV orig_action, U8 hints)
             break;
 
         default:
-            NOT_REACHED;
+            NOT_REACHED; /* NOTREACHED */
             return;
         }
 
@@ -14084,7 +14084,7 @@ Perl_custom_op_get_field(pTHX_ const OP *o, const xop_flags_enum field)
                    any.xop_peep = xop->xop_peep;
                    break;
                default:
-                   NOT_REACHED;
+                   NOT_REACHED; /* NOTREACHED */
                    break;
                }
            } else {
@@ -14102,7 +14102,7 @@ Perl_custom_op_get_field(pTHX_ const OP *o, const xop_flags_enum field)
                    any.xop_peep = XOPd_xop_peep;
                    break;
                default:
-                   NOT_REACHED;
+                   NOT_REACHED; /* NOTREACHED */
                    break;
                }
            }
index daed3c6..d1fa74d 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -5637,7 +5637,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVuf" RHS=%"UVuf"\n",
         }
         return final_minlen;
     }
-    NOT_REACHED;
+    NOT_REACHED; /* NOTREACHED */
 }
 
 STATIC U32
@@ -7891,7 +7891,7 @@ S_reg_scan_name(pTHX_ RExC_state_t *pRExC_state, U32 flags)
             Perl_croak(aTHX_ "panic: bad flag %lx in reg_scan_name",
                       (unsigned long) flags);
         }
-        NOT_REACHED; /* NOT REACHED */
+        NOT_REACHED; /* NOTREACHED */
     }
     return NULL;
 }
@@ -10095,14 +10095,14 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                 if (RExC_parse == RExC_end || *RExC_parse != ')')
                     vFAIL("Sequence (?&... not terminated");
                 goto gen_recurse_regop;
-                /* NOT REACHED */
+                /* NOTREACHED */
             case '+':
                 if (!(RExC_parse[0] >= '1' && RExC_parse[0] <= '9')) {
                     RExC_parse++;
                     vFAIL("Illegal pattern");
                 }
                 goto parse_recursion;
-                /* NOT REACHED*/
+                /* NOTREACHED*/
             case '-': /* (?-1) */
                 if (!(RExC_parse[0] >= '1' && RExC_parse[0] <= '9')) {
                     RExC_parse--; /* rewind to let it be handled later */
@@ -10175,7 +10175,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                 nextchar(pRExC_state);
                 return ret;
 
-            /* NOT REACHED */
+            /* NOTREACHED */
 
            case '?':           /* (??...) */
                is_logical = 1;
@@ -14614,7 +14614,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
                 vFAIL2utf8f(
                     "Invalid [] range \"%"UTF8f"\"",
                     UTF8fARG(UTF, w, rangebegin));
-                NOT_REACHED; /* NOT REACHED */
+                NOT_REACHED; /* NOTREACHED */
            }
        }
        else {
index 9979c1a..d343c91 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -4243,7 +4243,7 @@ S_isGCB(const PL_GCB_enum before, const PL_GCB_enum after)
             return FALSE;
     }
 
-    NOT_REACHED;
+    NOT_REACHED; /* NOTREACHED */
 }
 
 #define SBcase(before, after) ((SB_ENUM_COUNT * before) + after)
@@ -4661,7 +4661,7 @@ S_isWB(pTHX_ PL_WB_enum previous,
 
     }
 
-    NOT_REACHED;
+    NOT_REACHED; /* NOTREACHED */
 }
 
 STATIC PL_WB_enum
@@ -4914,14 +4914,14 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
            rex->offs[0].start = locinput - reginfo->strbeg;
            PUSH_STATE_GOTO(KEEPS_next, next, locinput);
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case KEEPS_next_fail:
            /* rollback the start point change */
            rex->offs[0].start = st->u.keeper.val;
            sayNO_SILENT;
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case MEOL: /* /..$/m  */
            if (!NEXTCHR_IS_EOS && nextchr != '\n')
@@ -4971,7 +4971,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
                 );
                 sayNO_SILENT;
                 /* NOTREACHED */
-                NOT_REACHED;
+                NOT_REACHED; /* NOTREACHED */
             }
             /* FALLTHROUGH */
        case TRIE:  /* (ab|cd)  */
@@ -5172,7 +5172,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
                goto trie_first_try; /* jump into the fail handler */
            }}
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case TRIE_next_fail: /* we failed - try next alternative */
         {
@@ -5287,7 +5287,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
            if (ST.accepted > 1 || has_cutgroup) {
                PUSH_STATE_GOTO(TRIE_next, scan, (char*)uc);
                 /* NOTREACHED */
-               NOT_REACHED;
+               NOT_REACHED; /* NOTREACHED */
            }
            /* only one choice left - just continue */
            DEBUG_EXECUTE_r({
@@ -6408,7 +6408,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog)
                /* now continue from first node in postoned RE */
                PUSH_YES_STATE_GOTO(EVAL_AB, startpoint, locinput);
                 /* NOTREACHED */
-               NOT_REACHED;
+               NOT_REACHED; /* NOTREACHED */
        }
 
        case EVAL_AB: /* cleanup after a successful (??{A})B */
@@ -6668,21 +6668,21 @@ NULL
 
            PUSH_YES_STATE_GOTO(CURLYX_end, PREVOPER(next), locinput);
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
        }
 
        case CURLYX_end: /* just finished matching all of A*B */
            cur_curlyx = ST.prev_curlyx;
            sayYES;
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case CURLYX_end_fail: /* just failed to match all of A*B */
            regcpblow(ST.cp);
            cur_curlyx = ST.prev_curlyx;
            sayNO;
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
 
 #undef ST
@@ -6721,7 +6721,7 @@ NULL
 
                PUSH_STATE_GOTO(WHILEM_A_pre, A, locinput);
                 /* NOTREACHED */
-               NOT_REACHED;
+               NOT_REACHED; /* NOTREACHED */
            }
 
            /* If degenerate A matches "", assume A done. */
@@ -6834,7 +6834,7 @@ NULL
                PUSH_YES_STATE_GOTO(WHILEM_B_min, ST.save_curlyx->u.curlyx.B,
                                     locinput);
                 /* NOTREACHED */
-               NOT_REACHED;
+               NOT_REACHED; /* NOTREACHED */
            }
 
            /* Prefer A over B for maximal matching. */
@@ -6846,19 +6846,19 @@ NULL
                REGCP_SET(ST.lastcp);
                PUSH_STATE_GOTO(WHILEM_A_max, A, locinput);
                 /* NOTREACHED */
-               NOT_REACHED;
+               NOT_REACHED; /* NOTREACHED */
            }
            goto do_whilem_B_max;
        }
         /* NOTREACHED */
-       NOT_REACHED;
+       NOT_REACHED; /* NOTREACHED */
 
        case WHILEM_B_min: /* just matched B in a minimal match */
        case WHILEM_B_max: /* just matched B in a maximal match */
            cur_curlyx = ST.save_curlyx;
            sayYES;
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case WHILEM_B_max_fail: /* just failed to match B in a maximal match */
            cur_curlyx = ST.save_curlyx;
@@ -6866,7 +6866,7 @@ NULL
            cur_curlyx->u.curlyx.count--;
            CACHEsayNO;
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case WHILEM_A_min_fail: /* just failed to match A in a minimal match */
            /* FALLTHROUGH */
@@ -6877,7 +6877,7 @@ NULL
            cur_curlyx->u.curlyx.count--;
            CACHEsayNO;
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case WHILEM_A_max_fail: /* just failed to match A in a maximal match */
            REGCP_UNWIND(ST.lastcp);
@@ -6904,7 +6904,7 @@ NULL
            PUSH_YES_STATE_GOTO(WHILEM_B_max, ST.save_curlyx->u.curlyx.B,
                                 locinput);
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case WHILEM_B_min_fail: /* just failed to match B in a minimal match */
            cur_curlyx = ST.save_curlyx;
@@ -6939,7 +6939,7 @@ NULL
                /*A*/ NEXTOPER(ST.save_curlyx->u.curlyx.me) + EXTRA_STEP_2ARGS,
                 locinput);
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
 #undef  ST
 #define ST st->u.branch
@@ -6965,14 +6965,14 @@ NULL
                PUSH_STATE_GOTO(BRANCH_next, scan, locinput);
            }
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
         case CUTGROUP:  /*  /(*THEN)/  */
             sv_yes_mark = st->u.mark.mark_name = scan->flags ? NULL :
                 MUTABLE_SV(rexi->data->data[ ARG( scan ) ]);
             PUSH_STATE_GOTO(CUTGROUP_next, next, locinput);
             /* NOTREACHED */
-            NOT_REACHED;
+            NOT_REACHED; /* NOTREACHED */
 
         case CUTGROUP_next_fail:
             do_cutgroup = 1;
@@ -6981,12 +6981,12 @@ NULL
                 sv_commit = st->u.mark.mark_name;
             sayNO;         
             /* NOTREACHED */
-            NOT_REACHED;
+            NOT_REACHED; /* NOTREACHED */
 
         case BRANCH_next:
             sayYES;
             /* NOTREACHED */
-            NOT_REACHED;
+            NOT_REACHED; /* NOTREACHED */
 
        case BRANCH_next_fail: /* that branch failed; try the next, if any */
            if (do_cutgroup) {
@@ -7053,7 +7053,7 @@ NULL
          curlym_do_A: /* execute the A in /A{m,n}B/  */
            PUSH_YES_STATE_GOTO(CURLYM_A, ST.A, locinput); /* match A */
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case CURLYM_A: /* we've just matched an A */
            ST.count++;
@@ -7190,7 +7190,7 @@ NULL
            
            PUSH_STATE_GOTO(CURLYM_B, ST.B, locinput); /* match B */
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case CURLYM_B_fail: /* just failed to match a B */
            REGCP_UNWIND(ST.cp);
@@ -7369,7 +7369,7 @@ NULL
                goto curly_try_B_max;
            }
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case CURLY_B_min_known_fail:
            /* failed to find B in a non-greedy match where c1,c2 valid */
@@ -7445,7 +7445,7 @@ NULL
                PUSH_STATE_GOTO(CURLY_B_min_known, ST.B, locinput);
            }
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case CURLY_B_min_fail:
            /* failed to find B in a non-greedy match where c1,c2 invalid */
@@ -7478,7 +7478,7 @@ NULL
            }
             sayNO;
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
           curly_try_B_max:
            /* a successful greedy match: now try to match B */
@@ -7509,7 +7509,7 @@ NULL
                    CURLY_SETPAREN(ST.paren, ST.count);
                    PUSH_STATE_GOTO(CURLY_B_max, ST.B, locinput);
                     /* NOTREACHED */
-                   NOT_REACHED;
+                   NOT_REACHED; /* NOTREACHED */
                }
            }
            /* FALLTHROUGH */
@@ -7629,7 +7629,7 @@ NULL
            /* execute body of (?...A) */
            PUSH_YES_STATE_GOTO(IFMATCH_A, NEXTOPER(NEXTOPER(scan)), newstart);
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
         }
 
        case IFMATCH_A_fail: /* body of (?...A) failed */
@@ -7670,7 +7670,7 @@ NULL
                sv_yes_mark = sv_commit = MUTABLE_SV(rexi->data->data[ ARG( scan ) ]);
            PUSH_STATE_GOTO(COMMIT_next, next, locinput);
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
        case COMMIT_next_fail:
            no_final = 1;    
@@ -7679,7 +7679,7 @@ NULL
        case OPFAIL:   /* (*FAIL)  */
            sayNO;
             /* NOTREACHED */
-           NOT_REACHED;
+           NOT_REACHED; /* NOTREACHED */
 
 #define ST st->u.mark
         case MARKPOINT: /*  (*MARK:foo)  */
@@ -7690,13 +7690,13 @@ NULL
             ST.mark_loc = locinput;
             PUSH_YES_STATE_GOTO(MARKPOINT_next, next, locinput);
             /* NOTREACHED */
-            NOT_REACHED;
+            NOT_REACHED; /* NOTREACHED */
 
         case MARKPOINT_next:
             mark_state = ST.prev_mark;
             sayYES;
             /* NOTREACHED */
-            NOT_REACHED;
+            NOT_REACHED; /* NOTREACHED */
 
         case MARKPOINT_next_fail:
             if (popmark && sv_eq(ST.mark_name,popmark)) 
@@ -7718,7 +7718,7 @@ NULL
                 mark_state->u.mark.mark_name : NULL;
             sayNO;
             /* NOTREACHED */
-            NOT_REACHED;
+            NOT_REACHED; /* NOTREACHED */
 
         case SKIP:  /*  (*SKIP)  */
             if (scan->flags) {
@@ -7764,7 +7764,7 @@ NULL
             no_final = 1; 
             sayNO;
             /* NOTREACHED */
-            NOT_REACHED;
+            NOT_REACHED; /* NOTREACHED */
 #undef ST
 
         case LNBREAK: /* \R */
@@ -7852,7 +7852,7 @@ NULL
     Perl_croak(aTHX_ "corrupted regexp pointers");
     /* NOTREACHED */
     sayNO;
-    NOT_REACHED;
+    NOT_REACHED; /* NOTREACHED */
 
   yes:
     if (yes_state) {
@@ -8496,7 +8496,7 @@ S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
     default:
         Perl_croak(aTHX_ "panic: regrepeat() called with unrecognized node type %d='%s'", OP(p), PL_reg_name[OP(p)]);
         /* NOTREACHED */
-        NOT_REACHED;
+        NOT_REACHED; /* NOTREACHED */
 
     }
 
index 17ec475..4c98510 100644 (file)
@@ -996,7 +996,7 @@ XS(XS_re_regexp_pattern)
             XSRETURN_NO;
         }
     }
-    NOT_REACHED; /* NOT-REACHED */
+    NOT_REACHED; /* NOTREACHED */
 }
 
 #include "vutil.h"
diff --git a/utf8.c b/utf8.c
index efb8d86..bbc2f8d 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -139,7 +139,7 @@ Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
            {
 #ifdef EBCDIC
                 Perl_die(aTHX_ "Can't represent character for Ox%"UVXf" on this platform", uv);
-                NOT_REACHED;
+                NOT_REACHED; /* NOTREACHED */
 #endif
                return NULL;
            }
diff --git a/util.c b/util.c
index 9ffdbde..11ed10b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -5693,7 +5693,7 @@ Perl_my_dirfd(DIR * dir) {
     return dir->dd_fd;
 #else
     Perl_croak_nocontext(PL_no_func, "dirfd");
-    NOT_REACHED; /* NOT REACHED */
+    NOT_REACHED; /* NOTREACHED */
     return 0;
 #endif 
 }