浏览代码

Fix compilation on GCC 4.8

pull/44/head
Paul J. Davis 12 年前
父节点
当前提交
bf8276155d
共有 1 个文件被更改,包括 14 次插入1 次删除
  1. +14
    -1
      c_src/double-conversion/utils.h

+ 14
- 1
c_src/double-conversion/utils.h 查看文件

@ -292,11 +292,24 @@ class StringBuilder {
// you can use BitCast to cast one pointer type to another. This confuses gcc
// enough that it can no longer see that you have cast one pointer type to
// another thus avoiding the warning.
//
// Adding an unused attribute for this static check. Apparently GCC 4.8
// now throws an error for unused typedefs which triggers -Werror.
//
// PJD: 4-24-2013
//
#if defined(__GCC__)
#define UNUSED __atribute__((unused))
#else
#define UNUSED
#endif
template <class Dest, class Source>
inline Dest BitCast(const Source& source) {
// Compile time assertion: sizeof(Dest) == sizeof(Source)
// A compile error here means your Dest and Source have different sizes.
typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
UNUSED typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
Dest dest;
memmove(&dest, &source, sizeof(dest));

正在加载...
取消
保存