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] compilation warnings #3526

Closed
Lecrapouille opened this issue Nov 11, 2023 · 1 comment
Closed

[build] compilation warnings #3526

Lecrapouille opened this issue Nov 11, 2023 · 1 comment

Comments

@Lecrapouille
Copy link

Issue description

Compilation warnings that could be fixed.

Environment

emscripten, Debian 11.
But can be reproduced with extra compilation flags: -Wunused-but-set-variable -Wunused-function -Wimplicit-const-int-float-conversion

Code Example

 In file included from rcore.c:101:
./rlgl.h:3025:9: warning: variable 'mipOffset' set but not used [-Wunused-but-set-variable]
 3025 |     int mipOffset = 0;          // Mipmap data offset, only used for tracelog
      |         ^
In file included from rcore.c:489:
./platforms/rcore_web.c:1006:13: warning: unused function 'WindowMaximizeCallback' [-Wunused-function]
 1006 | static void WindowMaximizeCallback(GLFWwindow *window, int maximized)
      |             ^~~~~~~~~~~~~~~~~~~~~~
./platforms/rcore_web.c:1178:16: warning: unused function 'EmscriptenWindowResizedCallback' [-Wunused-function]
 1178 | static EM_BOOL EmscriptenWindowResizedCallback(int eventType, const EmscriptenUiEvent *event, void *userData)
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
emcc -c rtextures.c -Wall -D_GNU_SOURCE -DPLATFORM_WEB -DGRAPHICS_API_OPENGL_ES2 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=gnu99 -fPIC -Os -I.  -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
In file included from rtextures.c:216:
./external/stb_image_resize2.h:2866:14: warning: unused function 'stbir__support_zero' [-Wunused-function]
 2866 | static float stbir__support_zero(float s, void * user_data)
      |              ^~~~~~~~~~~~~~~~~~~
3 warnings generated.
emcc -c rtext.c -Wall -D_GNU_SOURCE -DPLATFORM_WEB -DGRAPHICS_API_OPENGL_ES2 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=gnu99 -fPIC -Os -I.  -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
emcc -c utils.c -Wall -D_GNU_SOURCE -DPLATFORM_WEB -DGRAPHICS_API_OPENGL_ES2 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=gnu99 -fPIC -Os -I.  -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
emcc -c rmodels.c -Wall -D_GNU_SOURCE -DPLATFORM_WEB -DGRAPHICS_API_OPENGL_ES2 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing  -std=gnu99 -fPIC -Os -I.  -Iexternal/glfw/include -Iexternal/glfw/deps/mingw
In file included from rmodels.c:111:
./external/par_shapes.h:1133:32: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]
 1133 |     float r = (float) rand() / RAND_MAX;
      |                              ~ ^~~~~~~~
/home/runner/work/_temp/347782bb-feec-47ed-8688-38a6103a1214/emsdk-main/upstream/emscripten/cache/sysroot/include/stdlib.h:84:19: note: expanded from macro 'RAND_MAX'
   84 | #define RAND_MAX (0x7fffffff)
      |                   ^~~~~~~~~~
1 warning generated.
@raysan5
Copy link
Owner

raysan5 commented Nov 11, 2023

@Lecrapouille There is only one of those warnings that atually can be reviewed.

  • mipOffset is actually being used, compilation fails if not defined.
  • WindowMaximizeCallback() can be commented, a PR is being sent.
  • EmscriptenWindowResizedCallback(), there is an open PR that could require it Changes in preparation for Issue 3372 #3520
  • All the other ones belong to external libraries, not raylib, and they should be addressed in respective repos.

raysan5 added a commit that referenced this issue Nov 11, 2023
@raysan5 raysan5 closed this as completed Nov 11, 2023
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

No branches or pull requests

2 participants