On gcc 10 the following build failure occurs:
"error: a label can only be part of a statement
and a declaration is not a statement"
This is because the current code is non standards conforming,
but GCC >= 11 will compile it (even with the -Wpedantic option).
This issue is tracked for GCC at:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111526
* src/tail.c (parse_options): Avoid a declaration after label,
by using a surrounding block.
break;
case PID_OPTION:
- pid_t pid =
- xdectoumax (optarg, 0, PID_T_MAX, "", _("invalid PID"), 0);
- pids = xreallocarray (pids, nbpids + 1, sizeof (pid_t));
- pids[nbpids] = pid;
- nbpids++;
+ {
+ pid_t pid =
+ xdectoumax (optarg, 0, PID_T_MAX, "", _("invalid PID"), 0);
+ pids = xreallocarray (pids, nbpids + 1, sizeof (pid_t));
+ pids[nbpids] = pid;
+ nbpids++;
+ }
break;
case PRESUME_INPUT_PIPE_OPTION: