Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build dethrace with -Wstrict-prototypes #314

Merged
merged 7 commits into from
May 1, 2023
Merged

Conversation

madebr
Copy link
Collaborator

@madebr madebr commented Apr 29, 2023

-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 #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.

Copy link
Owner

@dethrace-labs dethrace-labs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@madebr
Copy link
Collaborator Author

madebr commented May 1, 2023

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

@dethrace-labs
Copy link
Owner

Oops, thought I had!

@madebr madebr merged commit 597de52 into dethrace-labs:main May 1, 2023
@madebr madebr deleted the strict branch May 1, 2023 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants