Skip to content

Commit ba1674a

Browse files
authored
Merge pull request #1090 from asarium/fix/extraGccWarnings
Enable extra GCC and Clang warnings again
2 parents fb4e20e + 5e23c5d commit ba1674a

File tree

19 files changed

+92
-633
lines changed

19 files changed

+92
-633
lines changed

cmake/toolchain-clang.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ if(NOT COMPILER_FLAGS)
1616
set(COMPILER_FLAGS "-march=native -pipe")
1717
endif()
1818

19-
globally_enable_extra_compiler_warnings()
19+
# This is a slight hack since our flag setup is a bit more complicated
20+
_enable_extra_compiler_warnings_flags()
21+
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${_flags}")
22+
2023
set(COMPILER_FLAGS "${COMPILER_FLAGS} -funroll-loops -fsigned-char -Wno-unknown-pragmas")
2124

2225
# Omit "argument unused during compilation" when clang is used with ccache.

cmake/toolchain-gcc.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ if(NOT COMPILER_FLAGS)
1818
set(COMPILER_FLAGS "-march=native -pipe")
1919
endif()
2020

21-
globally_enable_extra_compiler_warnings()
21+
# This is a slight hack since our flag setup is a bit more complicated
22+
_enable_extra_compiler_warnings_flags()
23+
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${_flags}")
24+
2225
set(COMPILER_FLAGS "${COMPILER_FLAGS} -funroll-loops -fsigned-char -Wno-unknown-pragmas")
2326

2427
# Place each function and data in its own section so the linker can

code/cutscene/ffmpeg/VideoDecoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void VideoDecoder::convertAndPushPicture(const AVFrame* frame) {
101101
videoFramePtr->uvSize.width = static_cast<size_t>(m_status->videoCodecPars.width / 2);
102102
videoFramePtr->uvSize.stride = static_cast<size_t>(yuvFrame->linesize[1]);
103103

104-
pushFrame(std::move(VideoFramePtr(videoFramePtr.release())));
104+
pushFrame(VideoFramePtr(videoFramePtr.release()));
105105
}
106106

107107
void VideoDecoder::decodePacket(AVPacket* packet) {

code/graphics/material.cpp

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,17 @@ material::material():
122122
Sdr_type(SDR_TYPE_PASSTHROUGH_RENDER),
123123
Tex_type(TEX_TYPE_NORMAL),
124124
Texture_addressing(TMAP_ADDRESS_WRAP),
125-
Depth_bias(0),
126125
Depth_mode(ZBUFFER_TYPE_NONE),
127126
Blend_mode(ALPHA_BLEND_ALPHA_BLEND_ALPHA),
128127
Cull_mode(true),
129128
Fill_mode(GR_FILL_MODE_SOLID),
130-
Clr_scale(1.0f)
129+
Clr_scale(1.0f),
130+
Depth_bias(0)
131131
{
132-
Clr = { 1.0f, 1.0f, 1.0f, 1.0f };
132+
Clr.xyzw.x = 1.0f;
133+
Clr.xyzw.y = 1.0f;
134+
Clr.xyzw.z = 1.0f;
135+
Clr.xyzw.w = 1.0f;
133136

134137
Texture_maps[TM_BASE_TYPE] = -1;
135138
Texture_maps[TM_GLOW_TYPE] = -1;
@@ -321,7 +324,10 @@ int material::get_depth_bias()
321324

322325
void material::set_color(float red, float green, float blue, float alpha)
323326
{
324-
Clr = { red, green, blue, alpha };
327+
Clr.xyzw.x = red;
328+
Clr.xyzw.y = green;
329+
Clr.xyzw.z = blue;
330+
Clr.xyzw.w = alpha;
325331
}
326332

327333
void material::set_color(int r, int g, int b, int a)
@@ -331,15 +337,24 @@ void material::set_color(int r, int g, int b, int a)
331337
CLAMP(g, 0, 255);
332338
CLAMP(a, 0, 255);
333339

334-
Clr = { i2fl(r) / 255.0f, i2fl(g) / 255.0f, i2fl(b) / 255.0f, i2fl(a) / 255.0f };
340+
Clr.xyzw.x = i2fl(r) / 255.0f;
341+
Clr.xyzw.y = i2fl(g) / 255.0f;
342+
Clr.xyzw.z = i2fl(b) / 255.0f;
343+
Clr.xyzw.w = i2fl(a) / 255.0f;
335344
}
336345

337346
void material::set_color(color &clr_in)
338347
{
339348
if ( clr_in.is_alphacolor ) {
340-
Clr = { i2fl(clr_in.red) / 255.0f, i2fl(clr_in.green) / 255.0f, i2fl(clr_in.blue) / 255.0f, 1.0f };
349+
Clr.xyzw.x = i2fl(clr_in.red) / 255.0f;
350+
Clr.xyzw.y = i2fl(clr_in.green) / 255.0f;
351+
Clr.xyzw.z = i2fl(clr_in.blue) / 255.0f;
352+
Clr.xyzw.w = 1.0f;
341353
} else {
342-
Clr = { i2fl(clr_in.red) / 255.0f, i2fl(clr_in.green) / 255.0f, i2fl(clr_in.blue) / 255.0f, i2fl(clr_in.green) / 255.0f };
354+
Clr.xyzw.x = i2fl(clr_in.red) / 255.0f;
355+
Clr.xyzw.y = i2fl(clr_in.green) / 255.0f;
356+
Clr.xyzw.z = i2fl(clr_in.blue) / 255.0f;
357+
Clr.xyzw.w = i2fl(clr_in.green) / 255.0f;
343358
}
344359
}
345360

@@ -358,25 +373,8 @@ float material::get_color_scale()
358373
return Clr_scale;
359374
}
360375

