From 01144d23cf8f481cdd2debb48c27ac8cd5d26227 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 17 Mar 2011 19:58:56 +0900 Subject: [PATCH] Add a new gcc warning option and fix the two bugs it found. --- config.d/compiling.m4 | 1 + qw/source/cl_parse.c | 2 +- tools/qfcc/source/constfold.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.d/compiling.m4 b/config.d/compiling.m4 index 4328c2ccd..b267a88d6 100644 --- a/config.d/compiling.m4 +++ b/config.d/compiling.m4 @@ -177,6 +177,7 @@ if test "x$check_pipe" = xyes; then QF_CC_OPTION(-pipe) fi QF_CC_OPTION(-Wsign-compare) +QF_CC_OPTION(-Wlogical-op) QF_CC_OPTION_TEST([-fvisibility=hidden], [VISIBILITY=-fvisibility=hidden]) dnl QuakeForge uses lots of BCPL-style (//) comments, which can cause problems diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index 3dc520737..ddf4b7a68 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -737,7 +737,7 @@ CL_ParseServerData (void) // allow 2.2 and 2.29 demos to play protover = MSG_ReadLong (net_message); if (protover != PROTOCOL_VERSION - && !(cls.demoplayback && (protover <= 26 && protover >= 28))) + && !(cls.demoplayback && (protover <= 26 || protover >= 28))) Host_Error ("Server returned version %i, not %i\nYou probably " "need to upgrade.\nCheck http://www.quakeworld.net/", protover, PROTOCOL_VERSION); diff --git a/tools/qfcc/source/constfold.c b/tools/qfcc/source/constfold.c index cff5df9dc..1f08d34be 100644 --- a/tools/qfcc/source/constfold.c +++ b/tools/qfcc/source/constfold.c @@ -494,7 +494,7 @@ do_op_quaternion (int op, expr_t *e, expr_t *e1, expr_t *e2) if (get_type (e1) != &type_quaternion) { - if (op != '*' || op != '/') + if (op != '*' && op != '/') return error (e1, "invalid operand for quaternion"); if (op == '*') {