mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Add LOVE_UNUSED macro to stamp out all those "unused parameter" warnings
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
|
#include <common/config.h>
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
{
|
{
|
||||||
@@ -32,6 +33,7 @@ namespace love
|
|||||||
|
|
||||||
Exception::Exception(int unparsed, const char * str)
|
Exception::Exception(int unparsed, const char * str)
|
||||||
{
|
{
|
||||||
|
LOVE_UNUSED(unparsed);
|
||||||
strncpy(buffer, str, BUFFER_SIZE);
|
strncpy(buffer, str, BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,10 @@
|
|||||||
# define _CRT_SECURE_NO_WARNINGS
|
# define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef LOVE_UNUSED
|
||||||
|
# define LOVE_UNUSED(x) (void)sizeof(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LOVE_BUILD
|
#ifndef LOVE_BUILD
|
||||||
# define LOVE_BUILD
|
# define LOVE_BUILD
|
||||||
# define LOVE_BUILD_STANDALONE
|
# define LOVE_BUILD_STANDALONE
|
||||||
|
|||||||
@@ -734,6 +734,7 @@ namespace opengl
|
|||||||
// glEnable (GL_POLYGON_SMOOTH);
|
// glEnable (GL_POLYGON_SMOOTH);
|
||||||
// glHint (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
// glHint (GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
||||||
//}
|
//}
|
||||||
|
LOVE_UNUSED(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::setLine( float width, Graphics::LineStyle style )
|
void Graphics::setLine( float width, Graphics::LineStyle style )
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "VertexBuffer.h"
|
#include "VertexBuffer.h"
|
||||||
|
|
||||||
#include "common/Exception.h"
|
#include "common/Exception.h"
|
||||||
|
#include <common/config.h>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -61,13 +62,13 @@ namespace opengl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VertexBuffer::Bind
|
// VertexBuffer::Bind
|
||||||
|
|
||||||
VertexBuffer::Bind::Bind(VertexBuffer &buf)
|
VertexBuffer::Bind::Bind(VertexBuffer &buf)
|
||||||
: buf(buf)
|
: buf(buf)
|
||||||
{
|
{
|
||||||
buf.bind();
|
buf.bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexBuffer::Bind::~Bind()
|
VertexBuffer::Bind::~Bind()
|
||||||
{
|
{
|
||||||
buf.unbind();
|
buf.unbind();
|
||||||
@@ -86,23 +87,24 @@ namespace opengl
|
|||||||
delete [] buf;
|
delete [] buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *VertexArray::map(GLenum access)
|
void *VertexArray::map(GLenum access)
|
||||||
{
|
{
|
||||||
return buf;
|
LOVE_UNUSED(access);
|
||||||
}
|
return buf;
|
||||||
|
}
|
||||||
void VertexArray::unmap()
|
|
||||||
{
|
void VertexArray::unmap()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
void VertexArray::bind()
|
|
||||||
{
|
void VertexArray::bind()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
void VertexArray::unbind()
|
|
||||||
{
|
void VertexArray::unbind()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void VertexArray::fill(int offset, int size, const void *data)
|
void VertexArray::fill(int offset, int size, const void *data)
|
||||||
{
|
{
|
||||||
memcpy(buf + offset, data, size);
|
memcpy(buf + offset, data, size);
|
||||||
@@ -136,33 +138,33 @@ namespace opengl
|
|||||||
unload(false);
|
unload(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *VBO::map(GLenum access)
|
void *VBO::map(GLenum access)
|
||||||
{
|
{
|
||||||
// Don't map twice.
|
// Don't map twice.
|
||||||
if (mapped)
|
if (mapped)
|
||||||
return mapped;
|
return mapped;
|
||||||
|
|
||||||
mapped = glMapBufferARB(getTarget(), access);
|
mapped = glMapBufferARB(getTarget(), access);
|
||||||
|
|
||||||
return mapped;
|
return mapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VBO::unmap()
|
void VBO::unmap()
|
||||||
{
|
{
|
||||||
glUnmapBufferARB(getTarget());
|
glUnmapBufferARB(getTarget());
|
||||||
mapped = 0;
|
mapped = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VBO::bind()
|
void VBO::bind()
|
||||||
{
|
{
|
||||||
glBindBufferARB(getTarget(), vbo);
|
glBindBufferARB(getTarget(), vbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VBO::unbind()
|
void VBO::unbind()
|
||||||
{
|
{
|
||||||
glBindBufferARB(getTarget(), 0);
|
glBindBufferARB(getTarget(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VBO::fill(int offset, int size, const void *data)
|
void VBO::fill(int offset, int size, const void *data)
|
||||||
{
|
{
|
||||||
if (mapped)
|
if (mapped)
|
||||||
@@ -176,35 +178,35 @@ namespace opengl
|
|||||||
return reinterpret_cast<const void*>(offset);
|
return reinterpret_cast<const void*>(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VBO::loadVolatile()
|
bool VBO::loadVolatile()
|
||||||
{
|
{
|
||||||
return load(true);
|
return load(true);
|
||||||
}
|
|
||||||
|
|
||||||
void VBO::unloadVolatile()
|
|
||||||
{
|
|
||||||
unload(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VBO::load(bool restore)
|
void VBO::unloadVolatile()
|
||||||
{
|
{
|
||||||
glGenBuffersARB(1, &vbo);
|
unload(true);
|
||||||
|
}
|
||||||
VertexBuffer::Bind bind(*this);
|
|
||||||
|
bool VBO::load(bool restore)
|
||||||
// Copy the old buffer only if 'restore' was requested.
|
{
|
||||||
const GLvoid *src = restore ? buffer_copy : 0;
|
glGenBuffersARB(1, &vbo);
|
||||||
|
|
||||||
// Note that if 'src' is '0', no data will be copied.
|
VertexBuffer::Bind bind(*this);
|
||||||
glBufferDataARB(getTarget(), getSize(), src, getUsage());
|
|
||||||
|
// Copy the old buffer only if 'restore' was requested.
|
||||||
|
const GLvoid *src = restore ? buffer_copy : 0;
|
||||||
|
|
||||||
|
// Note that if 'src' is '0', no data will be copied.
|
||||||
|
glBufferDataARB(getTarget(), getSize(), src, getUsage());
|
||||||
|
|
||||||
// Clean up buffer_copy, if it exists.
|
// Clean up buffer_copy, if it exists.
|
||||||
delete[] buffer_copy;
|
delete[] buffer_copy;
|
||||||
buffer_copy = 0;
|
buffer_copy = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VBO::unload(bool save)
|
void VBO::unload(bool save)
|
||||||
{
|
{
|
||||||
// Clean up buffer_copy, if it exists.
|
// Clean up buffer_copy, if it exists.
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#define LOVE_THREAD_SDL_THREADS_H
|
#define LOVE_THREAD_SDL_THREADS_H
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
#include <common/config.h>
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
{
|
{
|
||||||
@@ -31,7 +32,7 @@ namespace thread
|
|||||||
class Mutex {
|
class Mutex {
|
||||||
private:
|
private:
|
||||||
SDL_mutex* mutex;
|
SDL_mutex* mutex;
|
||||||
Mutex(const Mutex& mutex) {}
|
Mutex(const Mutex& mutex) {LOVE_UNUSED(mutex);}
|
||||||
|
|
||||||
friend class Conditional;
|
friend class Conditional;
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ namespace thread
|
|||||||
class ThreadBase {
|
class ThreadBase {
|
||||||
private:
|
private:
|
||||||
SDL_Thread* thread;
|
SDL_Thread* thread;
|
||||||
ThreadBase(ThreadBase& thread) {}
|
ThreadBase(ThreadBase& thread) {LOVE_UNUSED(thread);}
|
||||||
bool running;
|
bool running;
|
||||||
|
|
||||||
static int thread_runner(void* param);
|
static int thread_runner(void* param);
|
||||||
@@ -70,7 +71,7 @@ namespace thread
|
|||||||
|
|
||||||
class Semaphore {
|
class Semaphore {
|
||||||
private:
|
private:
|
||||||
Semaphore(const Semaphore& sem) {}
|
Semaphore(const Semaphore& sem) {LOVE_UNUSED(sem);}
|
||||||
SDL_sem* semaphore;
|
SDL_sem* semaphore;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace thread
|
|||||||
private:
|
private:
|
||||||
Mutex* mutex;
|
Mutex* mutex;
|
||||||
|
|
||||||
Lock(Lock& lock) {}
|
Lock(Lock& lock) {LOVE_UNUSED(lock);}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Lock(Mutex* m): mutex(m) {
|
Lock(Mutex* m): mutex(m) {
|
||||||
|
|||||||
Reference in New Issue
Block a user