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

-Wduplicated-branches compilation warnings on Linux/X11 builds. #35243

Open
bruvzg opened this issue Jan 17, 2020 · 0 comments
Open

-Wduplicated-branches compilation warnings on Linux/X11 builds. #35243

bruvzg opened this issue Jan 17, 2020 · 0 comments

Comments

@bruvzg
Copy link
Member

bruvzg commented Jan 17, 2020

Godot version:
3.2 master, 0aefec2

OS/device including version:

Ubuntu 18.04.3 LTS VM (32 and 64-bit)
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)

Issue description:

scons -j4 p=x11 tools=yes target=debug debug_symbols=yes optimize=speed warnings=extra

Following warnings are raised with aforementioned compiler and build command.

Warnings:

core/image.cpp: In instantiation of 'void _convert(int, int, const uint8_t*, uint8_t*) [with unsigned int read_bytes = 1; bool read_alpha = false; unsigned int write_bytes = 1; bool write_alpha = true; bool read_gray = true; bool write_gray = true; uint8_t = unsigned char]':
core/image.cpp:466:104:   required from here
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
core/image.cpp: In instantiation of 'void _convert(int, int, const uint8_t*, uint8_t*) [with unsigned int read_bytes = 1; bool read_alpha = false; unsigned int write_bytes = 1; bool write_alpha = false; bool read_gray = true; bool write_gray = false; uint8_t = unsigned char]':
core/image.cpp:467:105:   required from here
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
core/image.cpp: In instantiation of 'void _convert(int, int, const uint8_t*, uint8_t*) [with unsigned int read_bytes = 1; bool read_alpha = true; unsigned int write_bytes = 1; bool write_alpha = false; bool read_gray = true; bool write_gray = true; uint8_t = unsigned char]':
core/image.cpp:471:104:   required from here
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
core/image.cpp: In instantiation of 'void _convert(int, int, const uint8_t*, uint8_t*) [with unsigned int read_bytes = 1; bool read_alpha = true; unsigned int write_bytes = 1; bool write_alpha = false; bool read_gray = true; bool write_gray = false; uint8_t = unsigned char]':
core/image.cpp:472:105:   required from here
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
core/image.cpp: In instantiation of 'void _convert(int, int, const uint8_t*, uint8_t*) [with unsigned int read_bytes = 1; bool read_alpha = false; unsigned int write_bytes = 1; bool write_alpha = false; bool read_gray = false; bool write_gray = true; uint8_t = unsigned char]':
core/image.cpp:476:105:   required from here
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
core/image.cpp: In instantiation of 'void _convert(int, int, const uint8_t*, uint8_t*) [with unsigned int read_bytes = 1; bool read_alpha = false; unsigned int write_bytes = 1; bool write_alpha = true; bool read_gray = false; bool write_gray = true; uint8_t = unsigned char]':
core/image.cpp:477:105:   required from here
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
core/image.cpp: In instantiation of 'void _convert(int, int, const uint8_t*, uint8_t*) [with unsigned int read_bytes = 3; bool read_alpha = false; unsigned int write_bytes = 3; bool write_alpha = true; bool read_gray = false; bool write_gray = false; uint8_t = unsigned char]':
core/image.cpp:490:110:   required from here
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]
core/image.cpp: In instantiation of 'void _convert(int, int, const uint8_t*, uint8_t*) [with unsigned int read_bytes = 3; bool read_alpha = true; unsigned int write_bytes = 3; bool write_alpha = false; bool read_gray = false; bool write_gray = false; uint8_t = unsigned char]':
core/image.cpp:495:110:   required from here
cc1plus: warning: this condition has identical branches [-Wduplicated-branches]

Relevant code:

godot/core/image.cpp

Lines 460 to 500 in 0aefec2

uint8_t *wptr = w.ptr();
int conversion_type = format | p_new_format << 8;
switch (conversion_type) {
case FORMAT_L8 | (FORMAT_LA8 << 8): _convert<1, false, 1, true, true, true>(width, height, rptr, wptr); break;
case FORMAT_L8 | (FORMAT_R8 << 8): _convert<1, false, 1, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_L8 | (FORMAT_RG8 << 8): _convert<1, false, 2, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_L8 | (FORMAT_RGB8 << 8): _convert<1, false, 3, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_L8 | (FORMAT_RGBA8 << 8): _convert<1, false, 3, true, true, false>(width, height, rptr, wptr); break;
case FORMAT_LA8 | (FORMAT_L8 << 8): _convert<1, true, 1, false, true, true>(width, height, rptr, wptr); break;
case FORMAT_LA8 | (FORMAT_R8 << 8): _convert<1, true, 1, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_LA8 | (FORMAT_RG8 << 8): _convert<1, true, 2, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_LA8 | (FORMAT_RGB8 << 8): _convert<1, true, 3, false, true, false>(width, height, rptr, wptr); break;
case FORMAT_LA8 | (FORMAT_RGBA8 << 8): _convert<1, true, 3, true, true, false>(width, height, rptr, wptr); break;
case FORMAT_R8 | (FORMAT_L8 << 8): _convert<1, false, 1, false, false, true>(width, height, rptr, wptr); break;
case FORMAT_R8 | (FORMAT_LA8 << 8): _convert<1, false, 1, true, false, true>(width, height, rptr, wptr); break;
case FORMAT_R8 | (FORMAT_RG8 << 8): _convert<1, false, 2, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_R8 | (FORMAT_RGB8 << 8): _convert<1, false, 3, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_R8 | (FORMAT_RGBA8 << 8): _convert<1, false, 3, true, false, false>(width, height, rptr, wptr); break;
case FORMAT_RG8 | (FORMAT_L8 << 8): _convert<2, false, 1, false, false, true>(width, height, rptr, wptr); break;
case FORMAT_RG8 | (FORMAT_LA8 << 8): _convert<2, false, 1, true, false, true>(width, height, rptr, wptr); break;
case FORMAT_RG8 | (FORMAT_R8 << 8): _convert<2, false, 1, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RG8 | (FORMAT_RGB8 << 8): _convert<2, false, 3, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RG8 | (FORMAT_RGBA8 << 8): _convert<2, false, 3, true, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGB8 | (FORMAT_L8 << 8): _convert<3, false, 1, false, false, true>(width, height, rptr, wptr); break;
case FORMAT_RGB8 | (FORMAT_LA8 << 8): _convert<3, false, 1, true, false, true>(width, height, rptr, wptr); break;
case FORMAT_RGB8 | (FORMAT_R8 << 8): _convert<3, false, 1, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGB8 | (FORMAT_RG8 << 8): _convert<3, false, 2, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGB8 | (FORMAT_RGBA8 << 8): _convert<3, false, 3, true, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGBA8 | (FORMAT_L8 << 8): _convert<3, true, 1, false, false, true>(width, height, rptr, wptr); break;
case FORMAT_RGBA8 | (FORMAT_LA8 << 8): _convert<3, true, 1, true, false, true>(width, height, rptr, wptr); break;
case FORMAT_RGBA8 | (FORMAT_R8 << 8): _convert<3, true, 1, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGBA8 | (FORMAT_RG8 << 8): _convert<3, true, 2, false, false, false>(width, height, rptr, wptr); break;
case FORMAT_RGBA8 | (FORMAT_RGB8 << 8): _convert<3, true, 3, false, false, false>(width, height, rptr, wptr); break;
}
r.release();
w.release();

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