Skip to content

Commit

Permalink
Deleted unused parameters (tplgy#47)
Browse files Browse the repository at this point in the history
Added /W4 option for MSVC, cleaned up some warnings.
  • Loading branch information
GTValentine authored and jpetso committed Jul 16, 2018
1 parent 01d3b7a commit 80c895d
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (MSVC)
# MSVC will respect CMAKE_CXX_STANDARD for CMake >= 3.10 and MSVC >= 19.0.24215
# (VS 2017 15.3). Older versions will use the compiler default, which should be
# fine for anything except ancient MSVC versions.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")

Expand Down
2 changes: 1 addition & 1 deletion cppcodec/base32_crockford.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class base32_crockford_base

static CPPCODEC_ALWAYS_INLINE constexpr bool generates_padding() { return false; }
static CPPCODEC_ALWAYS_INLINE constexpr bool requires_padding() { return false; }
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char c) { return false; }
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char /*c*/) { return false; }
static CPPCODEC_ALWAYS_INLINE constexpr bool is_eof_symbol(char c) { return c == '\0'; }

static CPPCODEC_ALWAYS_INLINE constexpr bool should_ignore(char c) {
Expand Down
8 changes: 4 additions & 4 deletions cppcodec/data/access.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CPPCODEC_ALWAYS_INLINE size_t size(const T& t) { return t.size(); }

template <typename T, size_t N>
CPPCODEC_ALWAYS_INLINE constexpr size_t size(const T (&t)[N]) noexcept {
return N * sizeof(t[0]);
return (void)t, N * sizeof(t[0]);
}

class general_t {};
Expand Down Expand Up @@ -137,7 +137,7 @@ CPPCODEC_ALWAYS_INLINE void put(Result& result, empty_result_state&, uint8_t c)
template <typename T>
constexpr auto data_is_mutable(T* t) -> decltype(t->data()[size_t(0)] = 'x', bool())
{
return true;
return (void)t, true;
}
constexpr bool data_is_mutable(...) { return false; }

Expand All @@ -161,7 +161,7 @@ class direct_data_access_result_state
// Conditional code paths are slow so we only do it once, at the start.
m_buffer = result.data();
}
CPPCODEC_ALWAYS_INLINE void put(Result& result, char c)
CPPCODEC_ALWAYS_INLINE void put(Result& /*result*/, char c)
{
m_buffer[m_offset++] = c;
}
Expand Down Expand Up @@ -231,7 +231,7 @@ CPPCODEC_ALWAYS_INLINE void finish(Result& result, direct_data_access_result_sta
template <typename T>
constexpr auto array_access_is_mutable(T* t) -> decltype((*t)[size_t(0)] = 'x', bool())
{
return true;
return (void)t, true;
}
constexpr bool array_access_is_mutable(...) { return false; }

Expand Down
2 changes: 1 addition & 1 deletion cppcodec/detail/base32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class base32 : public CodecVariant::template codec_impl<base32<CodecVariant>>
template <uint8_t I>
static CPPCODEC_ALWAYS_INLINE
uint8_if<I != 1 && I != 3 && I != 4 && I != 6> index_last(
const uint8_t* b /*binary block*/)
const uint8_t* /*binary block*/)
{
throw std::domain_error("invalid last encoding symbol index in a tail");
}
Expand Down
2 changes: 1 addition & 1 deletion cppcodec/detail/base64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class base64 : public CodecVariant::template codec_impl<base64<CodecVariant>>

template <uint8_t I>
static CPPCODEC_ALWAYS_INLINE uint8_if<I != 1 && I != 2> index_last(
const uint8_t* b /*binary block*/)
const uint8_t* /*binary block*/)
{
throw std::domain_error("invalid last encoding symbol index in a tail");
}
Expand Down
4 changes: 2 additions & 2 deletions cppcodec/detail/hex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ class hex : public CodecVariant::template codec_impl<hex<CodecVariant>>

template <uint8_t I>
static CPPCODEC_ALWAYS_INLINE constexpr uint8_if<I == 0> index_last(
const uint8_t* b /*binary block*/) noexcept
const uint8_t* /*binary block*/) noexcept
{
return 0;
}

template <uint8_t I>
static CPPCODEC_ALWAYS_INLINE uint8_if<I != 0> index_last(
const uint8_t* b /*binary block*/)
const uint8_t* /*binary block*/)
{
throw std::domain_error("invalid last encoding symbol index in a tail");
}
Expand Down
4 changes: 2 additions & 2 deletions cppcodec/detail/stream_codec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ struct index_if_in_alphabet {
};
template <typename CodecVariant, alphabet_index_t InvalidIdx>
struct index_if_in_alphabet<CodecVariant, InvalidIdx, 0> { // terminating specialization
static CPPCODEC_ALWAYS_INLINE constexpr alphabet_index_t for_symbol(char symbol)
static CPPCODEC_ALWAYS_INLINE constexpr alphabet_index_t for_symbol(char /*symbol*/)
{
return InvalidIdx;
}
Expand Down Expand Up @@ -241,7 +241,7 @@ struct alphabet_index_info
static constexpr const alphabet_index_t padding_idx = 1 << 8;
static constexpr const alphabet_index_t invalid_idx = 1 << 9;
static constexpr const alphabet_index_t eof_idx = 1 << 10;
static constexpr const alphabet_index_t stop_character_mask = ~0xFF;
static constexpr const alphabet_index_t stop_character_mask = 0xFF00;

static constexpr const bool padding_allowed = padding_searcher<
CodecVariant, num_possible_symbols>::exists_padding_symbol();
Expand Down
2 changes: 1 addition & 1 deletion cppcodec/hex_lower.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class hex_lower
static CPPCODEC_ALWAYS_INLINE constexpr bool generates_padding() { return false; }
// FIXME: doesn't require padding, but requires a multiple of the encoded block size (2)
static CPPCODEC_ALWAYS_INLINE constexpr bool requires_padding() { return false; }
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char c) { return false; }
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char /*c*/) { return false; }
static CPPCODEC_ALWAYS_INLINE constexpr bool is_eof_symbol(char c) { return c == '\0'; }

// Sometimes hex strings include whitespace, but this variant forbids it.
Expand Down
2 changes: 1 addition & 1 deletion cppcodec/hex_upper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class hex_upper
static CPPCODEC_ALWAYS_INLINE constexpr bool generates_padding() { return false; }
// FIXME: doesn't require padding, but requires a multiple of the encoded block size (2)
static CPPCODEC_ALWAYS_INLINE constexpr bool requires_padding() { return false; }
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char c) { return false; }
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char /*c*/) { return false; }
static CPPCODEC_ALWAYS_INLINE constexpr bool is_eof_symbol(char c) { return c == '\0'; }

// Sometimes hex strings include whitespace, but this variant forbids it.
Expand Down
2 changes: 1 addition & 1 deletion test/benchmark_cppcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void benchmark(std::ostream& stream, const std::vector<size_t>& decoded_sizes)
stream.flags(flags);
}

int main(int argc, char *argv[])
int main()
{
std::vector<size_t> decoded_sizes = {
1, 4, 8, 16, 32, 64, 128, 256, 2048, 4096, 32768
Expand Down
2 changes: 1 addition & 1 deletion test/minimal_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <cppcodec/base64_rfc4648.hpp>
#include <iostream>

int main(int argc, char *argv[])
int main()
{
constexpr const char encoded[] = { "YW55IGNhcm5hbCBwbGVhc3U=" };
char decoded[cppcodec::base64_rfc4648::decoded_max_size(sizeof(encoded))];
Expand Down

0 comments on commit 80c895d

Please sign in to comment.