Skip to content

Commit f27eb02

Browse files
committed
Compiling with clang and gcc with -Wshadow
See issue #17 Somewhere along the way we've also broken our ability to compile with GCC 4.7.3. We'll have to decide if we care about supporting 4.7.3 or not. The changes that break this are: -there is no emplace in std::map (or related) in 4.7.3 -there are some enable_ifs in rapidjson's writer.h that are always false (which is fine), but GCC 4.7.3 doesn't like this
1 parent 16b6e79 commit f27eb02

File tree

8 files changed

+104
-104
lines changed

8 files changed

+104
-104
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CPPFLAGS=-std=c++11 -I./include -Wall -Werror -g -Wextra
1+
CPPFLAGS=-std=c++11 -I./include -Wall -Werror -g -Wextra -Wshadow
22
CXX=g++
33
COVERAGE_OUTPUT=out
44

include/cereal/archives/json.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,11 @@ namespace cereal
407407

408408
//! Adjust our position such that we are at the node with the given name
409409
/*! @throws Exception if no such named node exists */
410-
inline void search( const char * name )//, GenericValue const & parent )
410+
inline void search( const char * searchName )//, GenericValue const & parent )
411411
{
412412
size_t index = 0;
413413
for( auto it = itsMemberItBegin; it != itsMemberItEnd; ++it, ++index )
414-
if( std::strcmp( name, it->name.GetString() ) == 0 )
414+
if( std::strcmp( searchName, it->name.GetString() ) == 0 )
415415
{
416416
itsIndex = index;
417417
return;

include/cereal/archives/xml.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -587,18 +587,18 @@ namespace cereal
587587
}
588588

589589
//! Searches for a child with the given name in this node
590-
/*! @param name The name to search for (must be null terminated)
590+
/*! @param searchName The name to search for (must be null terminated)
591591
@return The node if found, nullptr otherwise */
592-
rapidxml::xml_node<> * search( const char * name )
592+
rapidxml::xml_node<> * search( const char * searchName )
593593
{
594-
if( name )
594+
if( searchName )
595595
{
596596
size_t new_size = XMLInputArchive::getNumChildren( node );
597-
size_t name_size = rapidxml::internal::measure( name );
597+
size_t name_size = rapidxml::internal::measure( searchName );
598598

599599
for( auto new_child = node->first_node(); new_child != nullptr; new_child = new_child->next_sibling() )
600600
{
601-
if( rapidxml::internal::compare( new_child->name(), new_child->name_size(), name, name_size, true ) )
601+
if( rapidxml::internal::compare( new_child->name(), new_child->name_size(), searchName, name_size, true ) )
602602
{
603603
size = new_size;
604604
child = new_child;

include/cereal/cereal.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ namespace cereal
4848
/*! @ingroup Utility */
4949
struct Exception : public std::runtime_error
5050
{
51-
Exception( const std::string& what ) : std::runtime_error(what) {}
52-
Exception( const char* what ) : std::runtime_error(what) {}
51+
Exception( const std::string& what_ ) : std::runtime_error(what_) {}
52+
Exception( const char* what_ ) : std::runtime_error(what_) {}
5353
};
5454

5555
// ######################################################################
@@ -234,8 +234,8 @@ namespace cereal
234234
{
235235
public:
236236
//! Construct the output archive
237-
/*! @param self A pointer to the derived ArchiveType (pass this from the derived archive) */
238-
OutputArchive(ArchiveType * const self) : self(self), itsCurrentPointerId(1), itsCurrentPolymorphicTypeId(1)
237+
/*! @param derived A pointer to the derived ArchiveType (pass this from the derived archive) */
238+
OutputArchive(ArchiveType * const derived) : self(derived), itsCurrentPointerId(1), itsCurrentPolymorphicTypeId(1)
239239
{ }
240240

241241
//! Serializes all passed in data
@@ -540,8 +540,8 @@ namespace cereal
540540
{
541541
public:
542542
//! Construct the output archive
543-
/*! @param self A pointer to the derived ArchiveType (pass this from the derived archive) */
544-
InputArchive(ArchiveType * const self) : self(self) { }
543+
/*! @param derived A pointer to the derived ArchiveType (pass this from the derived archive) */
544+
InputArchive(ArchiveType * const derived) : self(derived) { }
545545

546546
//! Serializes all passed in data
547547
template <class ... Types> inline

include/cereal/details/helpers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ namespace cereal
285285

286286
//! Construct a MapItem from a key and a value
287287
/*! @internal */
288-
MapItem( Key && key, Value && value ) : key(const_cast<KeyType>(key)), value(const_cast<ValueType>(value)) {}
288+
MapItem( Key && key_, Value && value_ ) : key(const_cast<KeyType>(key_)), value(const_cast<ValueType>(value_)) {}
289289

290290
KeyType key;
291291
ValueType value;

0 commit comments

Comments
 (0)