[PATCH] D25501: [Orc] Specialize SerializationTraits on (un)signed char to fix SunOS
Michał Górny via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 12 00:04:26 PDT 2016
mgorny created this revision.
mgorny added a reviewer: lhames.
mgorny added a subscriber: llvm-commits.
Specialize the SerializationTraits on 'char', 'signed char'
and 'unsigned char' directly, rather than combining the first one with
'int8_t' and 'uint8_t'. While the latter types are commonly implemented
using 'signed char' and 'unsigned char', there is no guarantee that
a plain 'char' would not be used for their implementation.
This is exactly what happens on SunOS (OpenIndiana), where 'int8_t' is
implemented using 'char' (which is signed by default on the platform).
As a result, the specialization for 'int8_t' is equivalent to the one
for 'char' and causes the build to fail:
In file included from .../lib/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.cpp:10:
In file included from .../include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h:19:
.../include/llvm/ExecutionEngine/Orc/RPCByteChannel.h:161:7: error: redefinition of 'SerializationTraits<type-parameter-0-0, char, void>'
class SerializationTraits<ChannelT, char>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../psllvm/include/llvm/ExecutionEngine/Orc/RPCByteChannel.h:154:7: note: previous definition is here
class SerializationTraits<ChannelT, int8_t>
^
1 error generated.
Therefore, use 'signed char' and 'unsigned char' directly, since both
those types are guaranteed to be distinct from 'char'. They should also
be of the same size as int8_t/uint8_t on all platforms LLVM is being
built on.
https://reviews.llvm.org/D25501
Files:
include/llvm/ExecutionEngine/Orc/RPCByteChannel.h
Index: include/llvm/ExecutionEngine/Orc/RPCByteChannel.h
===================================================================
--- include/llvm/ExecutionEngine/Orc/RPCByteChannel.h
+++ include/llvm/ExecutionEngine/Orc/RPCByteChannel.h
@@ -144,14 +144,14 @@
};
template <typename ChannelT>
-class SerializationTraits<ChannelT, uint8_t>
+class SerializationTraits<ChannelT, unsigned char>
: public RPCByteChannelPrimitiveSerialization<ChannelT, uint8_t> {
public:
static const char* getName() { return "uint8_t"; }
};
template <typename ChannelT>
-class SerializationTraits<ChannelT, int8_t>
+class SerializationTraits<ChannelT, signed char>
: public RPCByteChannelPrimitiveSerialization<ChannelT, int8_t> {
public:
static const char* getName() { return "int8_t"; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25501.74330.patch
Type: text/x-patch
Size: 784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161012/3f46606b/attachment.bin>
More information about the llvm-commits
mailing list