makhidkarun/stargen

Multiple build warnings

Opened this issue · 0 comments

$ make
gcc -c -O -g -W -Wall -D_USE_LIBM_MATH_H -Wno-long-double main.c
main.c: In function ‘main’:
main.c:157:75: warning: multi-character character constant [-Wmultichar]
  157 | t                     out_format                              = ffHTML;
      |                                                                 ^~~~~~

main.c:158:67: warning: multi-character character constant [-Wmultichar]
  158 |        int                     graphic_format                  = gfGIF;
      |                                                                  ^~~~~

main.c:299:46: warning: multi-character character constant [-Wmultichar]
  299 |                                 out_format = ffTEXT;
      |                                              ^~~~~~
main.c:302:46: warning: multi-character character constant [-Wmultichar]
  302 |                                 out_format = ffCSV;
      |                                              ^~~~~
main.c:305:46: warning: multi-character character constant [-Wmultichar]
  305 |                                 out_format = ffCSVdl;
      |                                              ^~~~~~~
main.c:308:46: warning: multi-character character constant [-Wmultichar]
  308 |                                 out_format = ffCELESTIA;
      |                                              ^~~~~~~~~~
main.c:311:50: warning: multi-character character constant [-Wmultichar]
  311 |                                 graphic_format = gfSVG;
      |                                                  ^~~~~
main.c:314:50: warning: multi-character character constant [-Wmultichar]
  314 |                                 graphic_format = gfSVG;
      |                                                  ^~~~~
main.c:315:46: warning: multi-character character constant [-Wmultichar]
  315 |                                 out_format = ffSVG;
      |                                              ^~~~~
main.c:406:33: warning: this statement may fall through [-Wimplicit-fallthrough=]
  406 |                                 fprintf (stderr, "Unknown option: %s\n", c);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:407:25: note: here
  407 |                         case '?':
      |                         ^~~~
At top level:
cc1: note: unrecognized command-line option ‘-Wno-long-double’ may have been intended to silence earlier diagnostics
gcc -c -O -g -W -Wall -D_USE_LIBM_MATH_H -Wno-long-double stargen.c
stargen.c: In function ‘stargen’:
stargen.c:1292:34: warning: multi-character character constant [-Wmultichar]
 1292 |                 graphic_format = gfGIF;
      |                                  ^~~~~
stargen.c:1469:29: warning: multi-character character constant [-Wmultichar]
 1469 |          && !(out_format == ffCSVdl))
      |                             ^~~~~~~
stargen.c:1484:28: warning: multi-character character constant [-Wmultichar]
 1484 |         if ((out_format == ffCSV) || (out_format == ffCSVdl))
      |                            ^~~~~
stargen.c:1484:53: warning: multi-character character constant [-Wmultichar]
 1484 |         if ((out_format == ffCSV) || (out_format == ffCSVdl))
      |                                                     ^~~~~~~
stargen.c:1495:43: warning: multi-character character constant [-Wmultichar]
 1495 |                         if (out_format == ffCSVdl)
      |                                           ^~~~~~~
stargen.c:1513:61: warning: multi-character character constant [-Wmultichar]
 1513 |                                          (graphic_format == gfSVG)      ? "on" : "off"  // one of ("on", "off")
      |                                                             ^~~~~
stargen.c:1557:42: warning: multi-character character constant [-Wmultichar]
 1557 |                         !((out_format == ffCSV) && (sgOut != NULL)))
      |                                          ^~~~~
stargen.c:1816:69: warning: multi-character character constant [-Wmultichar]
 1816 |                                          (graphic_format == gfSVG)      ? "on" : "off"  // one of ("on", "off")
      |                                                             ^~~~~

stargen.c:1828:69: warning: multi-character character constant [-Wmultichar]
 1828 |                                          (graphic_format == gfSVG)      ? "on" : "off"  // one of ("on", "off")
      |                                                             ^~~~~

stargen.c:1834:38: warning: multi-character character constant [-Wmultichar]
 1834 |                                 case ffSVG:
      |                                      ^~~~~
