+/* Warn for A ?: C expressions (with B omitted) where A is a boolean
+ expression, because B will always be true. */
+
+void
+warn_for_omitted_condop (location_t location, tree cond)
+{
+ enum tree_code code = TREE_CODE (cond);
+
+ if (!warn_parentheses)
+ return;
+ if (TREE_CODE_CLASS (code) == tcc_comparison
+ || code == TRUTH_ANDIF_EXPR
+ || code == TRUTH_ORIF_EXPR
+ || code == TRUTH_AND_EXPR
+ || code == TRUTH_XOR_EXPR
+ || code == TRUTH_OR_EXPR
+ || code == TRUTH_NOT_EXPR)
+ {
+ warning_at (location, OPT_Wparentheses,
+ "the omitted middle operand in ?: will always be %<true%>, "
+ "suggest explicit middle operand");
+ }
+}