Browse Source

Move redefinition of main to test header

bel 9 years ago
parent
commit
1e0745cda2
3 changed files with 15 additions and 6 deletions
  1. 6 1
      src/main.c
  2. 2 5
      test/private_exe.c
  3. 7 0
      test/private_exe.h

+ 6 - 1
src/main.c

@@ -2223,7 +2223,9 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show)
 	return (int)msg.wParam;
 	return (int)msg.wParam;
 }
 }
 
 
-int main(void) { return WinMain(0, 0, 0, 0); }
+
+int main(int argc, char *argv[]) { return WinMain(0, 0, 0, 0); }
+
 
 
 #elif defined(USE_COCOA)
 #elif defined(USE_COCOA)
 #import <Cocoa/Cocoa.h>
 #import <Cocoa/Cocoa.h>
@@ -2251,6 +2253,7 @@ int main(void) { return WinMain(0, 0, 0, 0); }
 - (void)shutDown { [NSApp terminate:nil]; }
 - (void)shutDown { [NSApp terminate:nil]; }
 @end
 @end
 
 
+
 int main(int argc, char *argv[])
 int main(int argc, char *argv[])
 {
 {
 	init_server_name(argc, (const char **)argv);
 	init_server_name(argc, (const char **)argv);
@@ -2314,7 +2317,9 @@ int main(int argc, char *argv[])
 
 
 	return EXIT_SUCCESS;
 	return EXIT_SUCCESS;
 }
 }
+
 #else
 #else
+
 int main(int argc, char *argv[])
 int main(int argc, char *argv[])
 {
 {
 	init_server_name(argc, (const char **)argv);
 	init_server_name(argc, (const char **)argv);

+ 2 - 5
test/private_exe.c

@@ -27,15 +27,12 @@
 #define _CRT_SECURE_NO_WARNINGS
 #define _CRT_SECURE_NO_WARNINGS
 #endif
 #endif
 
 
-#define main                                                                   \
-	exe_main /* main is already used in the test suite,                        \
-	          * rename main in main.c */
+#include "private_exe.h"
+
 #include "../src/main.c"
 #include "../src/main.c"
 
 
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-#include "private_exe.h"
-
 /* This unit test file uses the excellent Check unit testing library.
 /* This unit test file uses the excellent Check unit testing library.
  * The API documentation is available here:
  * The API documentation is available here:
  * http://check.sourceforge.net/doc/check_html/index.html
  * http://check.sourceforge.net/doc/check_html/index.html

+ 7 - 0
test/private_exe.h

@@ -25,4 +25,11 @@
 
 
 Suite *make_private_exe_suite(void);
 Suite *make_private_exe_suite(void);
 
 
+
+/* main is already used in the test suite,
+ * so this define will rename main in main.c */
+#define main exe_main
+int exe_main(int argc, char *argv[]);
+
+
 #endif /* TEST_PRIVATE_H_ */
 #endif /* TEST_PRIVATE_H_ */