stargen.c:1838:38: warning: multi-character character constant [-Wmultichar]
 1838 |                                 case ffHTML:
      |                                      ^~~~~~
stargen.c:1839:64: warning: multi-character character constant [-Wmultichar]
 1839 |                                      if ((graphic_format == gfSVG) && (sgOut == NULL))
      |                                                             ^~~~~

stargen.c:1877:38: warning: multi-character character constant [-Wmultichar]
 1877 |                                 case ffTEXT:
      |                                      ^~~~~~
stargen.c:1881:38: warning: multi-character character constant [-Wmultichar]
 1881 |                                 case ffCSV:
      |                                      ^~~~~
stargen.c:1882:38: warning: multi-character character constant [-Wmultichar]
 1882 |                                 case ffCSVdl:
      |                                      ^~~~~~~
stargen.c:1887:38: warning: multi-character character constant [-Wmultichar]
 1887 |                                 case ffCELESTIA:
      |                                      ^~~~~~~~~~
stargen.c: In function ‘generate_planets’:
stargen.c:1179:45: warning: ‘%d’ directive writing between 1 and 10 bytes into a region of size between 0 and 79 [-Wformat-overflow=]
 1179 |                                         "%s.%d",
      |                                             ^~
stargen.c:1179:41: note: directive argument in the range [1, 2147483647]
 1179 |                                         "%s.%d",
      |                                         ^~~~~~~
stargen.c:1178:25: note: ‘sprintf’ output between 3 and 91 bytes into a destination of size 80
 1178 |                         sprintf(moon_id,
      |                         ^~~~~~~~~~~~~~~~
 1179 |                                         "%s.%d",
      |                                         ~~~~~~~~
 1180 |                                         planet_id, moons);
      |                                         ~~~~~~~~~~~~~~~~~
stargen.c: In function ‘stargen’:
stargen.c:1543:53: warning: ‘.csv’ directive writing 4 bytes into a region of size between 1 and 300 [-Wformat-overflow=]
 1543 |                                                  "%s.csv",
      |                                                     ^~~~
stargen.c:1542:33: note: ‘sprintf’ output between 5 and 304 bytes into a destination of size 300
 1542 |                                 sprintf (&csv_file_name[0],
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
 1543 |                                                  "%s.csv",
      |                                                  ~~~~~~~~~
 1544 |                                                  cleaned_arg);
      |                                                  ~~~~~~~~~~~~
stargen.c:1548:45: warning: ‘%s’ directive writing up to 299 bytes into a region of size between 297 and 300 [-Wformat-overflow=]
 1548 |                                          "%s%s%s",
      |                                             ^~
 1549 |                                          url_path,
 1550 |                                          subdir,
      |                                          ~~~~~~
stargen.c:1547:25: note: ‘sprintf’ output between 1 and 602 bytes into a destination of size 300
 1547 |                         sprintf (&csv_url[0],
      |                         ^~~~~~~~~~~~~~~~~~~~~
 1548 |                                          "%s%s%s",
      |                                          ~~~~~~~~~
 1549 |                                          url_path,
      |                                          ~~~~~~~~~
 1550 |                                          subdir,
      |                                          ~~~~~~~
 1551 |                                          csv_file_name);
      |                                          ~~~~~~~~~~~~~~
stargen.c:1536:54: warning: ‘%ld’ directive writing between 1 and 20 bytes into a region of size between 0 and 299 [-Wformat-overflow=]
 1536 |                                                  "%s-%ld.csv",
      |                                                      ^~~
stargen.c:1535:33: note: ‘sprintf’ output between 7 and 325 bytes into a destination of size 300
 1535 |                                 sprintf (&csv_file_name[0],
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
 1536 |                                                  "%s-%ld.csv",
      |                                                  ~~~~~~~~~~~~~
 1537 |                                                  cleaned_arg,
      |                                                  ~~~~~~~~~~~~
 1538 |                                                  flag_seed);
      |                                                  ~~~~~~~~~~
stargen.c:1548:45: warning: ‘%s’ directive writing up to 299 bytes into a region of size between 297 and 300 [-Wformat-overflow=]
 1548 |                                          "%s%s%s",
      |                                             ^~
 1549 |                                          url_path,
 1550 |                                          subdir,
      |                                          ~~~~~~