361-
model_material::model_material():
362-
material(),
363-
Animated_effect(-1),
364-
Animated_timer(0.0f),
365-
Thrust_scale(-1.0f),
366-
lighting(false),
367-
Light_factor(1.0f),
368-
Batched(false),
369-
Team_color_set(false),
370-
Center_alpha(0),
371-
Desaturate(false),
372-
Normal_alpha(false),
373-
Normal_alpha_min(0.0f),
374-
Normal_alpha_max(1.0f),
375-
Normal_extrude(false),
376-
Deferred(false),
377-
HDR(false)
378-
{
379-
set_shader_type(SDR_TYPE_MODEL);
376+
model_material::model_material() : material() {
377+
set_shader_type(SDR_TYPE_MODEL);
380378
}
381379

382380
void model_material::set_desaturation(bool enabled)
@@ -683,7 +681,11 @@ shield_material::shield_material() :
683681
set_shader_type(SDR_TYPE_SHIELD_DECAL);
684682

685683
vm_set_identity(&Impact_orient);
686-
Impact_pos = { 0.0f, 0.0f, 0.0f };
684+
685+
Impact_pos.xyz.x = 0.0f;
686+
Impact_pos.xyz.y = 0.0f;
687+
Impact_pos.xyz.z = 0.0f;
688+
687689
Impact_radius = 1.0f;
688690
}
689691

@@ -711,4 +713,4 @@ const vec3d& shield_material::get_impact_pos()
711713
float shield_material::get_impact_radius()
712714
{
713715
return Impact_radius;
714-
}
716+
}

code/graphics/material.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -102,32 +102,32 @@ class material
102102

