Project

General

Profile

Bug #5463

Unused local typedef

Added by Gary Mills over 5 years ago. Updated over 5 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Category:
lib - userland libraries
Start date:
2014-12-21
Due date:
% Done:

30%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

When building with gcc 4.8.2, this error appears:


In file included from /dpool/export/home/mills/Downloads/code/illumos-gate/proto/root_sparc/usr/include/fcntl.h:40:0,
from ../screen/tgetch.c:536:
../screen/tgetch.c: In function '_fpk':
/dpool/export/home/mills/Downloads/code/illumos-gate/proto/root_sparc/usr/include/sys/fcntl.h:213:3: error: typedef 'flock_t' locally defined but not used [-Werror=unused-local-typedefs]
} flock_t;
^

The solution is to remove the unused local typedefs. For gcc 4.8.2, the error can be suppressed by adding this line to Makefile or Makefile.com, with the group of similar lines:


CERRWARN += -_gcc=-Wno-unused-local-typedefs

This error occurs in two locations: usr/src/lib/libnsl/sparc and usr/src/lib/libcurses .


Files

tgch.diff (682 Bytes) tgch.diff Gary Mills, 2014-12-28 02:07 AM
tyd.diff (727 Bytes) tyd.diff Gary Mills, 2014-12-28 02:07 AM

History

#1

Updated by Andrew Stormont over 5 years ago

The code in fcntl.h looks okay to me. I wonder if it has something to do with the include being on line 536 in tgetch.c.

#2

Updated by Richard PALO over 5 years ago

you could perhaps add instead on the typedef __attribute__((__unused__))
instead of the CERRWARN.
I'm curious, though, as to whether you see the warning if you move the #include <fcntl.h>
to global scope (outside of _fpk or even top of file in tgetch.c)...

#3

Updated by Gary Mills over 5 years ago

Yes, moving the include statement fixed the problem. They must have been economizing on conditionals. There were actually two files affected: ../screen/tgetch.c ../screen/typeahead.c . I moved the include statements to the top and wrapped them in appropriate conditionals. Then I no longer needed to add `-_gcc=-Wno-unused-local-typedefs' to Makefile.com to suppress the error. I'm attaching both new patch files.

Also available in: Atom PDF