Procházet zdrojové kódy

Merge remote-tracking branch 'origin/candidate-3.10.x'

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman před 12 roky
rodič
revize
bf3822dcb4

+ 2 - 0
dali/base/dadfs.cpp

@@ -52,7 +52,9 @@
 #define DFSSERVER_THROTTLE_TIME 1000
 
 #if _INTERNAL_EDITION == 1
+#ifndef _MSC_VER
 #warning Disabling Sub-file compatibility checking
+#endif
 #else
 #define SUBFILE_COMPATIBILITY_CHECKING
 #endif

+ 18 - 3
ecl/hqlcpp/hqlcppds.cpp

@@ -328,10 +328,25 @@ IReferenceSelector * HqlCppTranslator::doBuildRowFromXML(BuildCtx & ctx, IHqlExp
     bool usesContents = false;
     getUniqueId(xmlInstanceName.append("xml"));
     buildXmlReadTransform(ds, xmlFactoryName, usesContents);
+
     OwnedHqlExpr curActivityId = getCurrentActivityId(ctx);
-    s.append("Owned<IXmlToRowTransformer> ").append(xmlInstanceName).append(" = ").append(xmlFactoryName).append("(ctx,");
-    generateExprCpp(s, curActivityId).append(");");
-    ctx.addQuoted(s);
+
+    //MORE: This should be generalised so that any invariant class creation can be handled by the same code.
+    BuildCtx * declareCtx = &ctx;
+    BuildCtx * initCtx = &ctx;
+    if (!insideOnCreate(ctx) && getInvariantMemberContext(ctx, &declareCtx, &initCtx, false, false))
+    {
+        declareCtx->addQuoted(s.clear().append("Owned<IXmlToRowTransformer> ").append(xmlInstanceName).append(";"));
+        s.clear().append(xmlInstanceName).append(".setown(").append(xmlFactoryName).append("(ctx,");
+        generateExprCpp(s, curActivityId).append("));");
+        initCtx->addQuoted(s);
+    }
+    else
+    {
+        s.append("Owned<IXmlToRowTransformer> ").append(xmlInstanceName).append(" = ").append(xmlFactoryName).append("(ctx,");
+        generateExprCpp(s, curActivityId).append(");");
+        ctx.addQuoted(s);
+    }
 
     HqlExprArray args;
     args.append(*createRowAllocator(ctx, record));

+ 9 - 23
ecl/hqlcpp/hqlsource.cpp

@@ -6805,26 +6805,21 @@ void HqlCppTranslator::buildXmlReadTransform(IHqlExpression * dataset, StringBuf
     StringBuffer s, id, className;
     getUniqueId(id);
     className.append("cx2r").append(id);
-    factoryName.append("fx2r").append(id);
 
     const char * interfaceName = "IXmlToRowTransformer";
 
+
     StringBuffer prolog, epilog;
     prolog.append("struct ").append(className).append(" : public RtlCInterface, implements ").append(interfaceName);
     epilog.append(";");
 
-    BuildCtx classctx(declarectx);
-    classctx.setNextPriority(XmlTransformerPrio);
-    IHqlStmt * transformClass = classctx.addQuotedCompound(prolog, epilog);
-    transformClass->setIncomplete(true);
+    GlobalClassBuilder builder(*this, declarectx, className, "CXmlToRowTransformer", interfaceName);
+    builder.buildClass(XmlTransformerPrio);
+    builder.setIncomplete(true);
 
-    s.clear().append(className).append("() { ctx = NULL; activityId = 0; }");
-    classctx.addQuoted(s);
-    s.clear().append(className).append("(ICodeContext * _ctx, unsigned _activityId) { ctx = _ctx; activityId = _activityId; }");
+    BuildCtx & classctx = builder.classctx;
+    s.clear().append("inline ").append(className).append("(unsigned _activityId) : CXmlToRowTransformer(_activityId) {}");
     classctx.addQuoted(s);
-    classctx.addQuoted("inline void setContext(ICodeContext * _ctx) { ctx = _ctx; }");
-    classctx.addQuoted("virtual void Link() const { RtlCInterface::Link(); }");
-    classctx.addQuoted("virtual bool Release() const { return RtlCInterface::Release(); }");
 
     BuildCtx funcctx(classctx);
     funcctx.addQuotedCompound("virtual size32_t transform(ARowBuilder & crSelf, IColumnProvider * row, IThorDiskCallback * fpp)");
@@ -6845,21 +6840,12 @@ void HqlCppTranslator::buildXmlReadTransform(IHqlExpression * dataset, StringBuf
     usesContents = xmlUsesContents;
     rootSelfRow = NULL;
 
-    classctx.addQuoted("ICodeContext * ctx;");
-    classctx.addQuoted("unsigned activityId;");
     buildMetaMember(classctx, dataset, false, "queryRecordSize");
 
-    transformClass->setIncomplete(false);
+    builder.setIncomplete(false);
+    builder.completeClass(XmlTransformerPrio);
 
-    BuildCtx factoryctx(*code, declareAtom);
-    factoryctx.setNextPriority(XmlTransformerPrio);
-    factoryctx.addQuoted(s.clear().append(interfaceName).append(" * ").append(factoryName).append("(ICodeContext * ctx, unsigned activityId) { return new ").append(className).append("(ctx, activityId); }"));
-    if (spanMultipleCppFiles())
-    {
-        s.clear().append("extern ").append(interfaceName).append(" * ").append(factoryName).append("(ICodeContext * ctx, unsigned activityId);");
-        BuildCtx protoctx(*code, mainprototypesAtom);
-        protoctx.addQuoted(s);
-    }
+    factoryName.append(builder.accessorName);
 
     OwnedHqlExpr matchedValue = createAttribute(internalAtom, createConstant(factoryName.str()), createConstant(usesContents));
     declarectx.associateExpr(xmlMarker, matchedValue);

+ 22 - 5
rtl/include/eclhelper_base.hpp

@@ -30,19 +30,26 @@ Doesn't include jlib.hpp yet, so different implementation of CInterface (RtlCInt
 //---------------------------------------------------------------------------
 // Record size handling.
 
-class COutputRowSerializer : public RtlCInterface, implements IOutputRowSerializer
+class CGlobalHelperClass : public RtlCInterface
 {
 public:
-    inline COutputRowSerializer(unsigned _activityId) { activityId = _activityId; ctx = NULL; }
-    RTLIMPLEMENT_IINTERFACE
+    inline CGlobalHelperClass(unsigned _activityId) { activityId = _activityId; ctx = NULL; }
 
     inline void onCreate(ICodeContext * _ctx) { ctx = _ctx; }
 
-    virtual void serialize(IRowSerializerTarget & out, const byte * self) = 0;
-
 protected:
     ICodeContext * ctx;
     unsigned activityId;
+
+};
+
+class COutputRowSerializer : public CGlobalHelperClass, implements IOutputRowSerializer
+{
+public:
+    inline COutputRowSerializer(unsigned _activityId) : CGlobalHelperClass(_activityId) { }
+    RTLIMPLEMENT_IINTERFACE
+
+    virtual void serialize(IRowSerializerTarget & out, const byte * self) = 0;
 };
 
 
@@ -236,6 +243,16 @@ public:
 };
 
 //---------------------------------------------------------------------------
+
+class CXmlToRowTransformer : public CGlobalHelperClass, implements IXmlToRowTransformer
+{
+public:
+    inline CXmlToRowTransformer(unsigned _activityId) : CGlobalHelperClass(_activityId) {}
+    RTLIMPLEMENT_IINTERFACE
+
+};
+
+//---------------------------------------------------------------------------
 // Record size handling.
 
 class ThorHelper : public RtlCInterface

+ 2 - 0
system/security/securesocket/securesocket.cpp

@@ -16,7 +16,9 @@
 ############################################################################## */
 
 // Some ssl prototypes use char* where they should be using const char *, resulting in lots of spurious warnings
+#ifndef _MSC_VER
 #pragma GCC diagnostic ignored "-Wwrite-strings"
+#endif
 
 //jlib
 #include "jliball.hpp"