The -Wunused warning generation doesn't take modifications of global variables into account. Compiling the following code with -Wunused -Werror fails although this is perfectly reasonable code. Some registered exit handler could check the value of the variable.
int global; struct monitor { ~monitor() { global = 1; } }; int main () { monitor m; } -- Summary: invalid warning about unused variable Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: drepper at redhat dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25541