Rex Dieter b1fc70f
# HG changeset patch
Rex Dieter b1fc70f
# User Phil Thompson <phil@riverbankcomputing.com>
Rex Dieter b1fc70f
# Date 1401630727 -3600
Rex Dieter b1fc70f
#      Sun Jun 01 14:52:07 2014 +0100
Rex Dieter b1fc70f
# Branch 4.16-maint
Rex Dieter b1fc70f
# Node ID d9229cce7220be17f92fafaaafbf28d3d9697042
Rex Dieter b1fc70f
# Parent  2a310fa9719ad1b1731f27eb7e80ef9a6bda6982
Rex Dieter b1fc70f
Fixed a regression in the creating of the build file when generating individual
Rex Dieter b1fc70f
source files.
Rex Dieter b1fc70f
Rex Dieter b1fc70f
diff -r 2a310fa9719a -r d9229cce7220 sipgen/gencode.c
Rex Dieter b1fc70f
--- a/sipgen/gencode.c	Mon May 26 11:36:04 2014 +0100
Rex Dieter b1fc70f
+++ b/sipgen/gencode.c	Sun Jun 01 14:52:07 2014 +0100
Rex Dieter b1fc70f
@@ -282,6 +282,7 @@
Rex Dieter b1fc70f
 static virtErrorHandler *getVirtErrorHandler(sipSpec *pt, overDef *od,
Rex Dieter b1fc70f
         classDef *cd, moduleDef *mod);
Rex Dieter b1fc70f
 static int hasOptionalArgs(overDef *od);
Rex Dieter b1fc70f
+static int emptyIfaceFile(sipSpec *pt, ifaceFileDef *iff);
Rex Dieter b1fc70f
 
Rex Dieter b1fc70f
 
Rex Dieter b1fc70f
 /*
Rex Dieter b1fc70f
@@ -429,6 +430,9 @@
Rex Dieter b1fc70f
             if (iff->type == exception_iface)
Rex Dieter b1fc70f
                 continue;
Rex Dieter b1fc70f
 
Rex Dieter b1fc70f
+            if (emptyIfaceFile(pt, iff))
Rex Dieter b1fc70f
+                continue;
Rex Dieter b1fc70f
+
Rex Dieter b1fc70f
             if (iff->api_range != NULL)
Rex Dieter b1fc70f
                 prcode(fp, " sip%s%F_%d%s", mname, iff->fqcname, iff->api_range->index, srcSuffix);
Rex Dieter b1fc70f
             else
Rex Dieter b1fc70f
@@ -3673,6 +3677,26 @@
Rex Dieter b1fc70f
 
Rex Dieter b1fc70f
 
Rex Dieter b1fc70f
 /*
Rex Dieter b1fc70f
+ * See if an interface file has any content.
Rex Dieter b1fc70f
+ */
Rex Dieter b1fc70f
+static int emptyIfaceFile(sipSpec *pt, ifaceFileDef *iff)
Rex Dieter b1fc70f
+{
Rex Dieter b1fc70f
+    classDef *cd;
Rex Dieter b1fc70f
+    mappedTypeDef *mtd;
Rex Dieter b1fc70f
+
Rex Dieter b1fc70f
+    for (cd = pt->classes; cd != NULL; cd = cd->next)
Rex Dieter b1fc70f
+        if (!isProtectedClass(cd) && !isExternal(cd) && cd->iff == iff)
Rex Dieter b1fc70f
+            return FALSE;
Rex Dieter b1fc70f
+
Rex Dieter b1fc70f
+    for (mtd = pt->mappedtypes; mtd != NULL; mtd = mtd->next)
Rex Dieter b1fc70f
+        if (mtd->iff == iff)
Rex Dieter b1fc70f
+            return FALSE;
Rex Dieter b1fc70f
+
Rex Dieter b1fc70f
+    return TRUE;
Rex Dieter b1fc70f
+}
Rex Dieter b1fc70f
+
Rex Dieter b1fc70f
+
Rex Dieter b1fc70f
+/*
Rex Dieter b1fc70f
  * Generate the C/C++ code for an interface.
Rex Dieter b1fc70f
  */
Rex Dieter b1fc70f
 static void generateIfaceCpp(sipSpec *pt, ifaceFileDef *iff, int need_postinc,
Rex Dieter b1fc70f
@@ -3684,30 +3708,12 @@
Rex Dieter b1fc70f
     classDef *cd;
Rex Dieter b1fc70f
     mappedTypeDef *mtd;
Rex Dieter b1fc70f
     FILE *fp;
Rex Dieter b1fc70f
-    int empty;
Rex Dieter b1fc70f
 
Rex Dieter b1fc70f
     /*
Rex Dieter b1fc70f
      * Check that there will be something in the file so that we don't get
Rex Dieter b1fc70f
      * warning messages from ranlib.
Rex Dieter b1fc70f
      */
Rex Dieter b1fc70f
-    empty = TRUE;
Rex Dieter b1fc70f
-
Rex Dieter b1fc70f
-    for (cd = pt->classes; cd != NULL; cd = cd->next)
Rex Dieter b1fc70f
-        if (!isProtectedClass(cd) && !isExternal(cd) && cd->iff == iff)
Rex Dieter b1fc70f
-        {
Rex Dieter b1fc70f
-            empty = FALSE;
Rex Dieter b1fc70f
-            break;
Rex Dieter b1fc70f
-        }
Rex Dieter b1fc70f
-
Rex Dieter b1fc70f
-    if (empty)
Rex Dieter b1fc70f
-        for (mtd = pt->mappedtypes; mtd != NULL; mtd = mtd->next)
Rex Dieter b1fc70f
-            if (mtd->iff == iff)
Rex Dieter b1fc70f
-            {
Rex Dieter b1fc70f
-                empty = FALSE;
Rex Dieter b1fc70f
-                break;
Rex Dieter b1fc70f
-            }
Rex Dieter b1fc70f
-
Rex Dieter b1fc70f
-    if (empty)
Rex Dieter b1fc70f
+    if (emptyIfaceFile(pt, iff))
Rex Dieter b1fc70f
         return;
Rex Dieter b1fc70f
 
Rex Dieter b1fc70f
     if (master == NULL)