Skip to content

Commit

Permalink
Different approach at silencing MSVC warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
d-frey committed Oct 13, 2018
1 parent ff6ed6c commit 3ca74a5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
9 changes: 7 additions & 2 deletions include/tao/pegtl/internal/apply.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#include "apply_single.hpp"
#include "skip_control.hpp"

#ifdef _MSC_VER
#include "silence.hpp"
#endif

#include "../analysis/counted.hpp"
#include "../apply_mode.hpp"
#include "../rewind_mode.hpp"
Expand Down Expand Up @@ -38,8 +42,9 @@ namespace tao
return ( apply_single< Actions >::match( i2, st... ) && ... );
}
else {
(void)in;
(void)( (void)st, ... );
#ifdef _MSC_VER
silence( in, st... );
#endif
return true;
}
}
Expand Down
8 changes: 7 additions & 1 deletion include/tao/pegtl/internal/apply0.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#include "apply0_single.hpp"
#include "skip_control.hpp"

#ifdef _MSC_VER
#include "silence.hpp"
#endif

#include "../analysis/counted.hpp"
#include "../apply_mode.hpp"
#include "../rewind_mode.hpp"
Expand Down Expand Up @@ -36,7 +40,9 @@ namespace tao
return ( apply0_single< Actions >::match( st... ) && ... );
}
else {
(void)( (void)st, ... );
#ifdef _MSC_VER
silence( st... );
#endif
return true;
}
}
Expand Down
26 changes: 26 additions & 0 deletions include/tao/pegtl/internal/silence.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/

#ifndef TAO_PEGTL_INTERNAL_SILENCE_HPP
#define TAO_PEGTL_INTERNAL_SILENCE_HPP

#include "../config.hpp"

namespace tao
{
namespace TAO_PEGTL_NAMESPACE
{
namespace internal
{
template< typename... Ts >
void silence( Ts&&... /*unused*/ ) noexcept
{
}

} // namespace internal

} // namespace TAO_PEGTL_NAMESPACE

} // namespace tao

#endif

0 comments on commit 3ca74a5

Please sign in to comment.