[hydra-commits] kpfleming: ice/trunk r560 - /ice/trunk/cpp/src/slice2cpp/Gen.cpp

SVN commits to the Hydra project hydra-commits at lists.digium.com
Thu Apr 1 16:14:14 CDT 2010


Author: kpfleming
Date: Thu Apr  1 16:14:13 2010
New Revision: 560

URL: https://origsvn.digium.com/svn-view/hydra?view=rev&rev=560
Log:
Modify the slice2cpp translator to emit "#pragma once" as the include-guard
mechanism in generated header files instead of the "#ifdef" style. Every
compiler that is expected to be able to compile the output supports it, as
best I can tell.


Modified:
    ice/trunk/cpp/src/slice2cpp/Gen.cpp

Modified: ice/trunk/cpp/src/slice2cpp/Gen.cpp
URL: https://origsvn.digium.com/svn-view/hydra/ice/trunk/cpp/src/slice2cpp/Gen.cpp?view=diff&rev=560&r1=559&r2=560
==============================================================================
--- ice/trunk/cpp/src/slice2cpp/Gen.cpp (original)
+++ ice/trunk/cpp/src/slice2cpp/Gen.cpp Thu Apr  1 16:14:13 2010
@@ -157,12 +157,12 @@
 
 Slice::Gen::~Gen()
 {
-    H << "\n\n#endif\n";
+    H << "\n";
     C << '\n';
 
     if(_impl)
     {
-        implH << "\n\n#endif\n";
+        implH << "\n";
         implC << '\n';
     }
 }
@@ -229,9 +229,7 @@
             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;
@@ -266,15 +264,7 @@
     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 << "\n#pragma once\n";
 
     validateMetaData(p);
 





More information about the asterisk-scf-commits mailing list