]> granicus.if.org Git - gc/commitdiff
tools: Prevent compiler warnings regarding unused argument and printf
authorIvan Maidanski <ivmai@mail.ru>
Wed, 29 Feb 2012 17:40:53 +0000 (21:40 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 29 Feb 2012 17:40:53 +0000 (21:40 +0400)
* tools/if_mach.c (main): Remove unused "envp" argument.
* tools/if_not_there.c (main): Likewise.
* tools/if_mach.c: Expand tabs to spaces.
* tools/if_not_there.c: Likewise.
* tools/setjmp_t.c (getpagesize): Define for Win32; include windows.h.
* tools/setjmp_t.c (main): Make printf() format specifier string
non-empty (to suppress compiler warning).
* tools/setjmp_t.c (main): Adjust printf() format specifier for WORDSZ
value (unsigned long instead of int).

tools/if_mach.c
tools/if_not_there.c
tools/setjmp_t.c

index d3763b6010335e98fdc9e1de66e0e4117fc11afa..25f3eca38444fbf63d8f3405344bf9b87f5d9cfc 100644 (file)
@@ -5,7 +5,7 @@
 # include <string.h>
 # include <unistd.h>
 
-int main(int argc, char **argv, char **envp)
+int main(int argc, char **argv)
 {
     if (argc < 4) goto Usage;
     if (strcmp(MACH_TYPE, argv[1]) != 0) return(0);
@@ -19,6 +19,6 @@ int main(int argc, char **argv, char **envp)
 Usage:
     fprintf(stderr, "Usage: %s mach_type os_type command\n", argv[0]);
     fprintf(stderr, "Currently mach_type = %s, os_type = %s\n",
-           MACH_TYPE, OS_TYPE);
+            MACH_TYPE, OS_TYPE);
     return(1);
 }
index b71394c320f49246974b0ae674ea958c0dc306b0..cae4880d1bd6b9e1fa3eb9e50787cd0f0c9a98aa 100644 (file)
@@ -1,5 +1,5 @@
 /* Conditionally execute a command based if the file argv[1] doesn't exist */
-/* Except for execvp, we stick to ANSI C.                                 */
+/* Except for execvp, we stick to ANSI C.                                  */
 # include "private/gcconfig.h"
 # include <stdio.h>
 # include <stdlib.h>
@@ -8,7 +8,7 @@
 #include <dirent.h>
 #endif /* __DJGPP__ */
 
-int main(int argc, char **argv, char **envp)
+int main(int argc, char **argv)
 {
     FILE * f;
 #ifdef __DJGPP__
@@ -22,8 +22,8 @@ int main(int argc, char **argv, char **envp)
     }
 #ifdef __DJGPP__
     if ((d = opendir(argv[1])) != 0) {
-           closedir(d);
-           return(0);
+            closedir(d);
+            return(0);
     }
 #endif
     printf("^^^^Starting command^^^^\n");
index 0952fb03971b7d1314bb0331a6700b2ac928399e..7a1e285f111bafb041254778508f2223b2b13147 100644 (file)
@@ -45,6 +45,14 @@ int getpagesize(void)
     }
     return((int)(result[0]));
 }
+#elif defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
+# include <windows.h>
+  int getpagesize(void)
+  {
+    SYSTEM_INFO sysinfo;
+    GetSystemInfo(&sysinfo);
+    return sysinfo.dwPageSize;
+  }
 #endif
 
 struct {
@@ -89,7 +97,7 @@ int main(void)
     printf("Results may not be accurate/useful:\n");
     /* Encourage the compiler to keep x in a callee-save register */
     x = 2*x-1;
-    printf("");
+    printf("\n");
     x = 2*x-1;
     setjmp(b);
     if (y == 1) {
@@ -107,7 +115,7 @@ int main(void)
     x = 2;
     if (y == 1) longjmp(b,1);
     printf("Some GC internal configuration stuff: \n");
-    printf("\tWORDSZ = %d, ALIGNMENT = %d, GC_GRANULE_BYTES = %d\n",
+    printf("\tWORDSZ = %lu, ALIGNMENT = %d, GC_GRANULE_BYTES = %d\n",
            WORDSZ, ALIGNMENT, GC_GRANULE_BYTES);
     printf("\tUsing one mark ");
 #   if defined(USE_MARK_BYTES)