Skip to content

Commit 80c895d

Browse files
GTValentinejpetso
authored andcommitted
Deleted unused parameters (#47)
Added /W4 option for MSVC, cleaned up some warnings.
1 parent 01d3b7a commit 80c895d

File tree

11 files changed

+16
-16
lines changed

11 files changed

+16
-16
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (MSVC)
1919
# MSVC will respect CMAKE_CXX_STANDARD for CMake >= 3.10 and MSVC >= 19.0.24215
2020
# (VS 2017 15.3). Older versions will use the compiler default, which should be
2121
# fine for anything except ancient MSVC versions.
22-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
22+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
2323
else()
2424
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
2525

cppcodec/base32_crockford.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class base32_crockford_base
6363

6464
static CPPCODEC_ALWAYS_INLINE constexpr bool generates_padding() { return false; }
6565
static CPPCODEC_ALWAYS_INLINE constexpr bool requires_padding() { return false; }
66-
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char c) { return false; }
66+
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char /*c*/) { return false; }
6767
static CPPCODEC_ALWAYS_INLINE constexpr bool is_eof_symbol(char c) { return c == '\0'; }
6868

6969
static CPPCODEC_ALWAYS_INLINE constexpr bool should_ignore(char c) {

cppcodec/data/access.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ CPPCODEC_ALWAYS_INLINE size_t size(const T& t) { return t.size(); }
4949

5050
template <typename T, size_t N>
5151
CPPCODEC_ALWAYS_INLINE constexpr size_t size(const T (&t)[N]) noexcept {
52-
return N * sizeof(t[0]);
52+
return (void)t, N * sizeof(t[0]);
5353
}
5454

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

@@ -161,7 +161,7 @@ class direct_data_access_result_state
161161
// Conditional code paths are slow so we only do it once, at the start.
162162
m_buffer = result.data();
163163
}
164-
CPPCODEC_ALWAYS_INLINE void put(Result& result, char c)
164+
CPPCODEC_ALWAYS_INLINE void put(Result& /*result*/, char c)
165165
{
166166
m_buffer[m_offset++] = c;
167167
}
@@ -231,7 +231,7 @@ CPPCODEC_ALWAYS_INLINE void finish(Result& result, direct_data_access_result_sta
231231
template <typename T>
232232
constexpr auto array_access_is_mutable(T* t) -> decltype((*t)[size_t(0)] = 'x', bool())
233233
{
234-
return true;
234+
return (void)t, true;
235235
}
236236
constexpr bool array_access_is_mutable(...) { return false; }
237237

cppcodec/detail/base32.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class base32 : public CodecVariant::template codec_impl<base32<CodecVariant>>
9292
template <uint8_t I>
9393
static CPPCODEC_ALWAYS_INLINE
9494
uint8_if<I != 1 && I != 3 && I != 4 && I != 6> index_last(
95-
const uint8_t* b /*binary block*/)
95+
const uint8_t* /*binary block*/)
9696
{
9797
throw std::domain_error("invalid last encoding symbol index in a tail");
9898
}

cppcodec/detail/base64.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class base64 : public CodecVariant::template codec_impl<base64<CodecVariant>>
8080

8181
template <uint8_t I>
8282
static CPPCODEC_ALWAYS_INLINE uint8_if<I != 1 && I != 2> index_last(
83-
const uint8_t* b /*binary block*/)
83+
const uint8_t* /*binary block*/)
8484
{
8585
throw std::domain_error("invalid last encoding symbol index in a tail");
8686
}

cppcodec/detail/hex.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ class hex : public CodecVariant::template codec_impl<hex<CodecVariant>>
6868

6969
template <uint8_t I>
7070
static CPPCODEC_ALWAYS_INLINE constexpr uint8_if<I == 0> index_last(
71-
const uint8_t* b /*binary block*/) noexcept
71+
const uint8_t* /*binary block*/) noexcept
7272
{
7373
return 0;
7474
}
7575

7676
template <uint8_t I>
7777
static CPPCODEC_ALWAYS_INLINE uint8_if<I != 0> index_last(
78-
const uint8_t* b /*binary block*/)
78+
const uint8_t* /*binary block*/)
7979
{
8080
throw std::domain_error("invalid last encoding symbol index in a tail");
8181
}

cppcodec/detail/stream_codec.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ struct index_if_in_alphabet {
203203
};
204204
template <typename CodecVariant, alphabet_index_t InvalidIdx>
205205
struct index_if_in_alphabet<CodecVariant, InvalidIdx, 0> { // terminating specialization
206-
static CPPCODEC_ALWAYS_INLINE constexpr alphabet_index_t for_symbol(char symbol)
206+
static CPPCODEC_ALWAYS_INLINE constexpr alphabet_index_t for_symbol(char /*symbol*/)
207207
{
208208
return InvalidIdx;
209209
}
@@ -241,7 +241,7 @@ struct alphabet_index_info
241241
static constexpr const alphabet_index_t padding_idx = 1 << 8;
242242
static constexpr const alphabet_index_t invalid_idx = 1 << 9;
243243
static constexpr const alphabet_index_t eof_idx = 1 << 10;
244-
static constexpr const alphabet_index_t stop_character_mask = ~0xFF;
244+
static constexpr const alphabet_index_t stop_character_mask = 0xFF00;
245245

246246
static constexpr const bool padding_allowed = padding_searcher<
247247
CodecVariant, num_possible_symbols>::exists_padding_symbol();

cppcodec/hex_lower.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class hex_lower
5959
static CPPCODEC_ALWAYS_INLINE constexpr bool generates_padding() { return false; }
6060
// FIXME: doesn't require padding, but requires a multiple of the encoded block size (2)
6161
static CPPCODEC_ALWAYS_INLINE constexpr bool requires_padding() { return false; }
62-
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char c) { return false; }
62+
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char /*c*/) { return false; }
6363
static CPPCODEC_ALWAYS_INLINE constexpr bool is_eof_symbol(char c) { return c == '\0'; }
6464

6565
// Sometimes hex strings include whitespace, but this variant forbids it.

cppcodec/hex_upper.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class hex_upper
5959
static CPPCODEC_ALWAYS_INLINE constexpr bool generates_padding() { return false; }
6060
// FIXME: doesn't require padding, but requires a multiple of the encoded block size (2)
6161
static CPPCODEC_ALWAYS_INLINE constexpr bool requires_padding() { return false; }
62-
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char c) { return false; }
62+
static CPPCODEC_ALWAYS_INLINE constexpr bool is_padding_symbol(char /*c*/) { return false; }
6363
static CPPCODEC_ALWAYS_INLINE constexpr bool is_eof_symbol(char c) { return c == '\0'; }
6464

6565
// Sometimes hex strings include whitespace, but this variant forbids it.

test/benchmark_cppcodec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void benchmark(std::ostream& stream, const std::vector<size_t>& decoded_sizes)
153153
stream.flags(flags);
154154
}
155155

156-
int main(int argc, char *argv[])
156+
int main()
157157
{
158158
std::vector<size_t> decoded_sizes = {
159159
1, 4, 8, 16, 32, 64, 128, 256, 2048, 4096, 32768

0 commit comments

Comments
 (0)