zeroc-ice 3.8.1 → 3.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. checksums.yaml +4 -4
  2. data/dist/IceRuby/Communicator.cpp +26 -9
  3. data/dist/IceRuby/Config.h +0 -12
  4. data/dist/IceRuby/Connection.cpp +18 -9
  5. data/dist/IceRuby/DefaultSliceLoader.h +1 -1
  6. data/dist/IceRuby/Endpoint.cpp +21 -8
  7. data/dist/IceRuby/Operation.cpp +29 -11
  8. data/dist/IceRuby/Properties.cpp +3 -4
  9. data/dist/IceRuby/Proxy.cpp +11 -19
  10. data/dist/IceRuby/RubySliceLoader.cpp +1 -1
  11. data/dist/IceRuby/RubySliceLoader.h +6 -0
  12. data/dist/IceRuby/Types.cpp +162 -138
  13. data/dist/IceRuby/Types.h +68 -28
  14. data/dist/IceRuby/Util.cpp +14 -78
  15. data/dist/IceRuby/Util.h +7 -17
  16. data/dist/ice/cpp/include/Ice/Communicator.h +31 -8
  17. data/dist/ice/cpp/include/Ice/Config.h +2 -2
  18. data/dist/ice/cpp/include/Ice/Connection.h +24 -8
  19. data/dist/ice/cpp/include/Ice/CtrlCHandler.h +1 -1
  20. data/dist/ice/cpp/include/Ice/Demangle.h +1 -1
  21. data/dist/ice/cpp/include/Ice/Endpoint.h +4 -4
  22. data/dist/ice/cpp/include/Ice/Initialize.h +4 -4
  23. data/dist/ice/cpp/include/Ice/InputStream.h +5 -5
  24. data/dist/ice/cpp/include/Ice/Instrumentation.h +13 -7
  25. data/dist/ice/cpp/include/Ice/LocalExceptions.h +26 -5
  26. data/dist/ice/cpp/include/Ice/Logger.h +7 -0
  27. data/dist/ice/cpp/include/Ice/LoggerUtil.h +1 -1
  28. data/dist/ice/cpp/include/Ice/Object.h +10 -8
  29. data/dist/ice/cpp/include/Ice/ObjectAdapter.h +1 -1
  30. data/dist/ice/cpp/include/Ice/OutgoingAsync.h +5 -2
  31. data/dist/ice/cpp/include/Ice/OutgoingResponse.h +2 -1
  32. data/dist/ice/cpp/include/Ice/OutputStream.h +14 -11
  33. data/dist/ice/cpp/include/Ice/PluginFactory.h +1 -1
  34. data/dist/ice/cpp/include/Ice/Properties.h +3 -3
  35. data/dist/ice/cpp/include/Ice/Proxy.h +192 -50
  36. data/dist/ice/cpp/include/Ice/SSL/ClientAuthenticationOptions.h +3 -3
  37. data/dist/ice/cpp/include/Ice/SSL/EndpointInfo.h +1 -1
  38. data/dist/ice/cpp/include/Ice/SSL/ServerAuthenticationOptions.h +5 -5
  39. data/dist/ice/cpp/include/Ice/ServantLocator.h +1 -1
  40. data/dist/ice/cpp/include/Ice/Service.h +2 -5
  41. data/dist/ice/cpp/include/Ice/SliceLoader.h +1 -1
  42. data/dist/ice/cpp/include/Ice/SlicedData.h +5 -3
  43. data/dist/ice/cpp/include/Ice/StreamHelpers.h +1 -1
  44. data/dist/ice/cpp/include/Ice/StreamableTraits.h +2 -2
  45. data/dist/ice/cpp/include/Ice/StringConverter.h +2 -3
  46. data/dist/ice/cpp/include/Ice/StringUtil.h +2 -7
  47. data/dist/ice/cpp/include/Ice/UUID.h +1 -0
  48. data/dist/ice/cpp/include/Ice/Value.h +2 -2
  49. data/dist/ice/cpp/include/generated/Ice/BuiltinSequences.h +2 -2
  50. data/dist/ice/cpp/include/generated/Ice/Context.h +2 -2
  51. data/dist/ice/cpp/include/generated/Ice/EndpointTypes.h +2 -2
  52. data/dist/ice/cpp/include/generated/Ice/Identity.h +2 -2
  53. data/dist/ice/cpp/include/generated/Ice/Locator.h +57 -23
  54. data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +38 -11
  55. data/dist/ice/cpp/include/generated/Ice/Metrics.h +99 -44
  56. data/dist/ice/cpp/include/generated/Ice/OperationMode.h +2 -2
  57. data/dist/ice/cpp/include/generated/Ice/Process.h +34 -8
  58. data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +42 -11
  59. data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +2 -2
  60. data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +93 -40
  61. data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +8 -4
  62. data/dist/ice/cpp/include/generated/Ice/Router.h +55 -19
  63. data/dist/ice/cpp/include/generated/Ice/SliceChecksumDict.h +2 -2
  64. data/dist/ice/cpp/include/generated/Ice/Version.h +2 -2
  65. data/dist/ice/cpp/include/generated/IceDiscovery/Lookup.h +66 -14
  66. data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +34 -8
  67. data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_all.cpp +1 -1
  68. data/dist/ice/cpp/src/Ice/Base64.cpp +47 -137
  69. data/dist/ice/cpp/src/Ice/Base64.h +2 -2
  70. data/dist/ice/cpp/src/Ice/BatchRequestQueue.cpp +28 -13
  71. data/dist/ice/cpp/src/Ice/BatchRequestQueue.h +5 -1
  72. data/dist/ice/cpp/src/Ice/Buffer.cpp +1 -1
  73. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +6 -4
  74. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.h +1 -1
  75. data/dist/ice/cpp/src/Ice/Communicator.cpp +4 -3
  76. data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.cpp +8 -0
  77. data/dist/ice/cpp/src/Ice/ConnectRequestHandler.cpp +5 -15
  78. data/dist/ice/cpp/src/Ice/ConnectRequestHandler.h +1 -1
  79. data/dist/ice/cpp/src/Ice/ConnectionFactory.cpp +6 -8
  80. data/dist/ice/cpp/src/Ice/ConnectionFactory.h +0 -3
  81. data/dist/ice/cpp/src/Ice/ConnectionI.cpp +121 -108
  82. data/dist/ice/cpp/src/Ice/ConnectionI.h +12 -9
  83. data/dist/ice/cpp/src/Ice/ConsoleUtil.cpp +1 -1
  84. data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -14
  85. data/dist/ice/cpp/src/Ice/EndpointI.h +1 -1
  86. data/dist/ice/cpp/src/Ice/FileUtil.cpp +15 -79
  87. data/dist/ice/cpp/src/Ice/FileUtil.h +0 -3
  88. data/dist/ice/cpp/src/Ice/FixedRequestHandler.cpp +1 -1
  89. data/dist/ice/cpp/src/Ice/FixedRequestHandler.h +1 -1
  90. data/dist/ice/cpp/src/Ice/HttpParser.h +0 -2
  91. data/dist/ice/cpp/src/Ice/IPEndpointI.cpp +4 -0
  92. data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.cpp +6 -3
  93. data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +2 -4
  94. data/dist/ice/cpp/src/Ice/InputStream.cpp +50 -33
  95. data/dist/ice/cpp/src/Ice/Instance.cpp +73 -50
  96. data/dist/ice/cpp/src/Ice/Instance.h +1 -6
  97. data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +7 -1
  98. data/dist/ice/cpp/src/Ice/LocatorInfo.cpp +2 -2
  99. data/dist/ice/cpp/src/Ice/LoggerAdminI.cpp +13 -18
  100. data/dist/ice/cpp/src/Ice/LoggerI.cpp +1 -1
  101. data/dist/ice/cpp/src/Ice/LoggerI.h +2 -2
  102. data/dist/ice/cpp/src/Ice/MetricsAdminI.h +6 -1
  103. data/dist/ice/cpp/src/Ice/MetricsObserverI.h +22 -18
  104. data/dist/ice/cpp/src/Ice/NativePropertiesAdmin.cpp +5 -2
  105. data/dist/ice/cpp/src/Ice/Network.cpp +168 -103
  106. data/dist/ice/cpp/src/Ice/Network.h +12 -7
  107. data/dist/ice/cpp/src/Ice/NetworkProxy.cpp +17 -6
  108. data/dist/ice/cpp/src/Ice/NetworkProxy.h +2 -1
  109. data/dist/ice/cpp/src/Ice/Object.cpp +1 -1
  110. data/dist/ice/cpp/src/Ice/ObjectAdapterI.cpp +56 -19
  111. data/dist/ice/cpp/src/Ice/OpaqueEndpointI.cpp +10 -10
  112. data/dist/ice/cpp/src/Ice/Options.cpp +7 -2
  113. data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +2 -2
  114. data/dist/ice/cpp/src/Ice/OutgoingResponse.cpp +127 -127
  115. data/dist/ice/cpp/src/Ice/OutgoingResponseInternal.h +21 -0
  116. data/dist/ice/cpp/src/Ice/OutputStream.cpp +50 -65
  117. data/dist/ice/cpp/src/Ice/PluginManagerI.cpp +7 -1
  118. data/dist/ice/cpp/src/Ice/Properties.cpp +26 -16
  119. data/dist/ice/cpp/src/Ice/PropertyNames.cpp +2 -1
  120. data/dist/ice/cpp/src/Ice/PropertyUtil.cpp +1 -1
  121. data/dist/ice/cpp/src/Ice/ProtocolInstance.cpp +0 -11
  122. data/dist/ice/cpp/src/Ice/ProtocolInstance.h +1 -2
  123. data/dist/ice/cpp/src/Ice/Proxy.cpp +9 -1
  124. data/dist/ice/cpp/src/Ice/ProxyAsync.cpp +110 -13
  125. data/dist/ice/cpp/src/Ice/ProxyFunctions.cpp +4 -4
  126. data/dist/ice/cpp/src/Ice/Random.cpp +68 -7
  127. data/dist/ice/cpp/src/Ice/Random.h +6 -2
  128. data/dist/ice/cpp/src/Ice/Reference.cpp +37 -26
  129. data/dist/ice/cpp/src/Ice/Reference.h +3 -0
  130. data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +26 -13
  131. data/dist/ice/cpp/src/Ice/RequestHandler.h +3 -1
  132. data/dist/ice/cpp/src/Ice/RequestHandlerCache.cpp +1 -1
  133. data/dist/ice/cpp/src/Ice/RequestHandlerCache.h +1 -1
  134. data/dist/ice/cpp/src/Ice/ResourceConfig.h +3 -3
  135. data/dist/ice/cpp/src/Ice/RetryQueue.cpp +8 -12
  136. data/dist/ice/cpp/src/Ice/SHA1.cpp +11 -11
  137. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.cpp +0 -6
  138. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.h +0 -6
  139. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +27 -12
  140. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.h +1 -2
  141. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +77 -27
  142. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.h +2 -1
  143. data/dist/ice/cpp/src/Ice/SSL/RFC2253.cpp +2 -2
  144. data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.cpp +1 -1
  145. data/dist/ice/cpp/src/Ice/SSL/SSLEngine.h +1 -4
  146. data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +39 -34
  147. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +165 -80
  148. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.h +1 -5
  149. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +73 -33
  150. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.h +0 -1
  151. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +110 -17
  152. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.h +7 -2
  153. data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.cpp +9 -3
  154. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +73 -51
  155. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.h +0 -8
  156. data/dist/ice/cpp/src/Ice/Selector.cpp +13 -11
  157. data/dist/ice/cpp/src/Ice/ServantManager.cpp +3 -3
  158. data/dist/ice/cpp/src/Ice/Service.cpp +33 -115
  159. data/dist/ice/cpp/src/Ice/StreamSocket.cpp +33 -40
  160. data/dist/ice/cpp/src/Ice/StreamSocket.h +4 -4
  161. data/dist/ice/cpp/src/Ice/StringConverter.cpp +1 -1
  162. data/dist/ice/cpp/src/Ice/StringUtil.cpp +12 -21
  163. data/dist/ice/cpp/src/Ice/SysLoggerI.cpp +136 -100
  164. data/dist/ice/cpp/src/Ice/SysLoggerI.h +7 -3
  165. data/dist/ice/cpp/src/Ice/SystemdJournalI.cpp +1 -1
  166. data/dist/ice/cpp/src/Ice/TcpAcceptor.cpp +7 -7
  167. data/dist/ice/cpp/src/Ice/TcpAcceptor.h +2 -1
  168. data/dist/ice/cpp/src/Ice/TcpBufSize.h +40 -0
  169. data/dist/ice/cpp/src/Ice/TcpConnector.cpp +5 -2
  170. data/dist/ice/cpp/src/Ice/TcpConnector.h +2 -0
  171. data/dist/ice/cpp/src/Ice/TcpEndpointI.cpp +2 -2
  172. data/dist/ice/cpp/src/Ice/TcpTransceiver.cpp +6 -2
  173. data/dist/ice/cpp/src/Ice/ThreadPool.cpp +2 -8
  174. data/dist/ice/cpp/src/Ice/ThreadPool.h +0 -2
  175. data/dist/ice/cpp/src/Ice/Timer.cpp +7 -3
  176. data/dist/ice/cpp/src/Ice/UUID.cpp +1 -2
  177. data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +6 -3
  178. data/dist/ice/cpp/src/Ice/UdpTransceiver.cpp +136 -123
  179. data/dist/ice/cpp/src/Ice/UdpTransceiver.h +3 -4
  180. data/dist/ice/cpp/src/Ice/WSAcceptor.cpp +8 -3
  181. data/dist/ice/cpp/src/Ice/WSAcceptor.h +5 -1
  182. data/dist/ice/cpp/src/Ice/WSEndpoint.cpp +45 -2
  183. data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +214 -34
  184. data/dist/ice/cpp/src/Ice/WSTransceiver.h +13 -2
  185. data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +2 -2
  186. data/dist/ice/cpp/src/Ice/generated/Context.cpp +2 -2
  187. data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +2 -2
  188. data/dist/ice/cpp/src/Ice/generated/Identity.cpp +2 -2
  189. data/dist/ice/cpp/src/Ice/generated/Locator.cpp +2 -2
  190. data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +2 -2
  191. data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +2 -2
  192. data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +2 -2
  193. data/dist/ice/cpp/src/Ice/generated/Process.cpp +2 -2
  194. data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +2 -2
  195. data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +2 -2
  196. data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +2 -2
  197. data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +4 -2
  198. data/dist/ice/cpp/src/Ice/generated/Router.cpp +2 -2
  199. data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +2 -2
  200. data/dist/ice/cpp/src/Ice/generated/Version.cpp +2 -2
  201. data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +47 -9
  202. data/dist/ice/cpp/src/IceDiscovery/LookupI.h +8 -3
  203. data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +2 -2
  204. data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +43 -14
  205. data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +2 -2
  206. data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +32 -26
  207. data/dist/ice/cpp/src/Slice/DocCommentParser.h +6 -4
  208. data/dist/ice/cpp/src/Slice/FileTracker.cpp +3 -11
  209. data/dist/ice/cpp/src/Slice/FileTracker.h +0 -2
  210. data/dist/ice/cpp/src/Slice/Grammar.cpp +211 -210
  211. data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +34 -14
  212. data/dist/ice/cpp/src/Slice/MetadataValidation.h +3 -2
  213. data/dist/ice/cpp/src/Slice/Parser.cpp +145 -97
  214. data/dist/ice/cpp/src/Slice/Parser.h +22 -8
  215. data/dist/ice/cpp/src/Slice/Preprocessor.cpp +77 -29
  216. data/dist/ice/cpp/src/Slice/Preprocessor.h +0 -3
  217. data/dist/ice/cpp/src/Slice/Scanner.cpp +3 -3
  218. data/dist/ice/cpp/src/Slice/SliceUtil.cpp +203 -172
  219. data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +0 -2
  220. data/dist/ice/cpp/src/Slice/Util.h +21 -12
  221. data/dist/ice/cpp/src/slice2rb/Ruby.cpp +7 -3
  222. data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +26 -20
  223. data/dist/ice/cpp/src/slice2rb/RubyUtil.h +10 -13
  224. data/dist/ice/slice/Glacier2/Router.ice +3 -3
  225. data/dist/ice/slice/Ice/Identity.ice +3 -0
  226. data/dist/ice/slice/Ice/Locator.ice +6 -5
  227. data/dist/ice/slice/Ice/LocatorRegistry.ice +3 -0
  228. data/dist/ice/slice/Ice/Metrics.ice +7 -6
  229. data/dist/ice/slice/Ice/OperationMode.ice +8 -0
  230. data/dist/ice/slice/Ice/Process.ice +3 -0
  231. data/dist/ice/slice/Ice/RemoteLogger.ice +5 -5
  232. data/dist/ice/slice/Ice/ReplyStatus.ice +13 -0
  233. data/dist/ice/slice/IceGrid/Admin.ice +9 -9
  234. data/dist/ice/slice/IceGrid/Descriptor.ice +5 -5
  235. data/dist/ice/slice/IceStorm/Metrics.ice +1 -1
  236. data/dist/lib/Glacier2/Metrics.rb +1 -1
  237. data/dist/lib/Glacier2/PermissionsVerifier.rb +3 -3
  238. data/dist/lib/Glacier2/Router.rb +9 -9
  239. data/dist/lib/Glacier2/SSLInfo.rb +1 -1
  240. data/dist/lib/Glacier2/Session.rb +15 -15
  241. data/dist/lib/Ice/BuiltinSequences.rb +1 -1
  242. data/dist/lib/Ice/CompressBatch.rb +1 -2
  243. data/dist/lib/Ice/Context.rb +1 -1
  244. data/dist/lib/Ice/EndpointSelectionType.rb +1 -2
  245. data/dist/lib/Ice/EndpointTypes.rb +1 -1
  246. data/dist/lib/Ice/Identity.rb +1 -1
  247. data/dist/lib/Ice/IdentitySpaceship.rb +1 -0
  248. data/dist/lib/Ice/LocalExceptions.rb +3 -0
  249. data/dist/lib/Ice/Locator.rb +5 -5
  250. data/dist/lib/Ice/LocatorRegistry.rb +4 -4
  251. data/dist/lib/Ice/Metrics.rb +7 -7
  252. data/dist/lib/Ice/OperationMode.rb +2 -3
  253. data/dist/lib/Ice/Process.rb +3 -3
  254. data/dist/lib/Ice/PropertiesAdmin.rb +4 -4
  255. data/dist/lib/Ice/PropertyDict.rb +1 -1
  256. data/dist/lib/Ice/ProxyFunctions.rb +8 -4
  257. data/dist/lib/Ice/RemoteLogger.rb +7 -8
  258. data/dist/lib/Ice/ReplyStatus.rb +4 -4
  259. data/dist/lib/Ice/Router.rb +5 -5
  260. data/dist/lib/Ice/SliceChecksumDict.rb +1 -1
  261. data/dist/lib/Ice/SliceUtil.rb +2 -2
  262. data/dist/lib/Ice/Struct.rb +1 -0
  263. data/dist/lib/Ice/ToStringMode.rb +1 -2
  264. data/dist/lib/Ice/Value.rb +2 -2
  265. data/dist/lib/Ice/Version.rb +1 -1
  266. data/dist/lib/IceBox/ServiceManager.rb +8 -8
  267. data/dist/lib/IceGrid/Admin.rb +85 -86
  268. data/dist/lib/IceGrid/Descriptor.rb +1 -1
  269. data/dist/lib/IceGrid/Exception.rb +1 -1
  270. data/dist/lib/IceGrid/FileParser.rb +2 -2
  271. data/dist/lib/IceGrid/Registry.rb +14 -15
  272. data/dist/lib/IceGrid/Session.rb +7 -7
  273. data/dist/lib/IceGrid/UserAccountMapper.rb +2 -2
  274. data/dist/lib/IceStorm/IceStorm.rb +16 -16
  275. data/dist/lib/IceStorm/Metrics.rb +1 -1
  276. data/extconf.rb +1 -1
  277. data/ice.gemspec +3 -3
  278. metadata +5 -5
  279. data/dist/ice/cpp/src/Ice/DLLMain.cpp +0 -40
  280. data/dist/ice/cpp/src/Ice/UndefSysMacros.h +0 -37
