+static void warn_comparison(source_position_t const *const pos, expression_t const *const expr, expression_t const *const other)
+{
+ warn_string_literal_address(expr);
+
+ expression_t const* const ref = get_reference_address(expr);
+ if (ref != NULL && is_null_pointer_constant(other)) {
+ entity_t const *const ent = ref->reference.entity;
+ warningf(WARN_ADDRESS, pos, "the address of '%N' will never be NULL", ent);
+ }
+
+ if (!expr->base.parenthesized) {
+ switch (expr->base.kind) {
+ case EXPR_BINARY_LESS:
+ case EXPR_BINARY_GREATER:
+ case EXPR_BINARY_LESSEQUAL:
+ case EXPR_BINARY_GREATEREQUAL:
+ case EXPR_BINARY_NOTEQUAL:
+ case EXPR_BINARY_EQUAL:
+ warningf(WARN_PARENTHESES, pos, "comparisons like 'x <= y < z' do not have their mathematical meaning");
+ break;
+ default:
+ break;
+ }
+ }
+}
+