103103
class model_material : public material
104104
{
105-
bool Desaturate;
105+
bool Desaturate = false;
106106

107-
bool Shadow_casting;
108-
bool Batched;
107+
bool Shadow_casting = false;
108+
bool Batched = false;
109109

110-
bool Deferred;
111-
bool HDR;
112-
bool lighting;
113-
float Light_factor;
110+
bool Deferred = false;
111+
bool HDR = false;
112+
bool lighting = false;
113+
float Light_factor = 1.0f;
114114

115-
int Center_alpha;
115+
int Center_alpha = 0;
116116

117-
int Animated_effect;
118-
float Animated_timer;
117+
int Animated_effect = -1;
118+
float Animated_timer = 0.0f;
119119

120-
float Thrust_scale;
120+
float Thrust_scale = -1.0f;
121121

122-
bool Team_color_set;
122+
bool Team_color_set = false;
123123
team_color Tm_color;
124124

125-
bool Normal_alpha;
126-
float Normal_alpha_min;
127-
float Normal_alpha_max;
125+
bool Normal_alpha = false;
126+
float Normal_alpha_min = 0.0f;
127+
float Normal_alpha_max = 1.0f;
128128

129-
bool Normal_extrude;
130-
float Normal_extrude_width;
129+
bool Normal_extrude = false;
130+
float Normal_extrude_width = -1.0f;
131131

132132
public:
133133
model_material();
@@ -228,4 +228,4 @@ void material_set_unlit_color(material* mat_info, int texture, color *clr, float
228228
void material_set_unlit_volume(particle_material* mat_info, int texture, bool point_sprites);
229229
void material_set_distortion(distortion_material *mat_info, int texture, bool thruster);
230230

231-
#endif
231+
#endif

code/graphics/opengl/gropenglshader.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ GLuint Framebuffer_fallback_texture_id = 0;
3333

3434
opengl_vert_attrib GL_vertex_attrib_info[] =
3535
{
36-
{ opengl_vert_attrib::POSITION, "vertPosition", { 0.0f, 0.0f, 0.0f, 1.0f } },
37-
{ opengl_vert_attrib::COLOR, "vertColor", { 1.0f, 1.0f, 1.0f, 1.0f } },
38-
{ opengl_vert_attrib::TEXCOORD, "vertTexCoord", { 1.0f, 1.0f, 1.0f, 1.0f } },
39-
{ opengl_vert_attrib::NORMAL, "vertNormal", { 0.0f, 0.0f, 1.0f, 0.0f } },
40-
{ opengl_vert_attrib::TANGENT, "vertTangent", { 1.0f, 0.0f, 0.0f, 0.0f } },
41-
{ opengl_vert_attrib::MODEL_ID, "vertModelID", { 0.0f, 0.0f, 0.0f, 0.0f } },
42-
{ opengl_vert_attrib::RADIUS, "vertRadius", { 1.0f, 0.0f, 0.0f, 0.0f } },
43-
{ opengl_vert_attrib::UVEC, "vertUvec", { 0.0f, 1.0f, 0.0f, 0.0f } }
36+
{ opengl_vert_attrib::POSITION, "vertPosition", {{{ 0.0f, 0.0f, 0.0f, 1.0f }}} },
37+
{ opengl_vert_attrib::COLOR, "vertColor", {{{ 1.0f, 1.0f, 1.0f, 1.0f }}} },
38+
{ opengl_vert_attrib::TEXCOORD, "vertTexCoord", {{{ 1.0f, 1.0f, 1.0f, 1.0f }}} },
39+
{ opengl_vert_attrib::NORMAL, "vertNormal", {{{ 0.0f, 0.0f, 1.0f, 0.0f }}} },
40+
{ opengl_vert_attrib::TANGENT, "vertTangent", {{{ 1.0f, 0.0f, 0.0f, 0.0f }}} },
41+
{ opengl_vert_attrib::MODEL_ID, "vertModelID", {{{ 0.0f, 0.0f, 0.0f, 0.0f }}} },
42+
{ opengl_vert_attrib::RADIUS, "vertRadius", {{{ 1.0f, 0.0f, 0.0f, 0.0f }}} },
43+
{ opengl_vert_attrib::UVEC, "vertUvec", {{{ 0.0f, 1.0f, 0.0f, 0.0f }}} }
4444
};
4545

4646
/**
@@ -826,7 +826,10 @@ void opengl_shader_set_passthrough(bool textured, bool alpha, vec4 *clr, float c
826826

827827
void opengl_shader_set_passthrough(bool textured, bool alpha, color *clr)
828828
{
829-
vec4 normalized_clr = { i2fl(clr->red) / 255.0f, i2fl(clr->green) / 255.0f, i2fl(clr->blue) / 255.0f, clr->is_alphacolor ? i2fl(clr->alpha) / 255.0f : 1.0f };
829+
vec4 normalized_clr = {{{ i2fl(clr->red) / 255.0f,
830+
i2fl(clr->green) / 255.0f,
831+
i2fl(clr->blue) / 255.0f,
832+
clr->is_alphacolor ? i2fl(clr->alpha) / 255.0f : 1.0f }}};
830833

831834
opengl_shader_set_passthrough(textured, alpha, &normalized_clr, 1.0f);
832835
}

0 commit comments

Comments
 (0)