浏览代码

Use backup abort on C++

Jeremy Soller 2 年之前
父节点
当前提交
2b3e9a3bd0
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      include/bits/stdlib.h

+ 7 - 1
include/bits/stdlib.h

@@ -1,7 +1,13 @@
 #ifndef _BITS_STDLIB_H
 #define _BITS_STDLIB_H
 
-# define abort() __abort(__func__, __FILE__, __LINE__)
+#ifdef __cplusplus
+// C++ needs abort to be a function, define backup function
+void abort(void);
+#else
+// C uses detailed abort macro
+#define abort() __abort(__func__, __FILE__, __LINE__)
+#endif
 
 #ifdef __cplusplus
 extern "C" {