dethrace-labs / dethrace

Reverse engineering the 1997 game "Carmageddon"
https://twitter.com/dethrace_labs
GNU General Public License v3.0
669 stars 38 forks source link

Build dethrace with -Wstrict-prototypes #314

Closed madebr closed 1 year ago

madebr commented 1 year ago

-Wstrict-prototypes will warn when functions are declared as:

void my_function();

This function is compatible with the following function definition:

void my_function(int arg1, int arg2) {
} 

This should hopefully avoid the class of errors fixed by https://github.com/dethrace-labs/dethrace/pull/313.

After this pr, the following warning is emitted:

[114/210] Building C object src/harness/CMakeFiles/harness.dir/platforms/sdl_opengl.c.o
/home/maarten/projects/dethrace/src/harness/platforms/sdl_opengl.c: In function ‘Harness_Platform_Init’:
/home/maarten/projects/dethrace/src/harness/platforms/sdl_opengl.c:243:37: warning: assignment to ‘void (*)(void)’ from incompatible pointer type ‘void (*)(tRenderer_flush_type)’ [-Wincompatible-pointer-types]
  243 |     platform->Renderer_FlushBuffers = GLRenderer_FlushBuffers;
      |                         

Also fixed by this pr is a warnings emitted around non-returning functions:

[114/171] Building C object src/DETHRACE/CMakeFiles/dethrace_obj.dir/common/errors.c.o
/home/maarten/projects/dethrace/src/DETHRACE/common/errors.c: In function ‘FatalError’:
/home/maarten/projects/dethrace/src/DETHRACE/common/errors.c:173:1: warning: ‘noreturn’ function does return
  173 | }
      | ^

The last commit separates null.h in a header and implementation file.

madebr commented 1 year ago

You need to approve before I can merge this pr :)

dethrace-labs commented 1 year ago

Oops, thought I had!