This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc.dg/unused-3.c

> The basic point is that unusedness is a semantic property; it should
> be checked when the function is processed, not when it is expanded.
> So, I would prefer that we make like the C front-end and warn from
> poplevel, rather than from c-semantics.c.  Does that make sense?

Yes.  Completely.


	* c-decl.c (poplevel): Invoke warn_about_unused_variables.

Index: c-decl.c
RCS file: /cvs/gcc/egcs/gcc/c-decl.c,v
retrieving revision 1.159
diff -c -p -d -r1.159 c-decl.c
*** c-decl.c	2000/09/19 02:14:33	1.159
--- c-decl.c	2000/09/19 07:53:46
*************** poplevel (keep, reverse, functionbody)
*** 1100,1105 ****
--- 1100,1111 ----
+   /* We used to warn about unused variables in expand_end_bindings,
+      i.e. while generating RTL.  But in function-at-a-time mode we may
+      choose to never expand a function at all (e.g. auto inlining), so
+      we do this explicitly now.  */
+   warn_about_unused_variables (getdecls ());
    /* If there were any declarations or structure tags in that level,
       or if this level is a function body,
       create a BLOCK to record them for the life of this function.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]