]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - main.c
Rewrote memory tracking, now prints highest water mark (most used memory at a given...
[xonotic/gmqcc.git] / main.c
diff --git a/main.c b/main.c
index 526d4fea723df0d6f285c28978f4d2500500a836..9da37698dcf6381adf6bee457fdfa8d730009341 100644 (file)
--- a/main.c
+++ b/main.c
@@ -146,9 +146,10 @@ static bool options_parse(int argc, char **argv) {
     bool argend = false;
     size_t itr;
     char  buffer[1024];
-    char *redirout = NULL;
-    char *redirerr = NULL;
-    char *config   = NULL;
+    char *redirout    = NULL;
+    char *redirerr    = NULL;
+    char *config      = NULL;
+    char *memdumpcols = NULL;
 
     while (!argend && argc > 1) {
         char *argarg;
@@ -223,6 +224,10 @@ static bool options_parse(int argc, char **argv) {
                 config = argarg;
                 continue;
             }
+            if (options_long_gcc("memdumpcols", &argc, &argv, &memdumpcols)) {
+                OPTS_OPTION_U16(OPTION_MEMDUMPCOLS) = (uint16_t)strtol(memdumpcols, NULL, 10);
+                continue;
+            }
 
             /* show defaults (like pathscale) */
             if (!strcmp(argv[0]+1, "show-defaults")) {
@@ -340,6 +345,8 @@ static bool options_parse(int argc, char **argv) {
                         for (itr = 0; itr < COUNT_WARNINGS; ++itr) {
                             util_strtononcmd(opts_warn_list[itr].name, buffer, sizeof(buffer));
                             con_out(" -W%s\n", buffer);
+                            if (itr == WARN_DEBUG)
+                                con_out("   Warnings included by -Wall:\n");
                         }
                         exit(0);
                     }
@@ -401,7 +408,7 @@ static bool options_parse(int argc, char **argv) {
                         return false;
                     }
                     if (isdigit(argarg[0])) {
-                        uint32_t val = atoi(argarg);
+                        uint32_t val = (uint32_t)strtol(argarg, NULL, 10);
                         OPTS_OPTION_U32(OPTION_O) = val;
                         opts_setoptimlevel(val);
                     } else {
@@ -520,7 +527,7 @@ static bool progs_nextline(char **out, size_t *alen,FILE *src) {
     char  *end;
 
     line = *out;
-    len  = file_getline(&line, alen, src);
+    len  = fs_file_getline(&line, alen, src);
     if (len == -1)
         return false;
 
@@ -606,7 +613,7 @@ int main(int argc, char **argv) {
 
     if (OPTS_OPTION_BOOL(OPTION_PP_ONLY)) {
         if (opts_output_wasset) {
-            outfile = file_open(OPTS_OPTION_STR(OPTION_OUTPUT), "wb");
+            outfile = fs_file_open(OPTS_OPTION_STR(OPTION_OUTPUT), "wb");
             if (!outfile) {
                 con_err("failed to open `%s` for writing\n", OPTS_OPTION_STR(OPTION_OUTPUT));
                 retval = 1;
@@ -658,7 +665,7 @@ int main(int argc, char **argv) {
 
         progs_src = true;
 
-        src = file_open("progs.src", "rb");
+        src = fs_file_open("progs.src", "rb");
         if (!src) {
             con_err("failed to open `progs.src` for reading\n");
             retval = 1;
@@ -687,7 +694,7 @@ int main(int argc, char **argv) {
         }
 
 srcdone:
-        file_close(src);
+        fs_file_close(src);
         mem_d(line);
     }
 
@@ -721,7 +728,7 @@ srcdone:
                 }
                 out = ftepp_get();
                 if (out)
-                    file_printf(outfile, "%s", out);
+                    fs_file_printf(outfile, "%s", out);
                 ftepp_flush();
             }
             else {