Skip to content

Commit

Permalink
Merge pull request #30 from samhocevar/fix-shadow-warnings
Browse files Browse the repository at this point in the history
Add -Wshadow to default compilation flags and fix a few occurrences.
  • Loading branch information
d-frey authored Aug 11, 2016
2 parents 7377f63 + 927e327 commit e7752e8
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif
# changed if desired.

PEGTL_CPPFLAGS ?= -pedantic
PEGTL_CXXFLAGS ?= -Wall -Wextra -Werror -O3 $(MINGW_CXXFLAGS)
PEGTL_CXXFLAGS ?= -Wall -Wextra -Werror -Wshadow -O3 $(MINGW_CXXFLAGS)

.PHONY: all clean

Expand Down
8 changes: 4 additions & 4 deletions examples/json_build_one.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ namespace examples
result.reset();
}

void success( result_state & result )
void success( result_state & in_result )
{
if ( this->result ) {
push_back();
}
result.result = array;
in_result.result = array;
}
};

Expand Down Expand Up @@ -127,12 +127,12 @@ namespace examples
result.reset();
}

void success( result_state & result )
void success( result_state & in_result )
{
if ( this->result ) {
insert();
}
result.result = object;
in_result.result = object;
}
};

Expand Down
16 changes: 8 additions & 8 deletions examples/json_classes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace examples

protected:
explicit
json_base( const json_type type )
: type( type )
json_base( const json_type in_type )
: type( in_type )
{ }

~json_base()
Expand Down Expand Up @@ -77,9 +77,9 @@ namespace examples
: public json_base
{
explicit
boolean_json( const bool data)
boolean_json( const bool in_data)
: json_base( json_type::BOOLEAN ),
data( data )
data( in_data )
{ }

bool data;
Expand Down Expand Up @@ -107,9 +107,9 @@ namespace examples
: public json_base
{
explicit
number_json( const long double data )
number_json( const long double in_data )
: json_base( json_type::NUMBER ),
data( data )
data( in_data )
{ }

long double data;
Expand Down Expand Up @@ -172,9 +172,9 @@ namespace examples
: public json_base
{
explicit
string_json( const std::string & data )
string_json( const std::string & in_data )
: json_base( json_type::STRING ),
data( data )
data( in_data )
{ }

std::string data;
Expand Down
4 changes: 2 additions & 2 deletions pegtl/action_input.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace pegtl
class action_input
{
public:
action_input( const std::size_t line, const std::size_t byte_in_line, const char * begin, const char * end, const char * source )
: m_data( line, byte_in_line, begin, end, source )
action_input( const std::size_t in_line, const std::size_t in_byte_in_line, const char * in_begin, const char * in_end, const char * in_source )
: m_data( in_line, in_byte_in_line, in_begin, in_end, in_source )
{ }

bool empty() const
Expand Down
4 changes: 2 additions & 2 deletions pegtl/analysis/rule_info.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ namespace pegtl
struct rule_info
{
explicit
rule_info( const rule_type type )
: type( type )
rule_info( const rule_type in_type )
: type( in_type )
{ }

rule_type type;
Expand Down
4 changes: 2 additions & 2 deletions pegtl/buffer_input.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ namespace pegtl
{
public:
template< typename ... As >
buffer_input( const char * source, const std::size_t maximum, As && ... as )
buffer_input( const char * in_source, const std::size_t maximum, As && ... as )
: m_reader( std::forward< As >( as ) ... ),
m_maximum( maximum ),
m_buffer( new char[ maximum ] ),
m_data( 1, 0, m_buffer.get(), m_buffer.get(), source )
m_data( 1, 0, m_buffer.get(), m_buffer.get(), in_source )

{ }

Expand Down
4 changes: 2 additions & 2 deletions pegtl/input_error.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ namespace pegtl
struct input_error
: std::runtime_error
{
input_error( const std::string & message, const int errorno )
input_error( const std::string & message, const int in_errorno )
: std::runtime_error( message ),
errorno( errorno )
errorno( in_errorno )
{ }

int errorno;
Expand Down
12 changes: 6 additions & 6 deletions pegtl/internal/input_data.hh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ namespace pegtl
{
struct input_data
{
input_data( const std::size_t line, const std::size_t byte_in_line, const char * begin, const char * end, const char * source )
: line( line ),
byte_in_line( byte_in_line ),
begin( begin ),
end( end ),
source( source )
input_data( const std::size_t in_line, const std::size_t in_byte_in_line, const char * in_begin, const char * in_end, const char * in_source )
: line( in_line ),
byte_in_line( in_byte_in_line ),
begin( in_begin ),
end( in_end ),
source( in_source )
{ }

std::size_t line;
Expand Down
4 changes: 2 additions & 2 deletions pegtl/memory_input.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ namespace pegtl
: m_data( data )
{ }

memory_input( const std::size_t line, const std::size_t byte_in_line, const char * begin, const char * end, const char * source )
: m_data( line, byte_in_line, begin, end, source )
memory_input( const std::size_t in_line, const std::size_t in_byte_in_line, const char * in_begin, const char * in_end, const char * in_source )
: m_data( in_line, in_byte_in_line, in_begin, in_end, in_source )
{ }

bool empty() const
Expand Down
4 changes: 2 additions & 2 deletions pegtl/parse_error.hh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ namespace pegtl
struct parse_error
: public std::runtime_error
{
parse_error( const std::string & message, std::vector< position_info > && positions )
parse_error( const std::string & message, std::vector< position_info > && in_positions )
: std::runtime_error( message ),
positions( std::move( positions ) )
positions( std::move( in_positions ) )
{ }

template< typename Input >
Expand Down
4 changes: 2 additions & 2 deletions pegtl/string_parser.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ namespace pegtl
class string_parser
{
public:
string_parser( std::string data, std::string source, const std::size_t line = 1, const std::size_t byte_in_line = 0 )
string_parser( std::string data, std::string in_source, const std::size_t line = 1, const std::size_t byte_in_line = 0 )
: m_data( std::move( data ) ),
m_source( std::move( source ) ),
m_source( std::move( in_source ) ),
m_input( line, byte_in_line, m_data.data(), m_data.data() + m_data.size(), m_source.c_str() )
{ }

Expand Down

0 comments on commit e7752e8

Please sign in to comment.