Skip to content

sometimes-uninitialized warnings in thunar-details-view.c

Clang 17 reports these warnings, which seem legitimate:

thunar-details-view.c:867:23: warning: variable 'row_selected' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
  867 |                   if (file != NULL)
      |                       ^~~~~~~~~~~~
thunar-details-view.c:878:23: note: uninitialized use occurs here
  878 |               return !row_selected;
      |                       ^~~~~~~~~~~~
thunar-details-view.c:867:19: note: remove the 'if' if its condition is always true
  867 |                   if (file != NULL)
      |                   ^~~~~~~~~~~~~~~~~
  868 |                     {
thunar-details-view.c:864:19: warning: variable 'row_selected' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
  864 |               if (gtk_tree_model_get_iter (model, &iter, path))
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thunar-details-view.c:878:23: note: uninitialized use occurs here
  878 |               return !row_selected;
      |                       ^~~~~~~~~~~~
thunar-details-view.c:864:15: note: remove the 'if' if its condition is always true
  864 |               if (gtk_tree_model_get_iter (model, &iter, path))
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  865 |                 {
thunar-details-view.c:776:34: note: initialize the variable 'row_selected' to silence this warning
  776 |   gboolean           row_selected;
      |                                  ^
      |                                   = 0