From b964fd6cde2088ecddbdaa86e30b7b65ad7f1d15 Mon Sep 17 00:00:00 2001
From: Martin Stjernholm <mast@lysator.liu.se>
Date: Fri, 16 Apr 2004 00:07:48 +0200
Subject: [PATCH] Fixed compat test.

Rev: src/cpp.c:1.135
Rev: src/cpp.h:1.9
---
 src/cpp.c | 5 +++--
 src/cpp.h | 8 +++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/cpp.c b/src/cpp.c
index 8fa5cc54ff..3bc023ed87 100644
--- a/src/cpp.c
+++ b/src/cpp.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: cpp.c,v 1.134 2004/04/15 20:34:45 mast Exp $
+|| $Id: cpp.c,v 1.135 2004/04/15 22:07:48 mast Exp $
 */
 
 #include "global.h"
@@ -24,6 +24,7 @@
 #include "stuff.h"
 #include "version.h"
 #include "pike_types.h"
+#include "cpp.h"
 
 #include <ctype.h>
 
@@ -1533,7 +1534,7 @@ static int do_safe_index_call(struct cpp *this, struct pike_string *s)
   if(!s) return 0;
 
   if (SETJMP_SP(recovery, 1)) {
-    if (TEST_COMPAT (7, 4)) {
+    if (CPP_TEST_COMPAT (this, 7, 4)) {
       free_svalue (&throw_value);
       throw_value.type = T_INT;
     }
diff --git a/src/cpp.h b/src/cpp.h
index a8752d5666..80445f861c 100644
--- a/src/cpp.h
+++ b/src/cpp.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: cpp.h,v 1.8 2003/11/14 00:15:06 mast Exp $
+|| $Id: cpp.h,v 1.9 2004/04/15 22:07:48 mast Exp $
 */
 
 #ifndef CPP_H
@@ -34,4 +34,10 @@ void add_predefine(char *s);
 void exit_cpp(void);
 /* Prototypes end here */
 
+/* Return true if compat version is equal or less than MAJOR.MINOR */
+#define CPP_TEST_COMPAT(THIS,MAJOR,MINOR)      \
+  (THIS->compat_major < (MAJOR) ||	       \
+   (THIS->compat_major == (MAJOR) &&	       \
+    THIS->compat_minor <= (MINOR)))
+
 #endif
-- 
GitLab