From 27044fbbcb6974907c41c6bb09f0f345f58c3b18 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 17 Oct 2005 17:17:20 +0000 Subject: [PATCH] Fix for erroneous warning messages when definining compiler constants. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1498 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/qcc_pr_lex.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index cf275ad8d..2d7f74a5e 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -1901,10 +1901,14 @@ void QCC_PR_ConditionCompilation(void) if (strlen(cnst->value) >= sizeof(cnst->value)) //this is too late. QCC_PR_ParseError(ERR_CONSTANTTOOLONG, "Macro %s too long (%i not %i)", cnst->name, strlen(cnst->value), sizeof(cnst->value)); - if (oldval && strcmp(oldval, cnst->value)) - QCC_PR_ParseWarning(WARN_DUPLICATEPRECOMPILER, "Alternate precompiler definition of %s", pr_token); - else - QCC_PR_ParseWarning(WARN_IDENTICALPRECOMPILER, "Identical precompiler definition of %s", pr_token); + if (oldval) + { //we always warn if it was already defined + //we use different warning codes so that -Wno-mundane can be used to ignore identical redefinitions. + if (strcmp(oldval, cnst->value)) + QCC_PR_ParseWarning(WARN_DUPLICATEPRECOMPILER, "Alternate precompiler definition of %s", pr_token); + else + QCC_PR_ParseWarning(WARN_IDENTICALPRECOMPILER, "Identical precompiler definition of %s", pr_token); + } } int QCC_PR_CheakCompConst(void)