google-breakpad在 C++11下编译错误 ISO C++ forbids declaration of ‘typeof’ with no type

时间:2022-10-16 16:12:36

参考https://code.google.com/p/google-breakpad/issues/detail?id=481


ISO C++ forbids declaration of ‘typeof’ with no type

typedef ‘google_breakpad::typeof’ is initialized (use decltype instead)



因为 C++11 把 关键字typeof改为decltype
具体有两个地方要改的:


第一个文件:linux_dumper.h

typedef  typeof(((elf_aux_entry*) 0)->a_un.a_val)  elf_aux_val_t;

第二个文件:eintr_wrapper.h

#define HANDLE_EINTR(x) ({ \
  typeof(x) eintr_wrapper_result; \
  do { \
    eintr_wrapper_result = (x); \
  } while (eintr_wrapper_result == -1 && errno == EINTR); \
  eintr_wrapper_result; \
})

#define IGNORE_EINTR(x) ({ \
  typeof(x) eintr_wrapper_result; \
  do { \
    eintr_wrapper_result = (x); \
    if (eintr_wrapper_result == -1 && errno == EINTR) { \
      eintr_wrapper_result = 0; \
    } \
  } while (0); \
  eintr_wrapper_result; \
})