@@ -10,6 +10,7 @@
10
10
  #include <cctype>
11
11
  #include <climits>
12
12
  #include <cstring>
13
+ #include <iomanip>
13
14
 
14
15
  #ifndef _MSC_VER
15
16
  # include <unistd.h> // For readlink()
@@ -19,6 +20,112 @@ using namespace std;
19
20
  using namespace Slice;
20
21
  using namespace IceInternal;
21
22
 
23
+ namespace
24
+ {
25
+ void writeDependencies(const string& dependencies, const string& dependFile)
26
+ {
27
+ if (dependFile.empty())
28
+ {
29
+ consoleOut << dependencies << flush;
30
+ }
31
+ else
32
+ {
33
+ ofstream of(IceInternal::streamFilename(dependFile).c_str()); // dependFile is a UTF-8 string
34
+ if (!of)
35
+ {
36
+ ostringstream os;
37
+ os << "cannot open file '" << dependFile << "': " << IceInternal::errorToString(errno);
38
+ throw Slice::FileException(os.str());
39
+ }
40
+ of << dependencies;
41
+ of.close();
42
+ }
43
+ }
44
+
45
+ // Escapes a file name and wraps it in double quotes, to produce a JSON string.
46
+ string toJSONString(string_view name)
47
+ {
48
+ ostringstream os;
49
+ os << '"';
50
+ for (char c : name)
51
+ {
52
+ switch (c)
53
+ {
54
+ case '"':
55
+ os << "\\\"";
56
+ break;
57
+ case '\\':
58
+ os << "\\\\";
59
+ break;
60
+ case '\b':
61
+ os << "\\b";
62
+ break;
63
+ case '\f':
64
+ os << "\\f";
65
+ break;
66
+ case '\n':
67
+ os << "\\n";
68
+ break;
69
+ case '\r':
70
+ os << "\\r";
71
+ break;
72
+ case '\t':
73
+ os << "\\t";
74
+ break;
75
+ default:
76
+ if (static_cast<unsigned char>(c) < 0x20)
77
+ {
78
+ // The remaining control characters have no short escape sequence.
79
+ os << "\\u" << setfill('0') << setw(4) << hex << static_cast<int>(static_cast<unsigned char>(c))
80
+ << dec;
81
+ }
82
+ else
83
+ {
84
+ // Any other character is written as is, including the bytes of a multi-byte UTF-8 sequence.
85
+ os << c;
86
+ }
87
+ break;
88
+ }
89
+ }
90
+ os << '"';
91
+ return os.str();
92
+ }
93
+
94
+ // Escapes a file name for use in a Makefile rule, following the escaping rules GCC uses in the dependency
95
+ // files it emits: '$' becomes '$$'; '#', space, and tab get a preceding backslash; and backslashes
96
+ // immediately preceding a space or tab are doubled.
97
+ string escapeMakefilePath(string_view name)
98
+ {
99
+ ostringstream os;
100
+ size_t backslashes = 0;
101
+ for (char c : name)
102
+ {
103
+ switch (c)
104
+ {
105
+ case ' ':
106
+ case '\t':
107
+ for (size_t i = 0; i < backslashes; ++i)
108
+ {
109
+ os << '\\';
110
+ }
111
+ os << '\\';
112
+ break;
113
+ case '#':
114
+ os << '\\';
115
+ break;
116
+ case '$':
117
+ os << '$';
118
+ break;
119
+ default:
120
+ break;
121
+ }
122
+ backslashes = (c == '\\') ? backslashes + 1 : 0;
123
+ os << c;
124
+ }
125
+ return os.str();
126
+ }
127
+ }
128
+
22
129
  string
