Skip to content

Commit

Permalink
Remove majority of warnings
Browse files Browse the repository at this point in the history
There were a *lot* of warnings, managed to remove most of them.

Also, put warning flags before C_FLAGS and CXX_FLAGS, rather than after,
as -Wall -Wextra was overwriting flags that came before it.
  • Loading branch information
jp9000 committed Feb 14, 2014
1 parent 4bc282f commit 966b943
Show file tree
Hide file tree
Showing 46 changed files with 609 additions and 328 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ if(${CMAKE_C_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "C
endif()

if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function -Wno-unused-parameter -Wall -Wextra")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wno-unused-function -Wno-unused-parameter -Wall -Wextra")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-function ${CMAKE_CXX_FLAGS}")
set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-function -Wno-missing-field-initializers ${CMAKE_C_FLAGS} -std=gnu99")

option(USE_LIBC++ "Use libc++ instead of libstdc++" ${APPLE})
if(USE_LIBC++)
Expand Down
5 changes: 2 additions & 3 deletions libobs-d3d11/d3d11-exports.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ EXPORT vertbuffer_t device_create_vertexbuffer(device_t device,
EXPORT indexbuffer_t device_create_indexbuffer(device_t device,
enum gs_index_type type, void *indices, size_t num,
uint32_t flags);
EXPORT enum gs_texture_type device_gettexturetype(device_t device,
texture_t texture);
EXPORT enum gs_texture_type device_gettexturetype(texture_t texture);
EXPORT void device_load_vertexbuffer(device_t device, vertbuffer_t vertbuffer);
EXPORT void device_load_indexbuffer(device_t device, indexbuffer_t indexbuffer);
EXPORT void device_load_texture(device_t device, texture_t tex, int unit);
Expand Down Expand Up @@ -150,7 +149,7 @@ EXPORT void stagesurface_destroy(stagesurf_t stagesurf);
EXPORT uint32_t stagesurface_getwidth(stagesurf_t stagesurf);
EXPORT uint32_t stagesurface_getheight(stagesurf_t stagesurf);
EXPORT enum gs_color_format stagesurface_getcolorformat(stagesurf_t stagesurf);
EXPORT bool stagesurface_map(stagesurf_t stagesurf, const void **data,
EXPORT bool stagesurface_map(stagesurf_t stagesurf, const uint8_t **data,
uint32_t *linesize);
EXPORT void stagesurface_unmap(stagesurf_t stagesurf);

Expand Down
6 changes: 3 additions & 3 deletions libobs-d3d11/d3d11-subsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ indexbuffer_t device_create_indexbuffer(device_t device,
return buffer;
}

enum gs_texture_type device_gettexturetype(device_t device, texture_t texture)
enum gs_texture_type device_gettexturetype(texture_t texture)
{
return texture->type;
}
Expand Down Expand Up @@ -1547,15 +1547,15 @@ enum gs_color_format stagesurface_getcolorformat(stagesurf_t stagesurf)
return stagesurf->format;
}

bool stagesurface_map(stagesurf_t stagesurf, const void **data,
bool stagesurface_map(stagesurf_t stagesurf, const uint8_t **data,
uint32_t *linesize)
{
D3D11_MAPPED_SUBRESOURCE map;
if (FAILED(stagesurf->device->context->Map(stagesurf->texture, 0,
D3D11_MAP_READ, 0, &map)))
return false;

*data = map.pData;
*data = (uint8_t*)map.pData;
*linesize = map.RowPitch;
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion libobs-opengl/GL/gl_obs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#if defined(__APPLE__)
#include <dlfcn.h>

static void* AppleGLGetProcAddress (const const char *name)
static void* AppleGLGetProcAddress (const char *name)
{
static void* image = NULL;

Expand Down
5 changes: 2 additions & 3 deletions libobs-opengl/gl-exports.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ EXPORT vertbuffer_t device_create_vertexbuffer(device_t device,
EXPORT indexbuffer_t device_create_indexbuffer(device_t device,
enum gs_index_type type, void *indices, size_t num,
uint32_t flags);
EXPORT enum gs_texture_type device_gettexturetype(device_t device,
texture_t texture);
EXPORT enum gs_texture_type device_gettexturetype(texture_t texture);
EXPORT void device_load_vertexbuffer(device_t device, vertbuffer_t vertbuffer);
EXPORT void device_load_indexbuffer(device_t device, indexbuffer_t indexbuffer);
EXPORT void device_load_texture(device_t device, texture_t tex, int unit);
Expand Down Expand Up @@ -145,7 +144,7 @@ EXPORT void stagesurface_destroy(stagesurf_t stagesurf);
EXPORT uint32_t stagesurface_getwidth(stagesurf_t stagesurf);
EXPORT uint32_t stagesurface_getheight(stagesurf_t stagesurf);
EXPORT enum gs_color_format stagesurface_getcolorformat(stagesurf_t stagesurf);
EXPORT bool stagesurface_map(stagesurf_t stagesurf, const void **data,
EXPORT bool stagesurface_map(stagesurf_t stagesurf, const uint8_t **data,
uint32_t *linesize);
EXPORT void stagesurface_unmap(stagesurf_t stagesurf);

Expand Down
3 changes: 2 additions & 1 deletion libobs-opengl/gl-stagesurf.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ stagesurf_t device_create_stagesurface(device_t device, uint32_t width,
{
struct gs_stage_surface *surf;
surf = bzalloc(sizeof(struct gs_stage_surface));
surf->device = device;
surf->format = color_format;
surf->width = width;
surf->height = height;
Expand Down Expand Up @@ -176,7 +177,7 @@ enum gs_color_format stagesurface_getcolorformat(stagesurf_t stagesurf)
return stagesurf->format;
}

bool stagesurface_map(stagesurf_t stagesurf, const void **data,
bool stagesurface_map(stagesurf_t stagesurf, const uint8_t **data,
uint32_t *linesize)
{
if (!gl_bind_buffer(GL_PIXEL_PACK_BUFFER, stagesurf->pack_buffer))
Expand Down
56 changes: 50 additions & 6 deletions libobs-opengl/gl-subsystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ static void gl_enable_debug()
static void gl_enable_debug() {}
#endif

static inline void required_extension_error(const char *extension)
{
}

static bool gl_init_extensions(struct gs_device* device)
{
if (!ogl_IsVersionGEQ(2, 1)) {
Expand Down Expand Up @@ -263,6 +259,14 @@ texture_t device_create_volumetexture(device_t device, uint32_t width,
const void **data, uint32_t flags)
{
/* TODO */
UNUSED_PARAMETER(device);
UNUSED_PARAMETER(width);
UNUSED_PARAMETER(height);
UNUSED_PARAMETER(depth);
UNUSED_PARAMETER(color_format);
UNUSED_PARAMETER(levels);
UNUSED_PARAMETER(data);
UNUSED_PARAMETER(flags);
return NULL;
}

Expand All @@ -279,8 +283,7 @@ samplerstate_t device_create_samplerstate(device_t device,
return sampler;
}

enum gs_texture_type device_gettexturetype(device_t device,
texture_t texture)
enum gs_texture_type device_gettexturetype(texture_t texture)
{
return texture->type;
}
Expand Down Expand Up @@ -529,6 +532,9 @@ void device_load_pixelshader(device_t device, shader_t pixelshader)
void device_load_defaultsamplerstate(device_t device, bool b_3d, int unit)
{
/* TODO */
UNUSED_PARAMETER(device);
UNUSED_PARAMETER(b_3d);
UNUSED_PARAMETER(unit);
}

shader_t device_getvertexshader(device_t device)
Expand Down Expand Up @@ -902,6 +908,7 @@ void device_draw(device_t device, enum gs_draw_mode draw_mode,
void device_endscene(device_t device)
{
/* does nothing */
UNUSED_PARAMETER(device);
}

void device_clear(device_t device, uint32_t clear_flags,
Expand All @@ -927,6 +934,8 @@ void device_clear(device_t device, uint32_t clear_flags,
glClear(gl_flags);
if (!gl_success("glClear"))
blog(LOG_ERROR, "device_clear (GL) failed");

UNUSED_PARAMETER(device);
}

void device_setcullmode(device_t device, enum gs_cull_mode mode)
Expand Down Expand Up @@ -958,6 +967,8 @@ void device_enable_blending(device_t device, bool enable)
gl_enable(GL_BLEND);
else
gl_disable(GL_BLEND);

UNUSED_PARAMETER(device);
}

void device_enable_depthtest(device_t device, bool enable)
Expand All @@ -966,6 +977,8 @@ void device_enable_depthtest(device_t device, bool enable)
gl_enable(GL_DEPTH_TEST);
else
gl_disable(GL_DEPTH_TEST);

UNUSED_PARAMETER(device);
}

void device_enable_stenciltest(device_t device, bool enable)
Expand All @@ -974,6 +987,8 @@ void device_enable_stenciltest(device_t device, bool enable)
gl_enable(GL_STENCIL_TEST);
else
gl_disable(GL_STENCIL_TEST);

UNUSED_PARAMETER(device);
}

void device_enable_stencilwrite(device_t device, bool enable)
Expand All @@ -982,12 +997,16 @@ void device_enable_stencilwrite(device_t device, bool enable)
glStencilMask(0xFFFFFFFF);
else
glStencilMask(0);

UNUSED_PARAMETER(device);
}

void device_enable_color(device_t device, bool red, bool green,
bool blue, bool alpha)
{
glColorMask(red, green, blue, alpha);

UNUSED_PARAMETER(device);
}

void device_blendfunction(device_t device, enum gs_blend_type src,
Expand All @@ -999,6 +1018,8 @@ void device_blendfunction(device_t device, enum gs_blend_type src,
glBlendFunc(gl_src, gl_dst);
if (!gl_success("glBlendFunc"))
blog(LOG_ERROR, "device_blendfunction (GL) failed");

UNUSED_PARAMETER(device);
}

void device_depthfunction(device_t device, enum gs_depth_test test)
Expand All @@ -1008,6 +1029,8 @@ void device_depthfunction(device_t device, enum gs_depth_test test)
glDepthFunc(gl_test);
if (!gl_success("glDepthFunc"))
blog(LOG_ERROR, "device_depthfunction (GL) failed");

UNUSED_PARAMETER(device);
}

void device_stencilfunction(device_t device, enum gs_stencil_side side,
Expand All @@ -1019,6 +1042,8 @@ void device_stencilfunction(device_t device, enum gs_stencil_side side,
glStencilFuncSeparate(gl_side, gl_test, 0, 0xFFFFFFFF);
if (!gl_success("glStencilFuncSeparate"))
blog(LOG_ERROR, "device_stencilfunction (GL) failed");

UNUSED_PARAMETER(device);
}

void device_stencilop(device_t device, enum gs_stencil_side side,
Expand All @@ -1033,35 +1058,48 @@ void device_stencilop(device_t device, enum gs_stencil_side side,
glStencilOpSeparate(gl_side, gl_fail, gl_zfail, gl_zpass);
if (!gl_success("glStencilOpSeparate"))
blog(LOG_ERROR, "device_stencilop (GL) failed");

UNUSED_PARAMETER(device);
}

void device_enable_fullscreen(device_t device, bool enable)
{
/* TODO */
UNUSED_PARAMETER(device);
UNUSED_PARAMETER(enable);
}

int device_fullscreen_enabled(device_t device)
{
/* TODO */
UNUSED_PARAMETER(device);
return false;
}

void device_setdisplaymode(device_t device,
const struct gs_display_mode *mode)
{
/* TODO */
UNUSED_PARAMETER(device);
UNUSED_PARAMETER(mode);
}

void device_getdisplaymode(device_t device,
struct gs_display_mode *mode)
{
/* TODO */
UNUSED_PARAMETER(device);
UNUSED_PARAMETER(mode);
}

void device_setcolorramp(device_t device, float gamma, float brightness,
float contrast)
{
/* TODO */
UNUSED_PARAMETER(device);
UNUSED_PARAMETER(gamma);
UNUSED_PARAMETER(brightness);
UNUSED_PARAMETER(contrast);
}

static inline uint32_t get_target_height(struct gs_device *device)
Expand Down Expand Up @@ -1105,6 +1143,7 @@ void device_getviewport(device_t device, struct gs_rect *rect)

void device_setscissorrect(device_t device, struct gs_rect *rect)
{
UNUSED_PARAMETER(device);
glScissor(rect->x, rect->y, rect->cx, rect->cy);
if (!gl_success("glScissor"))
blog(LOG_ERROR, "device_setscissorrect (GL) failed");
Expand Down Expand Up @@ -1194,29 +1233,34 @@ void swapchain_destroy(swapchain_t swapchain)
void volumetexture_destroy(texture_t voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
}

uint32_t volumetexture_getwidth(texture_t voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}

uint32_t volumetexture_getheight(texture_t voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}

uint32_t volumetexture_getdepth(texture_t voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return 0;
}

enum gs_color_format volumetexture_getcolorformat(texture_t voltex)
{
/* TODO */
UNUSED_PARAMETER(voltex);
return GS_UNKNOWN;
}

Expand Down
2 changes: 2 additions & 0 deletions libobs-opengl/gl-subsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ struct gs_texture_cube {
};

struct gs_stage_surface {
device_t device;

enum gs_color_format format;
uint32_t width;
uint32_t height;
Expand Down
6 changes: 3 additions & 3 deletions libobs-opengl/gl-vertexbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ void vertexbuffer_flush(vertbuffer_t vb, bool rebuild)
goto failed;
}

UNUSED_PARAMETER(rebuild);
return;

failed:
Expand Down Expand Up @@ -202,8 +203,7 @@ static inline GLuint get_vb_buffer(struct gs_vertex_buffer *vb,
return 0;
}

static bool load_vb_buffer(struct gs_shader *shader,
struct shader_attrib *attrib,
static bool load_vb_buffer(struct shader_attrib *attrib,
struct gs_vertex_buffer *vb)
{
GLenum type;
Expand Down Expand Up @@ -245,7 +245,7 @@ static inline bool load_vb_buffers(struct gs_shader *shader,

for (i = 0; i < shader->attribs.num; i++) {
struct shader_attrib *attrib = shader->attribs.array+i;
if (!load_vb_buffer(shader, attrib, vb))
if (!load_vb_buffer(attrib, vb))
return false;
}

Expand Down
1 change: 1 addition & 0 deletions libobs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ set(libobs_mediaio_SOURCES
media-io/format-conversion.c
media-io/audio-io.c)
set(libobs_mediaio_HEADERS
media-io/media-io-defs.h
media-io/format-conversion.h
media-io/video-io.h
media-io/audio-resampler.h
Expand Down
4 changes: 2 additions & 2 deletions libobs/callback/calldata.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ static inline bool calldata_getsize (calldata_t data, const char *name,
}

static inline bool calldata_getptr (calldata_t data, const char *name,
void **ptr)
void *p_ptr)
{
return calldata_getdata(data, name, ptr, sizeof(*ptr));
return calldata_getdata(data, name, p_ptr, sizeof(p_ptr));
}

EXPORT bool calldata_getstring(calldata_t data, const char *name,
Expand Down
Loading

0 comments on commit 966b943

Please sign in to comment.