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

Add missing headers reported by gcc-13, fix adapter_detect() prototype consistency #705

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

trofi
Copy link

@trofi trofi commented Feb 8, 2024

Two simple changes for gcc-13 compatibility:

Add missing headers reported by gcc-13
controller.c: fix adapter_detect() prototype consistency

Without the change the build fails against `gcc-13` as:

    gimx.c:587:3: error: incompatible implicit declaration
        of built-in function 'free' [-Werror=builtin-declaration-mismatch]
      587 |   free(gimx_params.homedir);
          |   ^~~~
WIthout the change the build of `gcc-13` fails as:

    controller.c:922:15: error: conflicting types for 'adapter_detect'
      due to enum/integer mismatch; have 'e_gimx_status()' [-Werror=enum-int-mismatch]
      922 | e_gimx_status adapter_detect()
          |               ^~~~~~~~~~~~~~
@fabrecordz
Copy link

@trofi Hey man, are you able to compile on Win? the Inno is not creating the setup for me

make[2]: Entering directory '/d/GIMX test/GIMX-build/windows/GIMX/shared/gimxcontroller'
cc -fPIC -Iinclude -Wall -Wextra -Werror -O3 -D__USE_MINGW_ANSI_STDIO=0 -I../ -DGLOG_NAME=gimxcontroller -c -o src/controller.o src/controller.c
src/controller.c: In function 'controller_get_axis_index':
src/controller.c:361:10: error: the comparison will always evaluate as 'true' for the address of 'name' will never be NULL [-Werror=address]
361 | if(controllers[C_TYPE_SIXAXIS]->axes[i].name)
| ^~~~~~~~~~~
In file included from src/controller.c:6:
src/../include/controller.h:46:14: note: 'name' declared here
46 | const char name[AXIS_NAME_MAX_SIZE];
| ^~~~
cc1.exe: all warnings being treated as errors
make[2]: *** [: src/controller.o] Error 1
make[2]: Leaving directory '/d/GIMX test/GIMX-build/windows/GIMX/shared/gimxcontroller'
make[1]: *** [Makefile:35: build-gimxcontroller] Error 2
make[1]: Leaving directory '/d/GIMX test/GIMX-build/windows/GIMX/shared'
make: *** [Makefile:15: build-shared] Error 2
make: Leaving directory '/d/GIMX test/GIMX-build/windows/GIMX'

@trofi
Copy link
Author

trofi commented Apr 25, 2024

I did not try windows but on linux we have to workaround a similar error.

It is caused by use of blanket -Werror in Makedefs files in a few places. Try removing the -Werror from there.

In nixpkgs we pass extra compiler flags to workaround it as: -Wno-error=address -Wno-error=deprecated-declarations -Wno-error=use-after-free

@fabrecordz
Copy link

Any chance you can send me the updated one? I want to compile the win version. Linux worked just fine.
It's been 5 days straight and I'm unable to compile it in Windows (tried adding missing headers, removing -Werror- and much more, but I keep digging a hole.

Eclipes IDE
Mingw64 and GCC 13.xx
Downloaded all the missing libraries (SDL, CURL and others).

Any guidance really would be appreciated.

@fabrecordz
Copy link

@trofi I also have countless missing headers. I added them to the Path, and got a lot of them resolved. Did you had to point to the include folders and such?

Thanks

@trofi
Copy link
Author

trofi commented Apr 25, 2024

No, this PR (and disabled warnings) is all I needed to get it to build.

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.

None yet

2 participants