diff options
author | Jose <jose@zeroc.com> | 2012-07-19 16:39:19 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2012-07-19 16:39:19 +0200 |
commit | 96c87b5868d7f01320923fae307870538501acd5 (patch) | |
tree | 0b691b63b9859cad897753ae930ed334cfba4b42 /cpp/src/slice2cpp | |
parent | WinRT support (diff) | |
download | ice-96c87b5868d7f01320923fae307870538501acd5.tar.bz2 ice-96c87b5868d7f01320923fae307870538501acd5.tar.xz ice-96c87b5868d7f01320923fae307870538501acd5.zip |
ICE-4782 Generate "#pragma once" for include-guards in generated C++ header files.
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 25 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.h | 5 |
2 files changed, 5 insertions, 25 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index f9cf0ecfd32..0d662a1c1f5 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -184,12 +184,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'; } } @@ -250,15 +250,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; @@ -292,16 +284,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); diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h index 6e217075c10..f30a220b445 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> @@ -470,5 +469,3 @@ private: }; } - -#endif |