-Wextra compiler warnings fixed

This commit is contained in:
Matej Sekoranja
2013-02-16 12:50:36 +01:00
parent 246825d672
commit 675243061d
15 changed files with 72 additions and 70 deletions
+1 -1
View File
@@ -2721,7 +2721,7 @@ void convertStructure(StringBuilder buffer,PVStructure const *data,int indentLev
}
}
void convertArray(StringBuilder buffer,PVScalarArray const * xxx,int indentLevel)
void convertArray(StringBuilder buffer,PVScalarArray const * xxx,int /*indentLevel*/)
{
PVScalarArray *pv = const_cast<PVScalarArray *>(xxx);
ScalarArrayConstPtr array = pv->getScalarArray();
+8 -8
View File
@@ -39,7 +39,7 @@ Field::~Field() {
}
void Field::toString(StringBuilder buffer,int indentLevel) const{
void Field::toString(StringBuilder /*buffer*/,int /*indentLevel*/) const{
}
@@ -54,7 +54,7 @@ struct ScalarArrayHashFunction {
};
struct StructureHashFunction {
size_t operator() (const Structure& structure) const { return 0; }
size_t operator() (const Structure& /*structure*/) const { return 0; }
// TODO
// final int PRIME = 31;
// return PRIME * Arrays.hashCode(fieldNames) + Arrays.hashCode(fields);
@@ -70,7 +70,7 @@ Scalar::Scalar(ScalarType scalarType)
Scalar::~Scalar(){}
void Scalar::toString(StringBuilder buffer,int indentLevel) const{
void Scalar::toString(StringBuilder buffer,int /*indentLevel*/) const{
*buffer += getID();
}
@@ -119,7 +119,7 @@ void Scalar::serialize(ByteBuffer *buffer, SerializableControl *control) const {
buffer->putByte(getTypeCodeLUT());
}
void Scalar::deserialize(ByteBuffer *buffer, DeserializableControl *control) {
void Scalar::deserialize(ByteBuffer */*buffer*/, DeserializableControl */*control*/) {
// must be done via FieldCreate
throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead");
}
@@ -213,7 +213,7 @@ String ScalarArray::getID() const
return getIDScalarArrayLUT();
}
void ScalarArray::toString(StringBuilder buffer,int indentLevel) const{
void ScalarArray::toString(StringBuilder buffer,int /*indentLevel*/) const{
*buffer += getID();
}
@@ -222,7 +222,7 @@ void ScalarArray::serialize(ByteBuffer *buffer, SerializableControl *control) co
buffer->putByte(0x10 | getTypeCodeLUT());
}
void ScalarArray::deserialize(ByteBuffer *buffer, DeserializableControl *control) {
void ScalarArray::deserialize(ByteBuffer */*buffer*/, DeserializableControl */*control*/) {
throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead");
}
@@ -252,7 +252,7 @@ void StructureArray::serialize(ByteBuffer *buffer, SerializableControl *control)
control->cachedSerialize(pstructure, buffer);
}
void StructureArray::deserialize(ByteBuffer *buffer, DeserializableControl *control) {
void StructureArray::deserialize(ByteBuffer */*buffer*/, DeserializableControl */*control*/) {
throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead");
}
@@ -357,7 +357,7 @@ void Structure::serialize(ByteBuffer *buffer, SerializableControl *control) cons
serializeStructureField(this, buffer, control);
}
void Structure::deserialize(ByteBuffer *buffer, DeserializableControl *control) {
void Structure::deserialize(ByteBuffer */*buffer*/, DeserializableControl */*control*/) {
throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead");
}
+15 -15
View File
@@ -147,9 +147,9 @@ void BasePVString::serialize(ByteBuffer *pbuffer,
{
// check bounds
const size_t length = /*(value == null) ? 0 :*/ value.length();
if (offset < 0) offset = 0;
else if (offset > length) offset = length;
if (count < 0) count = length;
/*if (offset < 0) offset = 0;
else*/ if (offset > length) offset = length;
//if (count < 0) count = length;
const size_t maxCount = length - offset;
if (count > maxCount)
@@ -271,7 +271,7 @@ size_t DefaultPVArray<T>::get(size_t offset, size_t len, PVArrayData<T> &data)
size_t length = this->getLength();
if(offset+len > length) {
n = length-offset;
if(n<0) n = 0;
//if(n<0) n = 0;
}
data.data = *value.get();
data.offset = offset;
@@ -331,8 +331,8 @@ template<typename T>
void DefaultPVArray<T>::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pcontrol) {
size_t size = SerializeHelper::readSize(pbuffer, pcontrol);
// if (size>0) { pcontrol->ensureData(sizeof(T)-1); pbuffer->align(sizeof(T)); }
if(size>=0) {
// alignment if (size>0) { pcontrol->ensureData(sizeof(T)-1); pbuffer->align(sizeof(T)); }
//if(size>=0) {
// prepare array, if necessary
if(size>this->getCapacity()) this->setCapacity(size);
// set new length
@@ -356,7 +356,7 @@ void DefaultPVArray<T>::deserialize(ByteBuffer *pbuffer,
}
// inform about the change?
PVField::postPut();
}
//}
// TODO null arrays (size == -1) not supported
}
@@ -367,10 +367,10 @@ void DefaultPVArray<T>::serialize(ByteBuffer *pbuffer,
size_t length = this->getLength();
// check bounds
if(offset<0)
/*if(offset<0)
offset = 0;
else if(offset>length) offset = length;
if(count<0) count = length;
else*/ if(offset>length) offset = length;
//if(count<0) count = length;
size_t maxCount = length-offset;
if(count>maxCount) count = maxCount;
@@ -406,7 +406,7 @@ template<>
void DefaultPVArray<String>::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pcontrol) {
size_t size = SerializeHelper::readSize(pbuffer, pcontrol);
if(size>=0) {
//if(size>=0) {
// prepare array, if necessary
if(size>getCapacity()) setCapacity(size);
// set new length
@@ -419,7 +419,7 @@ void DefaultPVArray<String>::deserialize(ByteBuffer *pbuffer,
}
// inform about the change?
postPut();
}
//}
// TODO null arrays (size == -1) not supported
}
@@ -429,10 +429,10 @@ void DefaultPVArray<String>::serialize(ByteBuffer *pbuffer,
size_t length = getLength();
// check bounds
if(offset<0)
/*if(offset<0)
offset = 0;
else if(offset>length) offset = length;
if(count<0) count = length;
else*/ if(offset>length) offset = length;
//if(count<0) count = length;
size_t maxCount = length-offset;
if(count>maxCount) count = maxCount;
+6 -6
View File
@@ -133,7 +133,7 @@ size_t PVStructureArray::get(
size_t length = getLength();
if(offset+len > length) {
n = length - offset;
if(n<0) n = 0;
//if(n<0) n = 0;
}
data.data = *value.get();
data.offset = offset;
@@ -197,7 +197,7 @@ void PVStructureArray::serialize(ByteBuffer *pbuffer,
void PVStructureArray::deserialize(ByteBuffer *pbuffer,
DeserializableControl *pcontrol) {
size_t size = SerializeHelper::readSize(pbuffer, pcontrol);
if(size>=0) {
//if(size>=0) {
// prepare array, if necessary
if(size>getCapacity()) setCapacity(size);
setLength(size);
@@ -217,7 +217,7 @@ void PVStructureArray::deserialize(ByteBuffer *pbuffer,
}
}
postPut();
}
//}
}
void PVStructureArray::serialize(ByteBuffer *pbuffer,
@@ -226,10 +226,10 @@ void PVStructureArray::serialize(ByteBuffer *pbuffer,
size_t length = getLength();
// check bounds
if(offset<0)
/*if(offset<0)
offset = 0;
else if(offset>length) offset = length;
if(count<0) count = length;
else*/ if(offset>length) offset = length;
//if(count<0) count = length;
size_t maxCount = length-offset;
if(count>maxCount) count = maxCount;
+1 -1
View File
@@ -331,7 +331,7 @@ namespace epics { namespace pvData {
return !(*this == set);
}
void BitSet::toString(StringBuilder buffer, int indentLevel) const
void BitSet::toString(StringBuilder buffer, int /*indentLevel*/) const
{
*buffer += '{';
int32 i = nextSetBit(0);
+4 -4
View File
@@ -77,14 +77,14 @@ namespace epics {
void SerializeHelper::serializeSubstring(const String& value,
std::size_t offset, std::size_t count, ByteBuffer* buffer,
SerializableControl* flusher) {
if(offset<0)
/*if(offset<0)
offset = 0;
else if(offset>(std::size_t)value.length()) offset = value.length();
else*/ if(offset>value.length()) offset = value.length();
if(offset+count>(std::size_t)value.length()) count = value.length()-offset;
if(offset+count>value.length()) count = value.length()-offset;
SerializeHelper::writeSize(count, buffer, flusher);
if (count<=0) return;
/*if (count<=0)*/ return;
std::size_t i = 0;
while(true) {
std::size_t maxToWrite = min(count-i, buffer->getRemaining());
+1 -1
View File
@@ -117,7 +117,7 @@ String Status::toString() const
return str;
}
void Status::toString(StringBuilder buffer, int indentLevel) const
void Status::toString(StringBuilder buffer, int /*indentLevel*/) const
{
*buffer += "Status [type=";
*buffer += StatusTypeName[m_statusType];
+2 -2
View File
@@ -27,11 +27,11 @@ struct Unroller
};
template<>
void Unroller::unroll<0>(double d) {
void Unroller::unroll<0>(double /*d*/) {
THROW_BASE_EXCEPTION("the root cause");
}
void internalTestBaseException(int unused = 0)
void internalTestBaseException(int /*unused*/ = 0)
{
try {
// NOTE: 5, 4, 3, 2, 1 calls will be optimized and not shown
+1 -1
View File
@@ -30,7 +30,7 @@
using namespace epics::pvData;
static void testBasic(FILE * fd,FILE *auxfd ) {
static void testBasic(FILE * fd,FILE */*auxfd*/) {
int queueSize = 3;
StringArray messages;
messages.reserve(5);
+20 -18
View File
@@ -24,22 +24,24 @@
#include <pv/standardField.h>
#define BYTE_MAX_VALUE 127
#define BYTE_MIN_VALUE -128
#define UBYTE_MAX_VALUE 255
#define SHORT_MAX_VALUE 32767
#define SHORT_MIN_VALUE -32768
#define USHORT_MAX_VALUE 65535
#define INT_MAX_VALUE 2147483647
#define INT_MIN_VALUE (-INT_MAX_VALUE - 1)
#define UINT_MAX_VALUE 4294967295ULL
#define LONG_MAX_VALUE 9223372036854775807LL
#define LONG_MIN_VALUE (-LONG_MAX_VALUE - 1LL)
#define ULONG_MAX_VALUE 18446744073709549999ULL
#define FLOAT_MAX_VALUE 3.4028235E38
#define FLOAT_MIN_VALUE 1.4E-45
#define DOUBLE_MAX_VALUE 1.7976931348623157E308
#define DOUBLE_MIN_VALUE 4.9E-324
#include <limits>
#define BYTE_MAX_VALUE std::numeric_limits<int8>::max()
#define BYTE_MIN_VALUE std::numeric_limits<int8>::min()
#define UBYTE_MAX_VALUE std::numeric_limits<uint8>::max()
#define SHORT_MAX_VALUE std::numeric_limits<int16>::max()
#define SHORT_MIN_VALUE std::numeric_limits<int16>::min()
#define USHORT_MAX_VALUE std::numeric_limits<uint16>::max()
#define INT_MAX_VALUE std::numeric_limits<int32>::max()
#define INT_MIN_VALUE std::numeric_limits<int32>::min()
#define UINT_MAX_VALUE std::numeric_limits<uint32>::max()
#define LONG_MAX_VALUE std::numeric_limits<int64>::max()
#define LONG_MIN_VALUE std::numeric_limits<int64>::min()
#define ULONG_MAX_VALUE std::numeric_limits<uint64>::max()
#define FLOAT_MAX_VALUE std::numeric_limits<float>::max()
#define FLOAT_MIN_VALUE std::numeric_limits<float>::min()
#define DOUBLE_MAX_VALUE std::numeric_limits<double>::max()
#define DOUBLE_MIN_VALUE std::numeric_limits<double>::min()
using namespace epics::pvData;
@@ -54,7 +56,7 @@ public:
virtual void flushSerializeBuffer() {
}
virtual void ensureBuffer(std::size_t size) {
virtual void ensureBuffer(std::size_t /*size*/) {
}
virtual void alignBuffer(std::size_t alignment) {
@@ -76,7 +78,7 @@ public:
class DeserializableControlImpl : public DeserializableControl,
public NoDefaultMethods {
public:
virtual void ensureData(size_t size) {
virtual void ensureData(size_t /*size*/) {
}
virtual void alignData(size_t alignment) {
+2 -2
View File
@@ -50,7 +50,7 @@ public:
printf("poll called\n");
return emptyElement;
}
virtual void release(MonitorElementPtr const & monitorElement)
virtual void release(MonitorElementPtr const & /*monitorElement*/)
{
printf("release called\n");
}
@@ -70,7 +70,7 @@ static void testMonitor()
}
int main(int argc,char *argv[])
int main(int, char **)
{
testMonitor();
return(0);
+6 -6
View File
@@ -48,7 +48,7 @@ static String allProperties("alarm,timeStamp,display,control");
static PVStructurePtr doubleRecord;
static PVStructurePtr enumeratedRecord;
static void createRecords(FILE * fd,FILE *auxfd)
static void createRecords(FILE * fd,FILE */*auxfd*/)
{
doubleRecord = standardPVField->scalar(pvDouble,allProperties);
if(debug) {
@@ -70,7 +70,7 @@ static void createRecords(FILE * fd,FILE *auxfd)
}
}
static void printRecords(FILE * fd,FILE *auxfd)
static void printRecords(FILE * fd,FILE */*auxfd*/)
{
fprintf(fd,"doubleRecord\n");
builder.clear();
@@ -82,7 +82,7 @@ static void printRecords(FILE * fd,FILE *auxfd)
fprintf(fd,"%s\n",builder.c_str());
}
static void testAlarm(FILE * fd,FILE *auxfd)
static void testAlarm(FILE * fd,FILE */*auxfd*/)
{
if(debug) fprintf(fd,"testAlarm\n");
Alarm alarm;
@@ -155,7 +155,7 @@ static void testTimeStamp(FILE * fd,FILE *auxfd)
fprintf(fd,"testTimeStamp PASSED\n");
}
static void testControl(FILE * fd,FILE *auxfd)
static void testControl(FILE * fd,FILE */*auxfd*/)
{
if(debug) fprintf(fd,"testControl\n");
Control control;
@@ -182,7 +182,7 @@ static void testControl(FILE * fd,FILE *auxfd)
fprintf(fd,"testControl PASSED\n");
}
static void testDisplay(FILE * fd,FILE *auxfd)
static void testDisplay(FILE * fd,FILE */*auxfd*/)
{
if(debug) fprintf(fd,"testDisplay\n");
Display display;
@@ -215,7 +215,7 @@ static void testDisplay(FILE * fd,FILE *auxfd)
fprintf(fd,"testDisplay PASSED\n");
}
static void testEnumerated(FILE * fd,FILE *auxfd)
static void testEnumerated(FILE * fd,FILE */*auxfd*/)
{
if(debug) fprintf(fd,"testEnumerated\n");
PVEnumerated pvEnumerated;
+3 -3
View File
@@ -77,7 +77,7 @@ static void testCreatePVStructure(FILE * fd)
fprintf(fd,"testCreatePVStructure PASSED\n");
}
static void testPVScalarCommon(FILE * fd,String fieldName,ScalarType stype)
static void testPVScalarCommon(FILE * fd,String /*fieldName*/,ScalarType stype)
{
PVScalarPtr pvScalar = pvDataCreate->createPVScalar(stype);
if(stype==pvBoolean) {
@@ -91,7 +91,7 @@ static void testPVScalarCommon(FILE * fd,String fieldName,ScalarType stype)
}
static void testPVScalarWithProperties(
FILE * fd,String fieldName,ScalarType stype)
FILE * fd,String /*fieldName*/,ScalarType stype)
{
PVStructurePtr pvStructure;
bool hasValueAlarm = false;
@@ -335,7 +335,7 @@ static void testPVScalar(FILE * fd) {
}
static void testScalarArrayCommon(FILE * fd,String fieldName,ScalarType stype)
static void testScalarArrayCommon(FILE * fd,String /*fieldName*/,ScalarType stype)
{
PVStructurePtr pvStructure = standardPVField->scalarArray(
stype,alarmTimeStamp);
+1 -1
View File
@@ -35,7 +35,7 @@ static void print(String name)
if(debug) printf("\n%s\n%s\n",name.c_str(),builder.c_str());
}
int main(int argc,char *argv[])
int main(int, char **)
{
StructureConstPtr doubleValue = standardField->scalar(pvDouble,
"alarm,timeStamp,display,control,valueAlarm");
+1 -1
View File
@@ -37,7 +37,7 @@ static void print(String name)
if(debug) printf("\n%s\n%s\n",name.c_str(),builder.c_str());
}
int main(int argc,char *argv[])
int main(int, char **)
{
PVStructurePtr pvStructure = standardPVField->scalar(pvDouble,
"alarm,timeStamp,display,control,valueAlarm");