Bug #5463
Unused local typedef
30%
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
Updated by Andrew Stormont about 6 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.
Updated by Richard PALO about 6 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)...
Updated by Gary Mills about 6 years ago
- File tgch.diff tgch.diff added
- File tyd.diff tyd.diff added
- Status changed from New to Feedback
- % Done changed from 0 to 30
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.