stargen.c:1547:25: note: ‘sprintf’ output between 1 and 602 bytes into a destination of size 300
 1547 |                         sprintf (&csv_url[0],
      |                         ^~~~~~~~~~~~~~~~~~~~~
 1548 |                                          "%s%s%s",
      |                                          ~~~~~~~~~
 1549 |                                          url_path,
      |                                          ~~~~~~~~~
 1550 |                                          subdir,
      |                                          ~~~~~~~
 1551 |                                          csv_file_name);
      |                                          ~~~~~~~~~~~~~~
stargen.c:1493:54: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=]
 1493 |                                 sprintf(&sys_no[0], "%d", sys_no_arg-1);
      |                                                      ^~
stargen.c:1493:53: note: directive argument in the range [-2147483648, 2147483646]
 1493 |                                 sprintf(&sys_no[0], "%d", sys_no_arg-1);
      |                                                     ^~~~
stargen.c:1493:33: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 10
 1493 |                                 sprintf(&sys_no[0], "%d", sys_no_arg-1);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stargen.c:1791:53: warning: ‘%s’ directive writing up to 299 bytes into a region of size between 297 and 300 [-Wformat-overflow=]
 1791 |                                                  "%s%s%s%s",
      |                                                     ^~
 1792 |                                                  url_path,
 1793 |                                                  subdir,
      |                                                  ~~~~~~
stargen.c:1790:33: note: ‘sprintf’ output between 6 and 607 bytes into a destination of size 300
 1790 |                                 sprintf (system_url,
      |                                 ^~~~~~~~~~~~~~~~~~~~
 1791 |                                                  "%s%s%s%s",
      |                                                  ~~~~~~~~~~~
 1792 |                                                  url_path,
      |                                                  ~~~~~~~~~
 1793 |                                                  subdir,
      |                                                  ~~~~~~~
 1794 |                                                  file_name,
      |                                                  ~~~~~~~~~~
 1795 |                                                  ".html");
      |                                                  ~~~~~~~~
stargen.c:1798:53: warning: ‘%s’ directive writing up to 299 bytes into a region of size between 297 and 300 [-Wformat-overflow=]
 1798 |                                                  "%s%s%s%s",
      |                                                     ^~
 1799 |                                                  url_path,
 1800 |                                                  subdir,
      |                                                  ~~~~~~
stargen.c:1797:33: note: ‘sprintf’ output between 5 and 606 bytes into a destination of size 300
 1797 |                                 sprintf (svg_url,
      |                                 ^~~~~~~~~~~~~~~~~
 1798 |                                                  "%s%s%s%s",
      |                                                  ~~~~~~~~~~~
 1799 |                                                  url_path,
      |                                                  ~~~~~~~~~
 1800 |                                                  subdir,
      |                                                  ~~~~~~~
 1801 |                                                  file_name,
      |                                                  ~~~~~~~~~~
 1802 |                                                  ".svg");
      |                                                  ~~~~~~~
At top level:
cc1: note: unrecognized command-line option ‘-Wno-long-double’ may have been intended to silence earlier diagnostics
gcc -c -O -g -W -Wall -D_USE_LIBM_MATH_H -Wno-long-double accrete.c
accrete.c: In function ‘coalesce_planetesimals’:
accrete.c:372:23: warning: absolute value function ‘fabs’ given an argument of type ‘long double’ but has parameter of type ‘double’ which may cause truncation of value [-Wabsolute-value]
  372 |                 if (((fabs(diff) <= fabs(dist1)) || (fabs(diff) <= fabs(dist2))))
      |                       ^~~~
accrete.c:372:37: warning: absolute value function ‘fabs’ given an argument of type ‘long double’ but has parameter of type ‘double’ which may cause truncation of value [-Wabsolute-value]
  372 |                 if (((fabs(diff) <= fabs(dist1)) || (fabs(diff) <= fabs(dist2))))
      |                                     ^~~~
