On 11/19/25 7:02 PM, Grisha Levit wrote:
The -Wsometimes-uninitialized warning seems useful (see [1]) and is only triggered in two other places currently. Similar code currently uses programming_error; adding the __noreturn__ attribute to that function and calling it in these cases avoids the warning.
Thanks for the report.
diff --git a/pathexp.c b/pathexp.c
index 1692e054..1ccf8039 100644
--- a/pathexp.c
+++ b/pathexp.c
@@ -903,7 +903,7 @@ globsort_sortarray (struct globsort_t *garray, size_t len)
sortfunc = (QSFUNC *)globsort_numericcmp;
break;
default:
- internal_error (_("invalid glob sort type"));
+ programming_error (_("invalid glob sort type"));
break;
}
Pretty sure we don't want to abort the shell here. Maybe add the value of `t' to the error message for potential debugging.
diff --git a/redir.c b/redir.c
index 3083a163..9b3c3310 100644
--- a/redir.c
+++ b/redir.c
@@ -816,6 +816,7 @@ do_redirection_internal (REDIRECT *redirect, int flags,
char **fnp)
new_redirect = make_redirection (sd, r_move_output, rd, rflags);
break;
default:
+ programming_error ("do_redirection_internal");
break; /* shut up gcc */
}
}
Or here; clearly this can never happen. `ri' will never be anything but one
of the values in the switch statement if TRANSLATE_REDIRECT(ri) is true. I
added the default case only because gcc complained about there not being a
default case.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
