summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Gen.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2012-09-05 12:53:04 -0400
committerBernard Normier <bernard@zeroc.com>2012-09-05 12:53:04 -0400
commit5a6991e90533828da9d6672fcba41138993bdb91 (patch)
tree27331a029e806b06b94094eb4dfa891e3069df6b /cpp/src/slice2cpp/Gen.cpp
parentuse Optional for C# one-shot constructors (diff)
downloadice-5a6991e90533828da9d6672fcba41138993bdb91.tar.bz2
ice-5a6991e90533828da9d6672fcba41138993bdb91.tar.xz
ice-5a6991e90533828da9d6672fcba41138993bdb91.zip
Undo pragma-once-in-header enhancement
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 8227dc8f445..b0c4f5666db 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';
+ H << "\n\n#endif\n";
C << '\n';
if(_impl)
{
- implH << '\n';
+ implH << "\n\n#endif\n";
implC << '\n';
}
}
@@ -280,7 +280,15 @@ Slice::Gen::generate(const UnitPtr& p)
}
FileTracker::instance()->addFile(fileImplC);
- implH << "#pragma once\n";
+ 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';
}
string fileH = _base + "." + _headerExtension;
@@ -314,7 +322,16 @@ Slice::Gen::generate(const UnitPtr& p)
printHeader(C);
printGeneratedHeader(C, _base + ".ice");
- H << "#pragma once\n";
+
+ 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';
validateMetaData(p);