Project

General

Profile

Bug #8485

Remove set but unused variables in usr/src/cmd

Added by Gary Mills over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2017-07-13
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

GCC-4.9.4, and probably later versions, identifies variables that are set but not otherwise used in source files, with an error message like this one:

uuglist.c: In function 'rproc':
uuglist.c:132:6: error: variable 'na' set but not used [-Werror=unused-but-set-variable]
  int na;
      ^
cc1: all warnings being treated as errors

In a large number of cases, simply removing the offending variable will prevent this error, and permit the file to be compiled. In more complex cases, other means have to be considered instead.

History

#1

Updated by Electric Monk about 2 years ago

  • % Done changed from 90 to 100
  • Status changed from New to Closed

git commit d7c57852794a9ac50d4b6a9c4161cb10919658aa

commit  d7c57852794a9ac50d4b6a9c4161cb10919658aa
Author: Gary Mills <gary_mills@fastmail.fm>
Date:   2017-08-27T01:12:13.000Z

    8485 Remove set but unused variables in usr/src/cmd
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Andy Stormont <astormont@racktopsystems.com>
    Reviewed by: Yuri Pankov <yuripv@gmx.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF