3
0
forked from pool/coreutils
coreutils/coreutils-avoid_clang_-Wtautological-constant-out-of-range-compare_warning.patch
Philipp Thomas 9a063f8a1f - Incorporate 9 bugfixes, one documentation update and two maintenance
patches that won't harm (bnc#888215), See NEWS for specifics:
  coreutils-improve_df_--human_and_--si,_help_and_man_page.patch
  coreutils-avoid_sizeof_charPP__static_analysis_warning.patch
  coreutils-also_deduplicate_virtual_file_systems.patch
  coreutils-fix_handling_of_symlinks_in_mount_list.patch
  coreutils-ignore_non_file_system_entries_in_proc_mounts.patch
  coreutils-avoid_clang_-Wtautological-constant-out-of-range-compare_warning.patch
  coreutils-use_the_last_device_name_provided_by_the_system.patch
  coreutils-avoid_compiler_warnings_with_some_assert_implementations.patch
  coreutils-use_all_of_the_last_device_details_provided.patch
  coreutils-output_placeholder_values_for_inaccessible_mount_points.patch
  coreutils-look_for_accessible_mount_points_for_specified_devices.patch
  coreutils-report_correct_device_in_presence_of_eclipsed_mounts.patch
  coreutils-avoid_an_inconsequential_mem_leak.patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=233
2014-07-28 09:51:55 +00:00

43 lines
1.4 KiB
Diff

commit ffd1a1d8dee921e20db515e7d4b3c3e47006c8b4
Author: Pádraig Brady <P@draigBrady.com>
Date: Mon May 12 15:46:43 2014 +0100
maint: avoid clang -Wtautological-constant-out-of-range-compare warning
* src/df.c (decode_output_arg): Use only enum constants to avoid
clang "warning: comparison of constant -1 with expression of
type 'display_field_t' is always false"
diff --git a/src/df.c b/src/df.c
index a7fc57f..01ecca6 100644
--- a/src/df.c
+++ b/src/df.c
@@ -144,7 +144,8 @@ typedef enum
IAVAIL_FIELD, /* inodes available */
IPCENT_FIELD, /* inodes used in percent */
TARGET_FIELD, /* mount point */
- FILE_FIELD /* specified file name */
+ FILE_FIELD, /* specified file name */
+ INVALID_FIELD /* validation marker */
} display_field_t;
/* Flag if a field contains a block, an inode or another value. */
@@ -372,7 +373,7 @@ decode_output_arg (char const *arg)
*comma++ = 0;
/* process S. */
- display_field_t field = -1;
+ display_field_t field = INVALID_FIELD;
for (unsigned int i = 0; i < ARRAY_CARDINALITY (field_data); i++)
{
if (STREQ (field_data[i].arg, s))
@@ -381,7 +382,7 @@ decode_output_arg (char const *arg)
break;
}
}
- if (field == -1)
+ if (field == INVALID_FIELD)
{
error (0, 0, _("option --output: field %s unknown"), quote (s));
usage (EXIT_FAILURE);