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

Various compiler warnings #367

Closed
FrostKiwi opened this issue Sep 8, 2022 · 3 comments
Closed

Various compiler warnings #367

FrostKiwi opened this issue Sep 8, 2022 · 3 comments
Assignees
Milestone

Comments

@FrostKiwi
Copy link

As advised by #325 (comment), I'm sharing compiler warnings, which are given by gcc for the GLEW 2.2.0 release, when compiling from source statically with GLEW_STATIC defined.
Here is the the relevant section from my Makefile's output

-- compiling src/glew.c --
cc -c src/glew.c -o obj/glew.o -I inc -pipe -static -Ofast -s -flto=8 -Wall -DGLEW_STATIC
src/glew.c: In function '_glewStrSame1':
src/glew.c:256:29: warning: the comparison will always evaluate as 'true' for the pointer operand in '*a + (sizetype)i' must not be NULL [-Waddress]
  256 |     while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
      |                             ^~
src/glew.c:256:44: warning: the comparison will always evaluate as 'true' for the pointer operand in 'b + (sizetype)i' must not be NULL [-Waddress]
  256 |     while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
      |                                            ^~
src/glew.c: In function '_glewStrSame2':
src/glew.c:272:29: warning: the comparison will always evaluate as 'true' for the pointer operand in '*a + (sizetype)i' must not be NULL [-Waddress]
  272 |     while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
      |                             ^~
src/glew.c:272:44: warning: the comparison will always evaluate as 'true' for the pointer operand in 'b + (sizetype)i' must not be NULL [-Waddress]
  272 |     while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
      |                                            ^~
src/glew.c: In function '_glewStrSame3':
src/glew.c:288:29: warning: the comparison will always evaluate as 'true' for the pointer operand in '*a + (sizetype)i' must not be NULL [-Waddress]
  288 |     while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
      |                             ^~
src/glew.c:288:44: warning: the comparison will always evaluate as 'true' for the pointer operand in 'b + (sizetype)i' must not be NULL [-Waddress]
  288 |     while (i < nb && (*a)+i != NULL && b+i != NULL && (*a)[i] == b[i]) i++;
      |                                            ^~
@nigels-com
Copy link
Owner

Could you mention gcc version.

@FrostKiwi
Copy link
Author

Could you mention gcc version.

GCC 12.2.0 (Rev1, Built by MSYS2 project) 12.2.0 as installed by the package mingw64/mingw-w64-x86_64-gcc in MSYS2 and it's MinGW64 environment.

@nigels-com
Copy link
Owner

I can confirm these warnings for the 2.2.0 release in Ubuntu 22.04 (Jammy) using gcc-12 toolchain.
gcc-10 and gcc-11 both compile without complaint.

For current master branch, gcc-12 also builds without complaint.
So this issue will be resolved in the next release, without any further action needed.

@nigels-com nigels-com self-assigned this Sep 9, 2022
@nigels-com nigels-com added this to the GLEW 2.2.1 milestone Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants