Project

General

Profile

Actions

Feature #14794

open

replace NOTE(ARGUNUSED) with __unused

Added by Joshua M. Clulow about 1 month ago. Updated 28 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
tools - gate/build tools
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Parts of the source tree are annotated with the NOTE() (or _NOTE()) macro from sys/note.h, as described in NOTE⟮3EXT⟯ in the manual. Though the general syntactic form of these annotations is described in the manual, the specific annotations are effectively only meaningful when consumed by a tool. One such tool was lint, but we have long since stopped using it (see, e.g., #10011). We have subsequently replaced parts of what lint was able to check with smatch -- see IPD 2 -- but it does not support any of the NOTE-style annotations, and is unlikely to do so in future.

In the years since lint was in vogue, the compiler itself has grown a litany of improved diagnostics, many of which supplant things we used to check with lint. One concrete example is NOTE(ARGUNUSED), which we now communicate to the compiler using the unused variable attribute, which has the advantage of being part of the C source adjacent to the argument rather than in the function body. Within illumos, sys/ccompile.h defines __unused, our preferred way to express the unused attribute, so that we may deal with compiler differences in the usual way.

This change seeks to perform a bulk clean-up of all ARGUNUSED annotations, replacing them with appropriate use of the __unused attribute instead.

Actions #1

Updated by Joshua M. Clulow about 1 month ago

  • Description updated (diff)
Actions #2

Updated by Garrett D'Amore 28 days ago

If this is the route we want to go - and I think it probably should be - we should probably look at documenting ccompile.h and the definitions that folks can rely upon.

The _NOTE() and NOTE stuff is really old legacy, and old timers such as myself will need to know that we're not meant to use it anymore.

Btw, I just stumbled upon note(4) -- and whoa. I don't think the file it documents exists (at least not on my system), but I guess may the old Studio compilers delivered it? We should probably throw that man page away.

Actions

Also available in: Atom PDF