summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2012-08-06 16:14:03 +0200
committerBenoit Foucher <benoit@zeroc.com>2012-08-06 16:14:03 +0200
commit7047b953adab26c7098cbfaea2b69f9d36231cd3 (patch)
tree8668c830838184ebc465554b85c085da42fb6f6a /cpp/src/slice2cpp
parentMissing files (diff)
parentRemoved Stream::format method, replace with startWriteEncaps parameter (diff)
downloadice-7047b953adab26c7098cbfaea2b69f9d36231cd3.tar.bz2
ice-7047b953adab26c7098cbfaea2b69f9d36231cd3.tar.xz
ice-7047b953adab26c7098cbfaea2b69f9d36231cd3.zip
Merge remote-tracking branch 'origin/encoding11' into mx
Conflicts: cpp/src/Ice/.depend cpp/src/Ice/.depend.mak cpp/src/slice2cpp/Gen.cpp
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp85
-rw-r--r--cpp/src/slice2cpp/Gen.h5
-rw-r--r--cpp/src/slice2cpp/Makefile15
3 files changed, 25 insertions, 80 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 50fa1ad25ca..e07bc4bf44a 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -214,12 +214,12 @@ Slice::Gen::Gen(const string& base, const string& headerExtension, const string&
Slice::Gen::~Gen()
{
- H << "\n\n#endif\n";
+ H << '\n';
C << '\n';
if(_impl)
{
- implH << "\n\n#endif\n";
+ implH << '\n';
implC << '\n';
}
}
@@ -280,15 +280,7 @@ Slice::Gen::generate(const UnitPtr& p)
}
FileTracker::instance()->addFile(fileImplC);
- string s = fileImplH;
- if(_include.size())
- {
- s = _include + '/' + s;
- }
- transform(s.begin(), s.end(), s.begin(), ToIfdef());
- implH << "#ifndef __" << s << "__";
- implH << "\n#define __" << s << "__";
- implH << '\n';
+ implH << "#pragma once\n";
}
string fileH = _base + "." + _headerExtension;
@@ -322,16 +314,7 @@ Slice::Gen::generate(const UnitPtr& p)
printHeader(C);
printGeneratedHeader(C, _base + ".ice");
-
- string s = fileH;
- if(_include.size())
- {
- s = _include + '/' + s;
- }
- transform(s.begin(), s.end(), s.begin(), ToIfdef());
- H << "\n#ifndef __" << s << "__";
- H << "\n#define __" << s << "__";
- H << '\n';
+ H << "#pragma once\n";
validateMetaData(p);
@@ -2253,12 +2236,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
}
else
{
- C << nl << "::IceInternal::BasicStream* __os = __result->__startWriteParams(" << formatTypeToString(p->format()) << ");";
- FormatType format = p->format();
- if(p->sendsClasses() && format != DefaultFormat)
- {
- C << nl << "__os->format(" << formatTypeToString(format) << ");";
- }
+ C << nl << "::IceInternal::BasicStream* __os = __result->__startWriteParams(" << opFormatTypeToString(p) <<");";
writeMarshalCode(C, inParams, 0, TypeContextInParam);
C << nl << "__result->__endWriteParams();";
}
@@ -2794,15 +2772,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
{
C << nl << "try";
C << sb;
- C << nl<< "::IceInternal::BasicStream* __os = __og.startWriteParams();";
- if(p->sendsClasses())
- {
- FormatType format = p->format();
- if(format != DefaultFormat)
- {
- C << nl << "__os->format(" << formatTypeToString(format) << ");";
- }
- }
+ C << nl<< "::IceInternal::BasicStream* __os = __og.startWriteParams(" << opFormatTypeToString(p) << ");";
writeMarshalCode(C, inParams, 0, TypeContextInParam);
C << nl << "__og.endWriteParams();";
C << eb;
@@ -4361,14 +4331,10 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
C << retS << " __ret = ";
}
C << fixKwd(name) << args << ';';
- FormatType format = p->format();
if(ret || !outParams.empty())
{
- C << nl << "::IceInternal::BasicStream* __os = __inS.__startWriteParams();";
- if(p->returnsClasses() && format != DefaultFormat)
- {
- C << nl << "__os->format(" << formatTypeToString(format) << ");";
- }
+ C << nl << "::IceInternal::BasicStream* __os = __inS.__startWriteParams("
+ << opFormatTypeToString(p) << ");";
writeMarshalCode(C, outParams, p);
C << nl << "__inS.__endWriteParams(true);";
}
@@ -4385,13 +4351,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
{
C << nl << "catch(const " << fixKwd((*r)->scoped()) << "& __ex)";
C << sb;
- C << nl << "::IceInternal::BasicStream* __os = __inS.__startWriteParams();";
- if(format != DefaultFormat)
- {
- C << nl << "__os->format(" << formatTypeToString(format) << ");";
- }
- C << nl << "__os->write(__ex);";
- C << nl << "__inS.__endWriteParams(false);";
+ C << nl << "__inS.__writeUserException(__ex, " << opFormatTypeToString(p) << ");";
C << eb;
}
C << nl << "return ::Ice::DispatchUserException;";
@@ -6045,18 +6005,6 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p)
H << nl << "// COMPILERFIX: The using directive avoid compiler warnings with -Woverloaded-virtual";
H << nl << "using ::IceInternal::IncomingAsync::ice_exception;";
H << nl << "virtual void ice_exception(const ::std::exception&);";
-
- H.zeroIndent();
- H << nl << "#if defined(__BCPLUSPLUS__)";
- H.restoreIndent();
- H << nl << "// COMPILERFIX: Avoid compiler warnings with C++Builder 2010";
- H << nl << "virtual void ice_exception()";
- H << sb;
- H << nl << "::IceInternal::IncomingAsync::ice_exception();";
- H << eb;
- H.zeroIndent();
- H << nl << "#endif";
- H.restoreIndent();
}
H << eb << ';';
@@ -6073,16 +6021,11 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p)
C << sb;
C << nl << "if(__validateResponse(true))";
C << sb;
- FormatType format = p->format();
if(ret || !outParams.empty())
{
C << nl << "try";
C << sb;
- C << nl << "::IceInternal::BasicStream* __os = __startWriteParams();";
- if(p->returnsClasses() && format != DefaultFormat)
- {
- C << nl << "__os->format(" << formatTypeToString(format) << ");";
- }
+ C << nl << "::IceInternal::BasicStream* __os = __startWriteParams(" << opFormatTypeToString(p) << ");";
writeMarshalCode(C, outParams, p, TypeContextInParam);
C << nl << "__endWriteParams(true);";
C << eb;
@@ -6118,13 +6061,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p)
C << sb;
C << nl <<"if(__validateResponse(false))";
C << sb;
- C << nl << "::IceInternal::BasicStream* __os = __startWriteParams();";
- if(format != DefaultFormat)
- {
- C << nl << "__os->format(" << formatTypeToString(format) << ");";
- }
- C << nl << "__os->write(*__ex);";
- C << nl << "__endWriteParams(false);";
+ C << nl << "__writeUserException(*__ex, " << opFormatTypeToString(p) << ");";
C << nl << "__response();";
C << eb;
C << eb;
diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h
index 9d05ca2a8b5..941b2a90e12 100644
--- a/cpp/src/slice2cpp/Gen.h
+++ b/cpp/src/slice2cpp/Gen.h
@@ -7,8 +7,7 @@
//
// **********************************************************************
-#ifndef GEN_H
-#define GEN_H
+#pragma once
#include <Slice/Parser.h>
#include <IceUtil/OutputUtil.h>
@@ -451,5 +450,3 @@ private:
};
}
-
-#endif
diff --git a/cpp/src/slice2cpp/Makefile b/cpp/src/slice2cpp/Makefile
index dc15e514e7e..167f35e7dc8 100644
--- a/cpp/src/slice2cpp/Makefile
+++ b/cpp/src/slice2cpp/Makefile
@@ -9,7 +9,13 @@
top_srcdir = ../..
-NAME = $(top_srcdir)/bin/slice2cpp
+include $(top_srcdir)/config/Make.rules.common
+
+ifeq ($(MinGW), yes)
+ NAME = $(top_srcdir)/bin/slice2cpp.exe
+else
+ NAME = $(top_srcdir)/bin/slice2cpp
+endif
TARGETS = $(NAME)
@@ -22,10 +28,15 @@ include $(top_srcdir)/config/Make.rules
CPPFLAGS := -I. $(CPPFLAGS)
+ifeq ($(MinGW), yes)
+$(NAME): $(OBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(OBJS) -lslice$(COMPSUFFIX)$(SOVERSION)$(LIBSUFFIX) $(BASELIBS) $(MCPP_RPATH_LINK)
+else
$(NAME): $(OBJS)
rm -f $@
$(CXX) $(LDFLAGS) -o $@ $(OBJS) -lSlice $(BASELIBS) $(MCPP_RPATH_LINK)
-
+endif
install:: all
$(call installprogram,$(NAME),$(install_bindir))