Ping, in case anyone would like to comment.

On Thu, Oct 31, 2019 at 08:55:46AM +0800, Michael Mikonos wrote:
> Hello,
> 
> The macro flex_die(), defined in flexdef.h, never returns.
> Instead it does FLEX_EXIT() which longjmp()s back to flex_main()
> before exiting.
> The following patch removes some dead code, as statements
> after flex_die() are never reached. Does this look OK?
> 
> - Michael
> 
> 
> Index: tables.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/lex/tables.c,v
> retrieving revision 1.4
> diff -u -p -u -r1.4 tables.c
> --- tables.c  17 Aug 2017 19:27:09 -0000      1.4
> +++ tables.c  30 Oct 2019 12:32:59 -0000
> @@ -221,34 +221,26 @@ int yytbl_data_fwrite (struct yytbl_writ
>               default:
>                       flex_die (_("invalid td_flags detected"));
>               }
> -             if (rv < 0) {
> +             if (rv < 0)
>                       flex_die (_("error while writing tables"));
> -                     return -1;
> -             }
>               bwritten += rv;
>       }
>  
>       /* Sanity check */
> -     if (bwritten != (int) (12 + total_len * YYTDFLAGS2BYTES 
> (td->td_flags))) {
> +     if (bwritten != (int) (12 + total_len * YYTDFLAGS2BYTES (td->td_flags)))
>               flex_die (_("insanity detected"));
> -             return -1;
> -     }
>  
>       /* add padding */
> -     if ((rv = yytbl_write_pad64 (wr)) < 0) {
> +     if ((rv = yytbl_write_pad64 (wr)) < 0)
>               flex_die (_("pad64 failed"));
> -             return -1;
> -     }
>       bwritten += rv;
>  
>       /* Now go back and update the th_hsize member */
>       if (fgetpos (wr->out, &pos) != 0
>           || fsetpos (wr->out, &(wr->th_ssize_pos)) != 0
>           || yytbl_write32 (wr, wr->total_written) < 0
> -         || fsetpos (wr->out, &pos)) {
> +         || fsetpos (wr->out, &pos))
>               flex_die (_("get|set|fwrite32 failed"));
> -             return -1;
> -     }
>       else
>               /* Don't count the int we just wrote. */
>               wr->total_written -= sizeof (flex_int32_t);
> @@ -346,7 +338,6 @@ static flex_int32_t yytbl_data_geti (con
>               return ((flex_int32_t *) (tbl->td_data))[i];
>       default:
>               flex_die (_("invalid td_flags detected"));
> -             break;
>       }
>       return 0;
>  }
> @@ -374,7 +365,6 @@ static void yytbl_data_seti (const struc
>               break;
>       default:
>               flex_die (_("invalid td_flags detected"));
> -             break;
>       }
>  }
>  
> @@ -433,10 +423,8 @@ void yytbl_data_compress (struct yytbl_d
>               /* No change in this table needed. */
>               return;
>  
> -     if (newsz > (int) YYTDFLAGS2BYTES (tbl->td_flags)) {
> +     if (newsz > (int) YYTDFLAGS2BYTES (tbl->td_flags))
>               flex_die (_("detected negative compression"));
> -             return;
> -     }
>  
>       total_len = yytbl_calc_total_len (tbl);
>       newtbl.td_data = calloc (total_len, newsz);
> 

Reply via email to