Index: sip-4.15.4/sipgen/parser.c
===================================================================
--- sip-4.15.4.orig/sipgen/parser.c
+++ sip-4.15.4/sipgen/parser.c
@@ -372,6 +372,7 @@
 
 
 static sipSpec *currentSpec;            /* The current spec being parsed. */
+static stringList *backstops;           /* The list of backstops. */
 static stringList *neededQualifiers;    /* The list of required qualifiers. */
 static stringList *excludedQualifiers;  /* The list of excluded qualifiers. */
 static moduleDef *currentModule;        /* The current module being parsed. */
@@ -515,6 +516,7 @@ static void handleKeepReference(optFlags
 static void mappedTypeAnnos(mappedTypeDef *mtd, optFlags *optflgs);
 static void add_new_deref(argDef *new, argDef *orig, int isconst);
 static void add_derefs(argDef *dst, argDef *src);
+static int isBackstop(qualDef *qd);
 
 
 /* Enabling traces.  */
@@ -5691,9 +5693,9 @@ yyreduce:
                     "Mixin",
                     "NoDefaultCtors",
                     "PyName",
-                    "PyQt4Flags",
-                    "PyQt4NoQMetaObject",
+                    "PyQtFlags",
                     "PyQtInterface",
+                    "PyQtNoQMetaObject",
                     "Supertype",
                     "VirtualErrorHandler",
                     NULL
@@ -5786,9 +5788,9 @@ yyreduce:
                     "Mixin",
                     "NoDefaultCtors",
                     "PyName",
-                    "PyQt4Flags",
-                    "PyQt4NoQMetaObject",
+                    "PyQtFlags",
                     "PyQtInterface",
+                    "PyQtNoQMetaObject",
                     "Supertype",
                     "VirtualErrorHandler",
                     NULL
@@ -7240,6 +7242,7 @@ yyreduce:
                 const char *annos[] = {
                     "DocType",
                     "Encoding",
+                    "NoSetter",
                     "PyInt",
                     "PyName",
                     NULL
@@ -8116,7 +8119,7 @@ yyreturn:
  * Parse the specification.
  */
 void parse(sipSpec *spec, FILE *fp, char *filename, stringList *tsl,
-        stringList *xfl, KwArgs kwArgs, int protHack)
+        stringList *bsl, stringList *xfl, KwArgs kwArgs, int protHack)
 {
     classTmplDef *tcd;
 
@@ -8126,6 +8129,7 @@ void parse(sipSpec *spec, FILE *fp, char
     spec->genc = -1;
 
     currentSpec = spec;
+    backstops = bsl;
     neededQualifiers = tsl;
     excludedQualifiers = xfl;
     currentModule = NULL;
@@ -8249,9 +8253,7 @@ static moduleDef *allocModule()
     newmod->encoding = no_type;
     newmod->qobjclass = -1;
     newmod->nrvirthandlers = -1;
-
-    /* -1 is reserved for variable getters. */
-    newmod->next_key = -2;
+    newmod->next_key = -1;
 
     /*
      * The consolidated module support needs these to be in order that they
@@ -8645,11 +8647,11 @@ static void finishClass(sipSpec *pt, mod
     if (getOptFlag(of, "Mixin", bool_flag) != NULL)
         setMixin(cd);
 
-    if ((flg = getOptFlag(of, "PyQt4Flags", integer_flag)) != NULL)
-        cd->pyqt4_flags = flg->fvalue.ival;
+    if ((flg = getOptFlag(of, "PyQtFlags", integer_flag)) != NULL)
+        cd->pyqt_flags = flg->fvalue.ival;
 
-    if (getOptFlag(of, "PyQt4NoQMetaObject", bool_flag) != NULL)
-        setPyQt4NoQMetaObject(cd);
+    if (getOptFlag(of, "PyQtNoQMetaObject", bool_flag) != NULL)
+        setPyQtNoQMetaObject(cd);
 
     if ((flg = getOptFlag(of, "PyQtInterface", string_flag)) != NULL)
         cd->pyqt_interface = flg->fvalue.sval;
@@ -10344,6 +10346,9 @@ static void newVar(sipSpec *pt, moduleDe
     if (isstatic || (escope != NULL && escope->iff->type == namespace_iface))
         setIsStaticVar(var);
 
+    if (getOptFlag(of, "NoSetter", bool_flag) != NULL)
+        setNoSetter(var);
+
     addVariable(pt, var);
 }
 
@@ -11622,7 +11627,7 @@ static int notSkipping()
  */
 static int timePeriod(const char *lname, const char *uname)
 {
-    int this, line;
+    int line;
     qualDef *qd, *lower, *upper;
     moduleDef *mod;
 
@@ -11667,40 +11672,59 @@ static int timePeriod(const char *lname,
     /* Handle the SIP version number pseudo-timeline. */
     if (line < 0)
     {
-        if (lower != NULL && lower->order > SIP_VERSION)
+        if (lower != NULL && SIP_VERSION < lower->order)
             return FALSE;
 
-        if (upper != NULL && upper->order <= SIP_VERSION)
+        if (upper != NULL && SIP_VERSION >= upper->order)
             return FALSE;
 
         return TRUE;
     }
 
-    this = FALSE;
-
     for (qd = mod->qualifiers; qd != NULL; qd = qd->next)
     {
         if (qd->qtype != time_qualifier || qd->line != line)
             continue;
 
-        if (lower != NULL && qd->order < lower->order)
-            continue;
-
-        if (upper != NULL && qd->order >= upper->order)
-            continue;
-
-        /*
-         * This is within the required range so if it is also needed then the
-         * expression is true.
-         */
         if (selectedQualifier(neededQualifiers, qd))
         {
-            this = TRUE;
-            break;
+            if (lower != NULL && qd->order < lower->order)
+                return FALSE;
+
+            if (upper != NULL && qd->order >= upper->order)
+                return FALSE;
+
+            return TRUE;
         }
     }
 
-    return this;
+    /*
+     * If there is no upper bound then assume the expression is true unless
+     * the lower bound is a backstop.
+     */
+    if (upper == NULL)
+        return !isBackstop(lower);
+
+    /*
+     * If the upper limit corresponds to a backstop then assume the expression
+     * is true.
+     */
+    return isBackstop(upper);
+}
+
+
+/*
+ * See if a qualifier is a backstop.
+ */
+static int isBackstop(qualDef *qd)
+{
+    stringList *sl;
+
+    for (sl = backstops; sl != NULL; sl = sl->next)
+        if (strcmp(qd->name, sl->s) == 0)
+            return TRUE;
+
+    return FALSE;
 }
 
 
