Selaa lähdekoodia

Use backup abort on C++

Jeremy Soller 2 vuotta sitten
vanhempi
commit
2b3e9a3bd0
1 muutettua tiedostoa jossa 7 lisäystä ja 1 poistoa
  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" {