فهرست منبع

Fix abort definition for C++

Jeremy Soller 2 سال پیش
والد
کامیت
334e33cfde
2فایلهای تغییر یافته به همراه5 افزوده شده و 5 حذف شده
  1. 4 4
      include/bits/stdlib.h
  2. 1 1
      src/c/stdlib.c

+ 4 - 4
include/bits/stdlib.h

@@ -1,6 +1,10 @@
 #ifndef _BITS_STDLIB_H
 #define _BITS_STDLIB_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef __cplusplus
 // C++ needs abort to be a function, define backup function
 void abort(void);
@@ -9,10 +13,6 @@ void abort(void);
 #define abort() __abort(__func__, __FILE__, __LINE__)
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 long double strtold(const char *nptr, char **endptr);
 
 #ifdef __cplusplus

+ 1 - 1
src/c/stdlib.c

@@ -8,7 +8,7 @@ long double strtold(const char *nptr, char **endptr) {
 void __abort(const char *func, const char *file, int line);
 
 // backup definition of abort for programs that link it directly
-void abort() {
+void abort(void) {
     // call detailed abort function
     __abort(__func__, __FILE__, __LINE__);
 }