23
130
  Slice::normalizePath(const string& path)
24
131
  {
@@ -172,7 +279,9 @@ Slice::changeInclude(const string& p, const vector<string>& includePaths)
172
279
  {
173
280
  for (const auto& includePath : includePaths)
174
281
  {
175
- if (i.compare(0, includePath.length(), includePath) == 0)
282
+ // The prefix test needs a path boundary, or "/a/b" would cover a file under "/a/bc".
283
+ if (i.length() > includePath.length() + 1 && i[includePath.length()] == '/' &&
284
+ i.compare(0, includePath.length(), includePath) == 0)
176
285
  {
177
286
  string s = i.substr(includePath.length() + 1); // + 1 for the '/'
178
287
  if (s.size() < result.size())
@@ -316,8 +425,6 @@ Slice::emitRaw(const char* message)
316
425
  vector<string>
317
426
  Slice::filterMcppWarnings(const string& message)
318
427
  {
319
- static const char* messages[] = {"Converted [CR+LF] to [LF]", "no newline, supplemented newline", nullptr};
320
-
321
428
  constexpr string_view warningPrefix = "warning:";
322
429
  constexpr string_view fromPrefix = "from";
323
430
  constexpr string_view separators = "\n\t ";
@@ -330,60 +437,34 @@ Slice::filterMcppWarnings(const string& message)
330
437
  in.push_back(message.substr(start, end - start));
331
438
  start = end + 1;
332
439
  }
440
+
333
441
  vector<string> out;
334
- bool skipped;
335
- for (auto i = in.begin(); i != in.end(); i++)
442
+ for (auto i = in.begin(); i != in.end();)
336
443
  {
337
- skipped = false;
444
+ bool hasWarningPrefix = i->find(warningPrefix) != string::npos;
445
+ bool hasFilterableWarning = i->find("Converted [CR+LF] to [LF]") != string::npos ||
446
+ i->find("no newline, supplemented newline") != string::npos;
338
447
 
339
- if (i->find(warningPrefix) != string::npos)
448
+ if (hasWarningPrefix && hasFilterableWarning)
340
449
  {
341
- for (int j = 0; messages[j] != nullptr; ++j)
450
+ // MCPP warnings are multi-line. The first line contains the warning message, followed by a single-line text
451
+ // snippet of the code that produced the warning. After this can follow any number of "from" lines.
452
+ assert(std::distance(i, in.end()) >= 2); // Assert there's at least 2 lines to skip (message & snippet).
453
+
454
+ // Immediately skip 2 lines (the message and the snippet). Then skip any "from" lines that followed them.
455
+ for (i += 2; i != in.end(); i++)
342
456
  {
343
- if (i->find(messages[j]) != string::npos)
457
+ string::size_type index = i->find_first_not_of(separators);
458
+ if (index == string::npos || i->find(fromPrefix, index) != index)
344
459
  {
345
- // This line should be skipped it contains the unwanted mcpp warning
346
- // next line should also be skipped it contains the slice line that
347
- // produces the skipped warning
348
- i++;
349
- skipped = true;
350
- //
351
- // Check if next lines are still the same warning
352
- //
353
- i++;
354
- while (i != in.end())
355
- {
356
- string token = *i;
357
- string::size_type index = token.find_first_not_of(separators);
358
- if (index != string::npos)
359
- {
360
- token = token.substr(index);
361
- }
362
- if (token.find(fromPrefix) != 0)
363
- {
364
- //
365
- // First line not of this warning
366
- //
367
- i--;
368
- break;
369
- }
370
- else
371
- {
372
- i++;
373
- }
374
- }
375
- break;
460
+ break; // This line isn't part of the warning we're skipping. Break, and go back to the outer loop.
376
461
  }
377
462
  }
378
- if (i == in.end())
379
- {
380
- break;
381
- }
382
- }
383
- if (!skipped)
384
- {
385
- out.push_back(*i + "\n");
463
+ continue; // Continue to the next loop iteration, to check if it's a warning that should be filtered out.
386
464
  }
465
+
466
+ // Add this line to the output, and move to the next line. We only reach here if the line wasn't filtered out.
467
+ out.push_back(*i++ + "\n");
387
468
  }
388
469
  return out;
389
470
  }
@@ -401,27 +482,6 @@ Slice::printGeneratedHeader(IceInternal::Output& out, string_view path, string_v
401
482
  out << nl << commentStyle << " <auto-generated>Generated from Slice file '" << path << "'.</auto-generated>";
402
483
  }
403
484
 
404
- void
405
- Slice::writeDependencies(const string& dependencies, const string& dependFile)
406
- {
407
- if (dependFile.empty())
408
- {
409
- consoleOut << dependencies << flush;
410
- }
411
- else
412
- {
413
- ofstream of(IceInternal::streamFilename(dependFile).c_str()); // dependFile is a UTF-8 string
414
- if (!of)
415
- {
416
- ostringstream os;
417
- os << "cannot open file '" << dependFile << "': " << IceInternal::errorToString(errno);
418
- throw Slice::FileException(os.str());
419
- }
420
- of << dependencies;
421
- of.close();
422
- }
423
- }
424
-
425
485
  #ifdef _WIN32
426
486
  vector<string>
427
487
  Slice::argvToArgs(int argc, wchar_t* argv[])
@@ -451,33 +511,20 @@ Slice::argvToArgs(int argc, char* argv[])
451
511
  // Split a scoped name into its components and return the components as a list of (unscoped) identifiers.
452
512
  //
453
513
  vector<string>
454
- Slice::splitScopedName(const string& scoped, bool allowEmpty)
514
+ Slice::splitScopedName(const string& scoped)
455
515
  {
456
- assert(scoped[0] == ':');
516
+ assert(scoped.compare(0, 2, "::") == 0); // must be a fully-scoped identifier
517
+ assert(scoped.back() != ':'); // must end with an identifier (not just "::")
518
+
457
519
  vector<string> ids;
458
- string::size_type next = 0;
520
+ string::size_type next = 2; // skip the leading "::"
459
521
  string::size_type pos;
460
522
  while ((pos = scoped.find("::", next)) != string::npos)
461
523
  {
462
- pos += 2;
463
- if (pos != scoped.size())
464
- {
465
- string::size_type endpos = scoped.find("::", pos);
466
- if (endpos != string::npos)
467
- {
468
- ids.push_back(scoped.substr(pos, endpos - pos));
469
- }
470
- }
471
- next = pos;
472
- }
473
- if (next != scoped.size())
474
- {
475
- ids.push_back(scoped.substr(next));
476
- }
477
- else if (allowEmpty)
478
- {
479
- ids.emplace_back("");
524
+ ids.push_back(scoped.substr(next, pos - next));
525
+ next = pos + 2;
480
526
  }
527
+ ids.push_back(scoped.substr(next));
481
528
 
482
529
  return ids;
483
530
  }
@@ -489,7 +536,7 @@ Slice::getArticleFor(const string& s)
489
536
  return (vowels.find_first_of(s[0]) != string::npos) ? "an" : "a";
490
537
  }
491
538
 
492
- std::string
539
+ string
493
540
  Slice::pluralKindOf(const ContainedPtr& p)
494
541
  {
495
542
  string kindOf = p->kindOf();
@@ -507,58 +554,6 @@ Slice::pluralKindOf(const ContainedPtr& p)
507
554
  }
508
555
  }
509
556
 
510
- bool
511
- Slice::reportIllegalSuffixOrUnderscore(const string& identifier)
512
- {
513
- // check whether the identifier is scoped
514
- size_t scopeIndex = identifier.rfind("::");
515
- bool isScoped = scopeIndex != string::npos;
516
- string name;
517
- if (isScoped)
518
- {
519
- name = identifier.substr(scopeIndex + 2); // Only check the unscoped identifier for syntax
520
- }
521
- else
522
- {
523
- name = identifier;
524
- }
525
-
526
- assert(!name.empty());
527
- bool isValid = true;
528
-
529
- // check the identifier for reserved suffixes
530
- static const string suffixBlacklist[] = {"Helper", "Holder", "Prx", "Ptr"};
531
- for (const auto& i : suffixBlacklist)
532
- {
533
- if (name.find(i, name.size() - i.size()) != string::npos)
534
- {
535
- currentUnit->error("illegal identifier '" + name + "': '" + i + "' suffix is reserved");
536
- isValid = false;
537
- break;
538
- }
539
- }
540
-
541
- // check the identifier for illegal underscores
542
- size_t index = name.find('_');
543
- if (index == 0)
544
- {
545
- currentUnit->error("illegal leading underscore in identifier '" + name + "'");
546
- isValid = false;
547
- }
548
- else if (name.rfind('_') == (name.size() - 1))
549
- {
550
- currentUnit->error("illegal trailing underscore in identifier '" + name + "'");
551
- isValid = false;
552
- }
553
- else if (name.find("__") != string::npos)
554
- {
555
- currentUnit->error("illegal double underscore in identifier '" + name + "'");
556
- isValid = false;
557
- }
558
-
559
- return isValid;
560
- }
561
-
562
557
  bool
563
558
  Slice::isProxyType(const TypePtr& type)
564
559
  {
@@ -635,7 +630,7 @@ Slice::getFirstSentence(const StringList& lines)
635
630
  }
636
631
 
637
632
  string
638
- Slice::getEscapedParamName(const ParameterList& params, std::string_view param)
633
+ Slice::getEscapedParamName(const ParameterList& params, string_view param)
639
634
  {
640
635
  for (const auto& p : params)
641
636
  {
@@ -650,14 +645,14 @@ Slice::getEscapedParamName(const ParameterList& params, std::string_view param)
650
645
  string
651
646
  Slice::getTypeScopedName(const TypePtr& type)
652
647
  {
653
- if (auto builtin = std::dynamic_pointer_cast<Builtin>(type))
648
+ if (auto builtin = dynamic_pointer_cast<Builtin>(type))
654
649
  {
655
650
  return builtin->kindAsString();
656
651
  }
657
652
  else
658
653
  {
659
654
  // a type is either built-in or contained
660
- auto contained = std::dynamic_pointer_cast<Contained>(type);
655
+ auto contained = dynamic_pointer_cast<Contained>(type);
661
656
  assert(contained);
662
657
  return contained->scoped();
663
658
  }
@@ -719,6 +714,45 @@ Slice::relativePath(const string& path1, const string& path2)
719
714
  return newPath;
720
715
  }
721
716
 
717
+ string
718
+ Slice::escapeXMLAttribute(string_view name)
719
+ {
720
+ ostringstream os;
721
+ for (char c : name)
722
+ {
723
+ switch (c)
724
+ {
725
+ case '&':
726
+ os << "&amp;";
727
+ break;
728
+ case '<':
729
+ os << "&lt;";
730
+ break;
731
+ case '>':
732
+ os << "&gt;";
733
+ break;
734
+ case '"':
735
+ os << "&quot;";
736
+ break;
737
+ // An XML parser replaces a literal tab, line feed or carriage return in an attribute value by a
738
+ // space. Character references survive this normalization.
739
+ case '\t':
740
+ os << "&#x9;";
741
+ break;
742
+ case '\n':
743
+ os << "&#xA;";
744
+ break;
745
+ case '\r':
746
+ os << "&#xD;";
747
+ break;
748
+ default:
749
+ os << c;
750
+ break;
751
+ }
752
+ }
753
+ return os.str();
754
+ }
755
+
722
756
  void
723
757
  Slice::DependencyGenerator::addDependenciesFor(const UnitPtr& unit)
724
758
  {
@@ -726,36 +760,29 @@ Slice::DependencyGenerator::addDependenciesFor(const UnitPtr& unit)
726
760
  }
727
761
 
728
762
  void
729
- Slice::DependencyGenerator::writeMakefileDependencies(
730
- const string& dependFile,
731
- const string& source,
732
- const string& target)
763
+ Slice::DependencyGenerator::addMakefileRule(const string& source, const string& target)
764
+ {
765
+ _makefileRules.emplace_back(source, target);
766
+ }
767
+
768
+ void
769
+ Slice::DependencyGenerator::writeMakefileDependencies(const string& dependFile)
733
770
  {
734
771
  ostringstream os;
735
- StringList dependencies = _dependencyMap[source];
736
- // Write the target
737
- if (dependencies.empty())
738
- {
739
- os << target << ":" << std::endl;
740
- }
741
- else
772
+ for (const auto& [source, target] : _makefileRules)
742
773
  {
743
- os << target << ": \\" << std::endl;
744
- for (const auto& dependency : dependencies)
774
+ os << escapeMakefilePath(target) << ":";
775
+ for (const auto& dependency : _dependencyMap[source])
745
776
  {
746
- os << " " << dependency;
747
- if (dependency != dependencies.back())
748
- {
749
- os << " \\";
750
- }
751
- os << std::endl;
777
+ os << " \\" << endl << " " << escapeMakefilePath(dependency);
752
778
  }
779
+ os << endl;
753
780
  }
754
781
  writeDependencies(os.str(), dependFile);
755
782
  }
756
783
 
757
784
  void
758
- Slice::DependencyGenerator::writeXMLDependencies(const std::string& dependFile)
785
+ Slice::DependencyGenerator::writeXMLDependencies(const string& dependFile)
759
786
  {
760
787
  ostringstream os;
761
788
  os << R"(<?xml version="1.0" encoding="UTF-8"?>)";
@@ -764,11 +791,10 @@ Slice::DependencyGenerator::writeXMLDependencies(const std::string& dependFile)
764
791
  {
765
792
  string source = dependencies.front();
766
793
  dependencies.pop_front();
767
- string dirName = Slice::dirName(source);
768
- os << endl << " <source name=\"" << source << "\">";
794
+ os << endl << " <source name=\"" << escapeXMLAttribute(source) << "\">";
769
795
  for (const auto& dependency : dependencies)
770
796
  {
771
- os << endl << " <dependsOn name=\"" << dependency << "\" />";
797
+ os << endl << " <dependsOn name=\"" << escapeXMLAttribute(dependency) << "\" />";
772
798
  }
773
799
  os << endl << " </source>";
774
800
  }
@@ -777,18 +803,23 @@ Slice::DependencyGenerator::writeXMLDependencies(const std::string& dependFile)
777
803
  }
778
804
 
779
805
  void
780
- Slice::DependencyGenerator::writeJSONDependencies(const std::string& dependFile)
806
+ Slice::DependencyGenerator::writeJSONDependencies(const string& dependFile)
781
807
  {
782
808
  ostringstream os;
783
809
  os << "{";
810
+ bool firstSource = true;
784
811
  for (auto [_, dependencies] : _dependencyMap)
785
812
  {
786
813
  string source = dependencies.front();
787
814
  dependencies.pop_front();
788
- os << endl << " \"" << source << "\" : [";
815
+ os << (firstSource ? "" : ",") << endl << " " << toJSONString(source) << " : [";
816
+ firstSource = false;
817
+
818
+ bool firstDependency = true;
789
819
  for (const auto& dependency : dependencies)
790
820
  {
791
- os << endl << " \"" << dependency << "\"";
821
+ os << (firstDependency ? "" : ",") << endl << " " << toJSONString(dependency);
822
+ firstDependency = false;
792
823
  }
793
824
  os << endl << " ]";
794
825
  }
@@ -384,8 +384,6 @@ Slice::toStringLiteral(
384
384
  }
385
385
  else
386
386
  {
387
- assert(escapeMode == Octal);
388
-
389
387
  for (size_t i = 0; i < value.size(); ++i)
390
388
  {
391
389
  char c = value[i];
@@ -59,9 +59,7 @@ namespace Slice
59
59
  EscapeMode escapeMode,
60
60
  unsigned char cutOff);
61
61
 
62
- void writeDependencies(const std::string& dependencies, const std::string& dependFile);
63
-
64
- std::vector<std::string> splitScopedName(const std::string& scoped, bool allowEmpty = true);
62
+ std::vector<std::string> splitScopedName(const std::string& scoped);
65
63
 
66
64
  /// Returns "an" if @p s starts with a vowel and "a" otherwise.
67
65
  std::string getArticleFor(const std::string& s);
@@ -70,9 +68,6 @@ namespace Slice
70
68
  /// @see Contained::kindOf
71
69
  std::string pluralKindOf(const ContainedPtr& p);
72
70
 
73
- // Checks an identifier for illegal syntax and reports any errors that are present.
74
- bool reportIllegalSuffixOrUnderscore(const std::string& identifier);
75
-
76
71
  bool isProxyType(const TypePtr& type);
77
72
 
78
73
  // Is this the first element defined in its container?
@@ -95,25 +90,36 @@ namespace Slice
95
90
 
96
91
  [[nodiscard]] std::string relativePath(const std::string& path1, const std::string& path2);
97
92
 
93
+ /// Escapes a file name for use in a double-quoted XML attribute value.
94
+ /// @param name The file name to escape.
95
+ /// @return The escaped file name.
96
+ [[nodiscard]] std::string escapeXMLAttribute(std::string_view name);
97
+
98
98
  /// The DependencyGenerator class is used to collect dependencies of Slice units.
99
99
  class DependencyGenerator final
100
100
  {
101
101
  public:
102
102
  void addDependenciesFor(const UnitPtr& unit);
103
103
 
104
+ /// Records a Makefile rule for a file that is generated from the specified source. The rule's prerequisites
105
+ /// are the dependencies recorded for the source by addDependenciesFor.
106
+ ///
107
+ /// @param source The source file that the target is generated from.
108
+ /// @param target The generated file, used as the Makefile target.
109
+ void addMakefileRule(const std::string& source, const std::string& target);
110
+
104
111
  /// Writes the dependencies in Makefile format to the specified file. If 'dependFile' is empty, it writes the
105
112
  /// dependencies to standard output instead.
106
113
  ///
114
+ /// This method writes one rule for each target recorded with addMakefileRule.
115
+ ///
107
116
  /// @param dependFile The file to write the dependencies to or empty to write to standard output.
108
- /// @param source The source file for which dependencies are being written.
109
- /// @param target The target file that is generated from the source. This is used as the Makefile target.
110
- void
111
- writeMakefileDependencies(const std::string& dependFile, const std::string& source, const std::string& target);
117
+ void writeMakefileDependencies(const std::string& dependFile);
112
118
 
113
119
  /// Writes the dependencies in XML format to the specified file. If 'dependFile' is empty, it writes the
114
120
  /// dependencies to standard output instead.
115
121
  ///
116
- /// This method write the dependencies for all visited units in a single XML document.
122
+ /// This method writes the dependencies for all visited units in a single XML document.
117
123
  ///
118
124
  /// @param dependFile The file to write the dependencies to or empty to write to standard output.
119
125
  void writeXMLDependencies(const std::string& dependFile);
@@ -121,13 +127,16 @@ namespace Slice
121
127
  /// Writes the dependencies in JSON format to the specified file. If 'dependFile' is empty, it writes the
122
128
  /// dependencies to standard output instead.
123
129
  ///
124
- /// This method write the dependencies for all visited units in a single JSON document.
130
+ /// This method writes the dependencies for all visited units in a single JSON document.
125
131
  ///
126
132
  /// @param dependFile The file to write the dependencies to or empty to write to standard output.
127
133
  void writeJSONDependencies(const std::string& dependFile);
128
134
 
129
135
  private:
130
136
  std::map<std::string, StringList> _dependencyMap;
137
+
138
+ // The rules recorded by addMakefileRule: (source, target) pairs, in recording order.
139
+ std::vector<std::pair<std::string, std::string>> _makefileRules;
131
140
  };
132
141
 
133
142
  /// Helper method to create the directory structure for a package path.
@@ -171,9 +171,9 @@ Slice::Ruby::compile(const vector<string>& argv)
171
171
  if (depend)
172
172
  {
173
173
  string target = removeExtension(baseName(fileName)) + ".rb";
174
- dependencyGenerator.writeMakefileDependencies(dependFile, unit->topLevelFile(), target);
174
+ dependencyGenerator.addMakefileRule(unit->topLevelFile(), target);
175
175
  }
176
- // Else XML dependencies are written below after all units have been processed.
176
+ // The dependencies are written below, after all units have been processed.
177
177
  }
178
178
  else
179
179
  {
@@ -241,7 +241,11 @@ Slice::Ruby::compile(const vector<string>& argv)
241
241
  return status;
242
242
  }
243
243
 
244
- if (dependXML)
244
+ if (depend)
245
+ {
246
+ dependencyGenerator.writeMakefileDependencies(dependFile);
247
+ }
248
+ else if (dependXML)
245
249
  {
246
250
  dependencyGenerator.writeXMLDependencies(dependFile);
247
251
  }