Browse Source

Disable Wimplicit-function-declaration for executable test build on CI build server

bel 9 năm trước cách đây
mục cha
commit
5cf6afbaeb
2 tập tin đã thay đổi với 16 bổ sung4 xóa
  1. 5 4
      src/main.c
  2. 11 0
      test/private_exe.c

+ 5 - 4
src/main.c

@@ -34,10 +34,11 @@
 #define _XOPEN_SOURCE 600 /* For PATH_MAX on linux */
 #define _XOPEN_SOURCE 600 /* For PATH_MAX on linux */
 /* This should also be sufficient for "realpath", according to
 /* This should also be sufficient for "realpath", according to
  * http://man7.org/linux/man-pages/man3/realpath.3.html, but in
  * http://man7.org/linux/man-pages/man3/realpath.3.html, but in
- * reality it does not seem to work. Try some other defines. */
-#define _BSD_SOURCE
-#define _XOPEN_SOURCE_EXTENDED
-
+ * reality it does not seem to work. */
+/* In case this causes a problem, disable the warning:
+ * #pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
+ * #pragma clang diagnostic ignored "-Wimplicit-function-declaration"
+ */
 #endif
 #endif
 
 
 #ifndef IGNORE_UNUSED_RESULT
 #ifndef IGNORE_UNUSED_RESULT

+ 11 - 0
test/private_exe.c

@@ -29,6 +29,17 @@
 
 
 #include "private_exe.h"
 #include "private_exe.h"
 
 
+/* This is required for "realpath". According to
+ * http://man7.org/linux/man-pages/man3/realpath.3.html
+ * defining _XOPEN_SOURCE 600 should be enough, but in
+ * practice this does not work. */
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wimplicit-function-declaration"
+#endif
+#ifdef GCC
+#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
+#endif
+
 #include "../src/main.c"
 #include "../src/main.c"
 
 
 #include <stdlib.h>
 #include <stdlib.h>