diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-05-18 17:49:32 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-05-18 17:55:07 -0700 |
commit | 478dade09a4288f73e963b7f185ef9f73b681b42 (patch) | |
tree | df50bffa4c4d045b20ead3e3d945e39108088acc /src/ls.c | |
parent | e605e40acf859eea2a1221d867ab3c086a1a1c15 (diff) | |
download | coreutils-478dade09a4288f73e963b7f185ef9f73b681b42.tar.xz |
maint: port --enable-gcc-warnings to clang
* configure.ac: If clang, add -Wno-format-extra-args and
-Wno-tautological-constant-out-of-range-compare.
* gl/lib/rand-isaac.c (ind):
* gl/lib/randread.c (readisaac):
* src/ls.c (dev_ino_push, dev_ino_pop):
* src/sort.c (buffer_linelim):
* src/system.h (is_nul):
* src/tail.c (tail_forever_inotify):
Rewrite to avoid casts that clang dislikes.
It's good to avoid casts anyway.
* src/expr.c (integer_overflow): Declare only if it exists.
(die): Remove; unused.
* src/ls.c (dev_ino_push): New function, replacing ...
(DEV_INO_PUSH): ... this removed macro. All uses changed.
(decode_switches): Rewrite "str"+i to &str[i].
Diffstat (limited to 'src/ls.c')
-rw-r--r-- | src/ls.c | 38 |
1 files changed, 23 insertions, 15 deletions
@@ -962,25 +962,33 @@ static struct obstack subdired_obstack; static struct obstack dev_ino_obstack; /* Push a pair onto the device/inode stack. */ -#define DEV_INO_PUSH(Dev, Ino) \ - do \ - { \ - struct dev_ino *di; \ - obstack_blank (&dev_ino_obstack, sizeof (struct dev_ino)); \ - di = -1 + (struct dev_ino *) obstack_next_free (&dev_ino_obstack); \ - di->st_dev = (Dev); \ - di->st_ino = (Ino); \ - } \ - while (0) +static void +dev_ino_push (dev_t dev, ino_t ino) +{ + void *vdi; + struct dev_ino *di; + int dev_ino_size = sizeof *di; + obstack_blank (&dev_ino_obstack, dev_ino_size); + vdi = obstack_next_free (&dev_ino_obstack); + di = vdi; + di--; + di->st_dev = dev; + di->st_ino = ino; +} /* Pop a dev/ino struct off the global dev_ino_obstack and return that struct. */ static struct dev_ino dev_ino_pop (void) { - assert (sizeof (struct dev_ino) <= obstack_object_size (&dev_ino_obstack)); - obstack_blank (&dev_ino_obstack, -(int) (sizeof (struct dev_ino))); - return *(struct dev_ino *) obstack_next_free (&dev_ino_obstack); + void *vdi; + struct dev_ino *di; + int dev_ino_size = sizeof *di; + assert (dev_ino_size <= obstack_object_size (&dev_ino_obstack)); + obstack_blank (&dev_ino_obstack, -dev_ino_size); + vdi = obstack_next_free (&dev_ino_obstack); + di = vdi; + return *di; } /* Note the use commented out below: @@ -1978,7 +1986,7 @@ decode_switches (int argc, char **argv) if (file_type <= indicator_style) { char const *p; - for (p = "*=>@|" + indicator_style - file_type; *p; p++) + for (p = &"*=>@|"[indicator_style - file_type]; *p; p++) set_char_quoting (filename_quoting_options, *p, 1); } @@ -2542,7 +2550,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg) return; } - DEV_INO_PUSH (dir_stat.st_dev, dir_stat.st_ino); + dev_ino_push (dir_stat.st_dev, dir_stat.st_ino); } if (recursive || print_dir_name) |