Fixed gcc build warnings

+ vim 'fixed' line endings in json_value.cpp

Contributed-by:  Johannes Doerfert <doerfert@cs.uni-saarland.de>
llvm-svn: 206044
This commit is contained in:
Tobias Grosser 2014-04-11 17:56:49 +00:00
parent 51f5b5fd73
commit 20532b8e1b
3 changed files with 93 additions and 85 deletions

View File

@ -813,7 +813,8 @@ __isl_give isl_id *Scop::getIdForParam(const SCEV *Parameter) const {
if (ParameterName == "" || ParameterName.substr(0, 2) == "p_")
ParameterName = "p_" + utostr_32(IdIter->second);
return isl_id_alloc(getIslCtx(), ParameterName.c_str(), (void *)Parameter);
return isl_id_alloc(getIslCtx(), ParameterName.c_str(),
const_cast<void *>((const void *)Parameter));
}
void Scop::buildContext() {

View File

@ -15,7 +15,12 @@
// Disable warnings. We do not fix these warnings, as this is a file imported
// into Polly and we do not want to diverge from the original source.
#ifdef __clang__
#pragma clang diagnostic ignored "-Wcovered-switch-default"
#endif
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Woverflow"
#endif
#define JSON_ASSERT_UNREACHABLE assert( false )
#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
@ -33,7 +38,7 @@ const Int Value::minInt = Int( ~(UInt(-1)/2) );
const Int Value::maxInt = Int( UInt(-1)/2 );
const UInt Value::maxUInt = UInt(-1);
// A "safe" implementation of strdup. Allow null pointer to be passed.
// A "safe" implementation of strdup. Allow null pointer to be passed.
// Also avoid warning on msvc80.
//
//inline char *safeStringDup( const char *czstring )
@ -82,7 +87,7 @@ public:
releaseStringValue( memberName );
}
virtual char *duplicateStringValue( const char *value,
virtual char *duplicateStringValue( const char *value,
unsigned int length = unknown )
{
//@todo invesgate this old optimization
@ -112,7 +117,7 @@ static ValueAllocator *&valueAllocator()
}
static struct DummyValueAllocatorInitializer {
DummyValueAllocatorInitializer()
DummyValueAllocatorInitializer()
{
valueAllocator(); // ensure valueAllocator() statics are initialized before main().
}
@ -156,7 +161,7 @@ Value::CommentInfo::~CommentInfo()
}
void
void
Value::CommentInfo::setComment( const char *text )
{
if ( comment_ )
@ -187,7 +192,7 @@ Value::CZString::CZString( int index )
}
Value::CZString::CZString( const char *cstr, DuplicationPolicy allocate )
: cstr_( allocate == duplicate ? valueAllocator()->makeMemberName(cstr)
: cstr_( allocate == duplicate ? valueAllocator()->makeMemberName(cstr)
: cstr )
, index_( allocate )
{
@ -208,7 +213,7 @@ Value::CZString::~CZString()
valueAllocator()->releaseMemberName( const_cast<char *>( cstr_ ) );
}
void
void
Value::CZString::swap( CZString &other )
{
std::swap( cstr_, other.cstr_ );
@ -223,16 +228,16 @@ Value::CZString::operator =( const CZString &other )
return *this;
}
bool
Value::CZString::operator<( const CZString &other ) const
bool
Value::CZString::operator<( const CZString &other ) const
{
if ( cstr_ )
return strcmp( cstr_, other.cstr_ ) < 0;
return index_ < other.index_;
}
bool
Value::CZString::operator==( const CZString &other ) const
bool
Value::CZString::operator==( const CZString &other ) const
{
if ( cstr_ )
return strcmp( cstr_, other.cstr_ ) == 0;
@ -240,7 +245,7 @@ Value::CZString::operator==( const CZString &other ) const
}
int
int
Value::CZString::index() const
{
return index_;
@ -253,7 +258,7 @@ Value::CZString::c_str() const
return cstr_;
}
bool
bool
Value::CZString::isStaticString() const
{
return index_ == noDuplication;
@ -361,7 +366,7 @@ Value::Value( const char *value )
}
Value::Value( const char *beginValue,
Value::Value( const char *beginValue,
const char *endValue )
: type_( stringValue )
, allocated_( true )
@ -370,7 +375,7 @@ Value::Value( const char *beginValue,
, itemIsUsed_( 0 )
#endif
{
value_.string_ = valueAllocator()->duplicateStringValue( beginValue,
value_.string_ = valueAllocator()->duplicateStringValue( beginValue,
UInt(endValue - beginValue) );
}
@ -383,7 +388,7 @@ Value::Value( const std::string &value )
, itemIsUsed_( 0 )
#endif
{
value_.string_ = valueAllocator()->duplicateStringValue( value.c_str(),
value_.string_ = valueAllocator()->duplicateStringValue( value.c_str(),
(unsigned int)value.length() );
}
@ -521,7 +526,7 @@ Value::operator=( const Value &other )
return *this;
}
void
void
Value::swap( Value &other )
{
ValueType temp = type_;
@ -533,14 +538,14 @@ Value::swap( Value &other )
other.allocated_ = temp2;
}
ValueType
ValueType
Value::type() const
{
return type_;
}
int
int
Value::compare( const Value &other )
{
/*
@ -570,7 +575,7 @@ Value::compare( const Value &other )
return 0; // unreachable
}
bool
bool
Value::operator <( const Value &other ) const
{
int typeDelta = type_ - other.type_;
@ -590,8 +595,8 @@ Value::operator <( const Value &other ) const
return value_.bool_ < other.value_.bool_;
case stringValue:
return ( value_.string_ == 0 && other.value_.string_ )
|| ( other.value_.string_
&& value_.string_
|| ( other.value_.string_
&& value_.string_
&& strcmp( value_.string_, other.value_.string_ ) < 0 );
#ifndef JSON_VALUE_USE_INTERNAL_MAP
case arrayValue:
@ -614,25 +619,25 @@ Value::operator <( const Value &other ) const
return 0; // unreachable
}
bool
bool
Value::operator <=( const Value &other ) const
{
return !(other > *this);
}
bool
bool
Value::operator >=( const Value &other ) const
{
return !(*this < other);
}
bool
bool
Value::operator >( const Value &other ) const
{
return other < *this;
}
bool
bool
Value::operator ==( const Value &other ) const
{
//if ( type_ != other.type_ )
@ -656,8 +661,8 @@ Value::operator ==( const Value &other ) const
return value_.bool_ == other.value_.bool_;
case stringValue:
return ( value_.string_ == other.value_.string_ )
|| ( other.value_.string_
&& value_.string_
|| ( other.value_.string_
&& value_.string_
&& strcmp( value_.string_, other.value_.string_ ) == 0 );
#ifndef JSON_VALUE_USE_INTERNAL_MAP
case arrayValue:
@ -676,7 +681,7 @@ Value::operator ==( const Value &other ) const
return 0; // unreachable
}
bool
bool
Value::operator !=( const Value &other ) const
{
return !( *this == other );
@ -690,7 +695,7 @@ Value::asCString() const
}
std::string
std::string
Value::asString() const
{
switch ( type_ )
@ -714,14 +719,14 @@ Value::asString() const
}
# ifdef JSON_USE_CPPTL
CppTL::ConstString
CppTL::ConstString
Value::asConstString() const
{
return CppTL::ConstString( asString().c_str() );
}
# endif
Value::Int
Value::Int
Value::asInt() const
{
switch ( type_ )
@ -748,7 +753,7 @@ Value::asInt() const
return 0; // unreachable;
}
Value::UInt
Value::UInt
Value::asUInt() const
{
switch ( type_ )
@ -775,7 +780,7 @@ Value::asUInt() const
return 0; // unreachable;
}
double
double
Value::asDouble() const
{
switch ( type_ )
@ -800,7 +805,7 @@ Value::asDouble() const
return 0; // unreachable;
}
bool
bool
Value::asBool() const
{
switch ( type_ )
@ -826,7 +831,7 @@ Value::asBool() const
}
bool
bool
Value::isConvertibleTo( ValueType other ) const
{
switch ( type_ )
@ -878,7 +883,7 @@ Value::isConvertibleTo( ValueType other ) const
/// Number of values in array or object
Value::UInt
Value::UInt
Value::size() const
{
switch ( type_ )
@ -914,7 +919,7 @@ Value::size() const
}
bool
bool
Value::empty() const
{
if ( isNull() || isArray() || isObject() )
@ -931,7 +936,7 @@ Value::operator!() const
}
void
void
Value::clear()
{
JSON_ASSERT( type_ == nullValue || type_ == arrayValue || type_ == objectValue );
@ -956,7 +961,7 @@ Value::clear()
}
}
void
void
Value::resize( UInt newSize )
{
JSON_ASSERT( type_ == nullValue || type_ == arrayValue );
@ -1028,14 +1033,14 @@ Value::operator[]( const char *key )
Value &
Value::resolveReference( const char *key,
Value::resolveReference( const char *key,
bool isStatic )
{
JSON_ASSERT( type_ == nullValue || type_ == objectValue );
if ( type_ == nullValue )
*this = Value( objectValue );
#ifndef JSON_VALUE_USE_INTERNAL_MAP
CZString actualKey( key, isStatic ? CZString::noDuplication
CZString actualKey( key, isStatic ? CZString::noDuplication
: CZString::duplicateOnCopy );
ObjectValues::iterator it = value_.map_->lower_bound( actualKey );
if ( it != value_.map_->end() && (*it).first == actualKey )
@ -1051,8 +1056,8 @@ Value::resolveReference( const char *key,
}
Value
Value::get( UInt index,
Value
Value::get( UInt index,
const Value &defaultValue ) const
{
const Value *value = &((*this)[index]);
@ -1060,7 +1065,7 @@ Value::get( UInt index,
}
bool
bool
Value::isValidIndex( UInt index ) const
{
return index < size();
@ -1130,8 +1135,8 @@ Value::append( const Value &value )
}
Value
Value::get( const char *key,
Value
Value::get( const char *key,
const Value &defaultValue ) const
{
const Value *value = &((*this)[key]);
@ -1139,7 +1144,7 @@ Value::get( const char *key,
}
Value
Value
Value::get( const std::string &key,
const Value &defaultValue ) const
{
@ -1179,7 +1184,7 @@ Value::removeMember( const std::string &key )
}
# ifdef JSON_USE_CPPTL
Value
Value
Value::get( const CppTL::ConstString &key,
const Value &defaultValue ) const
{
@ -1187,7 +1192,7 @@ Value::get( const CppTL::ConstString &key,
}
# endif
bool
bool
Value::isMember( const char *key ) const
{
const Value *value = &((*this)[key]);
@ -1195,7 +1200,7 @@ Value::isMember( const char *key ) const
}
bool
bool
Value::isMember( const std::string &key ) const
{
return isMember( key.c_str() );
@ -1203,14 +1208,14 @@ Value::isMember( const std::string &key ) const
# ifdef JSON_USE_CPPTL
bool
bool
Value::isMember( const CppTL::ConstString &key ) const
{
return isMember( key.c_str() );
}
#endif
Value::Members
Value::Members
Value::getMemberNames() const
{
JSON_ASSERT( type_ == nullValue || type_ == objectValue );
@ -1248,11 +1253,11 @@ Value::getMemberNames() const
//}
//
//
//EnumValues
//EnumValues
//Value::enumValues() const
//{
// if ( type_ == objectValue || type_ == arrayValue )
// return CppTL::Enum::anyValues( *(value_.map_),
// return CppTL::Enum::anyValues( *(value_.map_),
// CppTL::Type<const Value &>() );
// return EnumValues();
//}
@ -1267,72 +1272,72 @@ Value::isNull() const
}
bool
bool
Value::isBool() const
{
return type_ == booleanValue;
}
bool
bool
Value::isInt() const
{
return type_ == intValue;
}
bool
bool
Value::isUInt() const
{
return type_ == uintValue;
}
bool
bool
Value::isIntegral() const
{
return type_ == intValue
|| type_ == uintValue
return type_ == intValue
|| type_ == uintValue
|| type_ == booleanValue;
}
bool
bool
Value::isDouble() const
{
return type_ == realValue;
}
bool
bool
Value::isNumeric() const
{
return isIntegral() || isDouble();
}
bool
bool
Value::isString() const
{
return type_ == stringValue;
}
bool
bool
Value::isArray() const
{
return type_ == nullValue || type_ == arrayValue;
}
bool
bool
Value::isObject() const
{
return type_ == nullValue || type_ == objectValue;
}
void
void
Value::setComment( const char *comment,
CommentPlacement placement )
{
@ -1342,7 +1347,7 @@ Value::setComment( const char *comment,
}
void
void
Value::setComment( const std::string &comment,
CommentPlacement placement )
{
@ -1350,13 +1355,13 @@ Value::setComment( const std::string &comment,
}
bool
bool
Value::hasComment( CommentPlacement placement ) const
{
return comments_ != 0 && comments_[placement].comment_ != 0;
}
std::string
std::string
Value::getComment( CommentPlacement placement ) const
{
if ( hasComment(placement) )
@ -1365,7 +1370,7 @@ Value::getComment( CommentPlacement placement ) const
}
std::string
std::string
Value::toStyledString() const
{
StyledWriter writer;
@ -1373,7 +1378,7 @@ Value::toStyledString() const
}
Value::const_iterator
Value::const_iterator
Value::begin() const
{
switch ( type_ )
@ -1408,7 +1413,7 @@ Value::begin() const
return const_iterator();
}
Value::const_iterator
Value::const_iterator
Value::end() const
{
switch ( type_ )
@ -1444,7 +1449,7 @@ Value::end() const
}
Value::iterator
Value::iterator
Value::begin()
{
switch ( type_ )
@ -1479,7 +1484,7 @@ Value::begin()
return iterator();
}
Value::iterator
Value::iterator
Value::end()
{
switch ( type_ )
@ -1564,7 +1569,7 @@ Path::Path( const std::string &path,
}
void
void
Path::makePath( const std::string &path,
const InArgs &in )
{
@ -1608,10 +1613,10 @@ Path::makePath( const std::string &path,
}
void
Path::addPathInArg( const std::string &path,
const InArgs &in,
InArgs::const_iterator &itInArg,
void
Path::addPathInArg( const std::string &path,
const InArgs &in,
InArgs::const_iterator &itInArg,
PathArgument::Kind kind )
{
if ( itInArg == in.end() )
@ -1629,8 +1634,8 @@ Path::addPathInArg( const std::string &path,
}
void
Path::invalidPath( const std::string &path,
void
Path::invalidPath( const std::string &path,
int location )
{
// Error: invalid path.
@ -1669,8 +1674,8 @@ Path::resolve( const Value &root ) const
}
Value
Path::resolve( const Value &root,
Value
Path::resolve( const Value &root,
const Value &defaultValue ) const
{
const Value *node = &root;

View File

@ -183,7 +183,9 @@ private:
static isl_union_map *getScheduleMap(isl_schedule *Schedule);
bool doFinalization() {
using llvm::Pass::doFinalization;
virtual bool doFinalization() {
isl_schedule_free(LastSchedule);
LastSchedule = NULL;
return true;