accrete.c:372:54: warning: absolute value function ‘fabs’ given an argument of type ‘long double’ but has parameter of type ‘double’ which may cause truncation of value [-Wabsolute-value]
  372 |                 if (((fabs(diff) <= fabs(dist1)) || (fabs(diff) <= fabs(dist2))))
      |                                                      ^~~~
accrete.c:372:68: warning: absolute value function ‘fabs’ given an argument of type ‘long double’ but has parameter of type ‘double’ which may cause truncation of value [-Wabsolute-value]
  372 |          if (((fabs(diff) <= fabs(dist1)) || (fabs(diff) <= fabs(dist2))))
      |                                                             ^~~~

At top level:
cc1: note: unrecognized command-line option ‘-Wno-long-double’ may have been intended to silence earlier diagnostics
gcc -c -O -g -W -Wall -D_USE_LIBM_MATH_H -Wno-long-double display.c
display.c: In function ‘csv_thumbnails’:
display.c:453:49: warning: unused parameter ‘subdir’ [-Wunused-parameter]
  453 |                                         char*   subdir,
      |                                         ~~~~~~~~^~~~~~
display.c: In function ‘html_thumbnails’:
display.c:1019:31: warning: multi-character character constant [-Wmultichar]
 1019 |         if (graphic_format == gfSVG)
      |                               ^~~~~
display.c:1146:31: warning: multi-character character constant [-Wmultichar]
 1146 |         if (graphic_format == gfSVG)
      |                               ^~~~~
display.c: In function ‘html_decribe_planet’:
display.c:1454:29: warning: absolute value function ‘fabs’ given an argument of type ‘long double’ but has parameter of type ‘double’ which may cause truncation of value [-Wabsolute-value]
 1454 |                         if (fabs(planet->high_temp - planet->max_temp) > 10
      |                             ^~~~
display.c:1455:29: warning: absolute value function ‘fabs’ given an argument of type ‘long double’ but has parameter of type ‘double’ which may cause truncation of value [-Wabsolute-value]
 1455 |                          || fabs(planet->low_temp - planet->min_temp) > 10)
      |                             ^~~~
At top level:
cc1: note: unrecognized command-line option ‘-Wno-long-double’ may have been intended to silence earlier diagnostics
gcc -c -O -g -W -Wall -D_USE_LIBM_MATH_H -Wno-long-double Dumas.c
Dumas.c: In function ‘dumasComplain’:
Dumas.c:300:13: warning: the address of ‘procureur’ will always evaluate as ‘true’ [-Waddress]
  300 |         if (procureur && *procureur)
      |             ^~~~~~~~~
Dumas.c:321:21: warning: the address of ‘liberator’ will always evaluate as ‘true’ [-Waddress]
  321 |                 if (liberator && *liberator)
      |                     ^~~~~~~~~
Dumas.c:357:13: warning: variable ‘i’ set but not used [-Wunused-but-set-variable]
  357 |         int i;
      |             ^
Dumas.c: In function ‘dumasDumpHoard’:
Dumas.c:748:73: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  748 |                           buffer[j] = dumasPrintable[segment->data[j]];
      |                                                      ~~~~~~~~~~~~~^~~

At top level:
cc1: note: unrecognized command-line option ‘-Wno-long-double’ may have been intended to silence earlier diagnostics
gcc -c -O -g -W -Wall -D_USE_LIBM_MATH_H -Wno-long-double enviro.c
enviro.c: In function ‘iterate_surface_temp’:
enviro.c:952:21: warning: absolute value function ‘fabs’ given an argument of type ‘long double’ but has parameter of type ‘double’ which may cause truncation of value [-Wabsolute-value]
  952 |                 if (fabs(planet->surf_temp - last_temp) < 0.25)
      |                     ^~~~
At top level:
cc1: note: unrecognized command-line option ‘-Wno-long-double’ may have been intended to silence earlier diagnostics
gcc -c -O -g -W -Wall -D_USE_LIBM_MATH_H -Wno-long-double utils.c
gcc -O -g -W -Wall -D_USE_LIBM_MATH_H -Wno-long-double -o stargen main.o stargen.o accrete.o display.o Dumas.o enviro.o utils.o -lm
stargen made