.Ql #pragma noref 1
and closed via
.Ql #pragma noref 0 Ns .
+.It Fl W Ns Cm unused-component
+Generate a warning about vector variables which are declared but not all their
+components are used.
.It Fl W Ns Cm used-uninitialized
Generate a warning if it is possible that a variable can be used
without prior initialization. Note that this warning is not
[warnings]
#Generate a warning about variables which are declared but never
- #used. This can be avoided by adding the ‘noref’ keyword in front
+ #used. This can be avoided by adding the ‘noref’ keyword in front
#of the variable declaration. Additionally a complete section of
#unreferenced variables can be opened using ‘#pragma noref 1’ and
#closed via ‘#pragma noref 0’.
UNUSED_VARIABLE = false
+ #Generate a warning about vector variables which are declared but
+ #components of it are never used.
+
+ UNUSED_COMPONENT = false
+
#Generate a warning if it is possible that a variable can be used
#without prior initialization. Note that this warning is not nec‐
#essarily reliable if the initialization happens only under cer‐
// individual components are unused so mention them
for (size_t i = 0; i < 3; i++)
if ((bits & (1 << i))
- && irwarning(v->m_context, WARN_UNUSED_VARIABLE,
- "unused variable: `%s.%c`", v->m_name.c_str(), "xyz"[i]))
+ && irwarning(v->m_context, WARN_UNUSED_COMPONENT,
+ "unused vector component: `%s.%c`", v->m_name.c_str(), "xyz"[i]))
return false;
}
// just a standard variable
- else if (irwarning(v->m_context, WARN_UNUSED_VARIABLE,
- "unused variable: `%s`", v->m_name.c_str())) return false;
+ else if (v->m_name[0] != '#'
+ && irwarning(v->m_context, WARN_UNUSED_VARIABLE,
+ "unused variable: `%s`", v->m_name.c_str())) return false;
}
}
GMQCC_DEFINE_FLAG(UNINITIALIZED_GLOBAL)
GMQCC_DEFINE_FLAG(DEBUG)
GMQCC_DEFINE_FLAG(UNUSED_VARIABLE)
+ GMQCC_DEFINE_FLAG(UNUSED_COMPONENT)
GMQCC_DEFINE_FLAG(USED_UNINITIALIZED)
GMQCC_DEFINE_FLAG(UNKNOWN_CONTROL_SEQUENCE)
GMQCC_DEFINE_FLAG(EXTENSIONS)