+static bool irwarning(lex_ctx ctx, int warntype, const char *fmt, ...)
+{
+ va_list ap;
+ int lvl = LVL_WARNING;
+
+ if (warntype && !OPTS_WARN(warntype))
+ return false;
+
+ if (opts_werror)
+ lvl = LVL_ERROR;
+
+ va_start(ap, fmt);
+ con_vprintmsg(lvl, ctx.file, ctx.line, "warning", fmt, ap);
+ va_end(ap);
+
+ return opts_werror;
+}
+
+/***********************************************************************
+ * Vector utility functions
+ */
+
+bool GMQCC_WARN vec_ir_value_find(ir_value **vec, ir_value *what, size_t *idx)
+{
+ size_t i;
+ size_t len = vec_size(vec);
+ for (i = 0; i < len; ++i) {
+ if (vec[i] == what) {
+ if (idx) *idx = i;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool GMQCC_WARN vec_ir_block_find(ir_block **vec, ir_block *what, size_t *idx)
+{
+ size_t i;
+ size_t len = vec_size(vec);
+ for (i = 0; i < len; ++i) {
+ if (vec[i] == what) {
+ if (idx) *idx = i;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool GMQCC_WARN vec_ir_instr_find(ir_instr **vec, ir_instr *what, size_t *idx)
+{
+ size_t i;
+ size_t len = vec_size(vec);
+ for (i = 0; i < len; ++i) {
+ if (vec[i] == what) {
+ if (idx) *idx = i;
+ return true;
+ }
+ }
+ return false;
+}
+