Merge pull request #488 from jpcima/eliminate-warnings
Eliminate warnings
This commit is contained in:
commit
3d8fc0c787
8 changed files with 47 additions and 92 deletions
|
|
@ -57,6 +57,7 @@ endif()
|
|||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
add_compile_options(-Wall)
|
||||
add_compile_options(-Wextra)
|
||||
add_compile_options(-Wno-multichar)
|
||||
add_compile_options(-Werror=return-type)
|
||||
if (SFIZZ_SYSTEM_PROCESSOR MATCHES "^(i.86|x86_64)$")
|
||||
add_compile_options(-msse2)
|
||||
|
|
|
|||
2
editor/external/vstgui4
vendored
2
editor/external/vstgui4
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit a8a546b89ebef7e263125b2f5859a3a365884cc6
|
||||
Subproject commit dbb9a42742eb42826f2fe15bd047bae0adb13b58
|
||||
|
|
@ -590,7 +590,7 @@ void Editor::Impl::createFrameContents()
|
|||
for (int log2value = 10; log2value <= 16; ++log2value) {
|
||||
int value = 1 << log2value;
|
||||
char text[256];
|
||||
sprintf(text, "%lu kB", value / 1024 * sizeof(float));
|
||||
sprintf(text, "%lu kB", static_cast<unsigned long>(value / 1024 * sizeof(float)));
|
||||
text[sizeof(text) - 1] = '\0';
|
||||
preloadSizeSlider_->addEntry(text, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,67 +86,6 @@ static int consume_real_token(TokenList::iterator &tok_it, TokenList::iterator t
|
|||
return std::stod(text);
|
||||
}
|
||||
|
||||
static void consume_image_properties(LayoutImage &image, TokenList::iterator &tok_it, TokenList::iterator tok_end)
|
||||
{
|
||||
for (bool have = true; have;) {
|
||||
if (try_consume_next_token("xywh", tok_it, tok_end)) {
|
||||
ensure_next_token("{", tok_it, tok_end);
|
||||
image.x = consume_int_token(tok_it, tok_end);
|
||||
image.y = consume_int_token(tok_it, tok_end);
|
||||
image.w = consume_int_token(tok_it, tok_end);
|
||||
image.h = consume_int_token(tok_it, tok_end);
|
||||
ensure_next_token("}", tok_it, tok_end);
|
||||
}
|
||||
else
|
||||
have = false;
|
||||
}
|
||||
}
|
||||
|
||||
// static void consume_layout_item_properties(LayoutItem &item, TokenList::iterator &tok_it, TokenList::iterator tok_end)
|
||||
// {
|
||||
// ensure_next_token("{", tok_it, tok_end);
|
||||
// for (std::string text; (text = consume_next_token(tok_it, tok_end)) != "}";) {
|
||||
// if (text == "open" || text == "selected")
|
||||
// ; // skip
|
||||
// else if (text == "label")
|
||||
// item.label = consume_any_string(tok_it, tok_end);
|
||||
// else if (text == "xywh") {
|
||||
// ensure_next_token("{", tok_it, tok_end);
|
||||
// item.x = consume_int_token(tok_it, tok_end);
|
||||
// item.y = consume_int_token(tok_it, tok_end);
|
||||
// item.w = consume_int_token(tok_it, tok_end);
|
||||
// item.h = consume_int_token(tok_it, tok_end);
|
||||
// ensure_next_token("}", tok_it, tok_end);
|
||||
// }
|
||||
// else if (text == "box")
|
||||
// item.box = consume_next_token(tok_it, tok_end);
|
||||
// else if (text == "labelfont")
|
||||
// item.labelfont = consume_int_token(tok_it, tok_end);
|
||||
// else if (text == "labelsize")
|
||||
// item.labelsize = consume_int_token(tok_it, tok_end);
|
||||
// else if (text == "labeltype")
|
||||
// item.labeltype = consume_any_string(tok_it, tok_end);
|
||||
// else if (text == "align")
|
||||
// item.align = consume_int_token(tok_it, tok_end);
|
||||
// else if (text == "type")
|
||||
// item.type = consume_any_string(tok_it, tok_end);
|
||||
// else if (text == "callback")
|
||||
// item.callback = consume_any_string(tok_it, tok_end);
|
||||
// else if (text == "class")
|
||||
// item.classname = consume_any_string(tok_it, tok_end);
|
||||
// else if (text == "minimum")
|
||||
// item.minimum = consume_real_token(tok_it, tok_end);
|
||||
// else if (text == "maximum")
|
||||
// item.maximum = consume_real_token(tok_it, tok_end);
|
||||
// else if (text == "step")
|
||||
// item.step = consume_real_token(tok_it, tok_end);
|
||||
// else if (text == "image") {
|
||||
// item.image.filepath = consume_any_string(tok_it, tok_end);
|
||||
// consume_image_properties(item.image, tok_it, tok_end);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
static void consume_layout_item_properties(LayoutItem &item, TokenList::iterator &tok_it, TokenList::iterator tok_end)
|
||||
{
|
||||
ensure_next_token("{", tok_it, tok_end);
|
||||
|
|
|
|||
|
|
@ -122,13 +122,13 @@ lv2_atom_sequence_next(const LV2_Atom_Event* i)
|
|||
@endcode
|
||||
*/
|
||||
#define LV2_ATOM_SEQUENCE_FOREACH(seq, iter) \
|
||||
for (LV2_Atom_Event* (iter) = lv2_atom_sequence_begin(&(seq)->body); \
|
||||
for (LV2_Atom_Event* iter = lv2_atom_sequence_begin(&(seq)->body); \
|
||||
!lv2_atom_sequence_is_end(&(seq)->body, (seq)->atom.size, (iter)); \
|
||||
(iter) = lv2_atom_sequence_next(iter))
|
||||
|
||||
/** Like LV2_ATOM_SEQUENCE_FOREACH but for a headerless sequence body. */
|
||||
#define LV2_ATOM_SEQUENCE_BODY_FOREACH(body, size, iter) \
|
||||
for (LV2_Atom_Event* (iter) = lv2_atom_sequence_begin(body); \
|
||||
for (LV2_Atom_Event* iter = lv2_atom_sequence_begin(body); \
|
||||
!lv2_atom_sequence_is_end(body, size, (iter)); \
|
||||
(iter) = lv2_atom_sequence_next(iter))
|
||||
|
||||
|
|
@ -219,13 +219,13 @@ lv2_atom_tuple_next(const LV2_Atom* i)
|
|||
@endcode
|
||||
*/
|
||||
#define LV2_ATOM_TUPLE_FOREACH(tuple, iter) \
|
||||
for (LV2_Atom* (iter) = lv2_atom_tuple_begin(tuple); \
|
||||
for (LV2_Atom* iter = lv2_atom_tuple_begin(tuple); \
|
||||
!lv2_atom_tuple_is_end(LV2_ATOM_BODY(tuple), (tuple)->atom.size, (iter)); \
|
||||
(iter) = lv2_atom_tuple_next(iter))
|
||||
|
||||
/** Like LV2_ATOM_TUPLE_FOREACH but for a headerless tuple body. */
|
||||
#define LV2_ATOM_TUPLE_BODY_FOREACH(body, size, iter) \
|
||||
for (LV2_Atom* (iter) = (LV2_Atom*)(body); \
|
||||
for (LV2_Atom* iter = (LV2_Atom*)(body); \
|
||||
!lv2_atom_tuple_is_end(body, size, (iter)); \
|
||||
(iter) = lv2_atom_tuple_next(iter))
|
||||
|
||||
|
|
@ -275,13 +275,13 @@ lv2_atom_object_next(const LV2_Atom_Property_Body* i)
|
|||
@endcode
|
||||
*/
|
||||
#define LV2_ATOM_OBJECT_FOREACH(obj, iter) \
|
||||
for (LV2_Atom_Property_Body* (iter) = lv2_atom_object_begin(&(obj)->body); \
|
||||
for (LV2_Atom_Property_Body* iter = lv2_atom_object_begin(&(obj)->body); \
|
||||
!lv2_atom_object_is_end(&(obj)->body, (obj)->atom.size, (iter)); \
|
||||
(iter) = lv2_atom_object_next(iter))
|
||||
|
||||
/** Like LV2_ATOM_OBJECT_FOREACH but for a headerless object body. */
|
||||
#define LV2_ATOM_OBJECT_BODY_FOREACH(body, size, iter) \
|
||||
for (LV2_Atom_Property_Body* (iter) = lv2_atom_object_begin(body); \
|
||||
for (LV2_Atom_Property_Body* iter = lv2_atom_object_begin(body); \
|
||||
!lv2_atom_object_is_end(body, size, (iter)); \
|
||||
(iter) = lv2_atom_object_next(iter))
|
||||
|
||||
|
|
|
|||
|
|
@ -15,18 +15,26 @@ ModKey::Parameters::Parameters() noexcept
|
|||
// zero-fill the structure
|
||||
// 1. this ensures that non-used values will be always 0
|
||||
// 2. this makes the object memcmp-comparable
|
||||
std::memset(this, 0, sizeof(*this));
|
||||
std::memset(
|
||||
static_cast<RawParameters*>(this),
|
||||
0, sizeof(RawParameters));
|
||||
}
|
||||
|
||||
ModKey::Parameters::Parameters(const Parameters& other) noexcept
|
||||
{
|
||||
std::memcpy(this, &other, sizeof(*this));
|
||||
std::memcpy(
|
||||
static_cast<RawParameters*>(this),
|
||||
static_cast<const RawParameters*>(&other),
|
||||
sizeof(RawParameters));
|
||||
}
|
||||
|
||||
ModKey::Parameters& ModKey::Parameters::operator=(const Parameters& other) noexcept
|
||||
{
|
||||
if (this != &other)
|
||||
std::memcpy(this, &other, sizeof(*this));
|
||||
std::memcpy(
|
||||
static_cast<RawParameters*>(this),
|
||||
static_cast<const RawParameters*>(&other),
|
||||
sizeof(RawParameters));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,24 +42,7 @@ public:
|
|||
bool isTarget() const noexcept;
|
||||
std::string toString() const;
|
||||
|
||||
struct Parameters {
|
||||
Parameters() noexcept;
|
||||
Parameters(const Parameters& other) noexcept;
|
||||
Parameters& operator=(const Parameters& other) noexcept;
|
||||
|
||||
Parameters(Parameters&&) = delete;
|
||||
Parameters &operator=(Parameters&&) = delete;
|
||||
|
||||
bool operator==(const Parameters& other) const noexcept
|
||||
{
|
||||
return std::memcmp(this, &other, sizeof(*this)) == 0;
|
||||
}
|
||||
|
||||
bool operator!=(const Parameters& other) const noexcept
|
||||
{
|
||||
return std::memcmp(this, &other, sizeof(*this)) != 0;
|
||||
}
|
||||
|
||||
struct RawParameters {
|
||||
union {
|
||||
//! Parameters if this key identifies a CC source
|
||||
struct { uint16_t cc; uint8_t curve, smooth; float step; };
|
||||
|
|
@ -71,6 +54,28 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
struct Parameters : RawParameters {
|
||||
Parameters() noexcept;
|
||||
Parameters(const Parameters& other) noexcept;
|
||||
Parameters& operator=(const Parameters& other) noexcept;
|
||||
|
||||
Parameters(Parameters&&) = delete;
|
||||
Parameters &operator=(Parameters&&) = delete;
|
||||
|
||||
bool operator==(const Parameters& other) const noexcept
|
||||
{
|
||||
return std::memcmp(
|
||||
static_cast<const RawParameters*>(this),
|
||||
static_cast<const RawParameters*>(&other),
|
||||
sizeof(RawParameters)) == 0;
|
||||
}
|
||||
|
||||
bool operator!=(const Parameters& other) const noexcept
|
||||
{
|
||||
return !operator==(other);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
bool operator==(const ModKey &other) const noexcept
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,7 +108,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|||
"-Wno-unknown-pragmas"
|
||||
"-Wno-unused-function"
|
||||
"-Wno-unused-parameter"
|
||||
"-Wno-unused-variable")
|
||||
"-Wno-unused-variable"
|
||||
"-Wno-format")
|
||||
endif()
|
||||
|
||||
# To help debugging the link only
|
||||
|
|
@ -292,7 +293,8 @@ elseif(SFIZZ_AU)
|
|||
"-Wno-unknown-pragmas"
|
||||
"-Wno-unused-function"
|
||||
"-Wno-unused-parameter"
|
||||
"-Wno-unused-variable")
|
||||
"-Wno-unused-variable"
|
||||
"-Wno-format")
|
||||
endif()
|
||||
|
||||
# Installation
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue