Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silencing compilation warnings #29

Open
kedestin opened this issue Jan 10, 2019 · 1 comment
Open

Silencing compilation warnings #29

kedestin opened this issue Jan 10, 2019 · 1 comment

Comments

@kedestin
Copy link

Hey, thanks for the the great library.

Compiling the with -Wall -Wextra -Wpedantic -Wshadow shows the following warnings

tinyply/source/tinyply.h:77:29: warning: declaration shadows a field of 'tinyply::Buffer' [-Wshadow]
        Buffer(const size_t size) : data(new uint8_t[size], delete_array()), size(size) { alias = data.get(); } // allocating
                            ^
tinyply/source/tinyply.h:74:16: note: previous declaration is here
        size_t size;
               ^
tinyply/source/tinyply.h:393:78: warning: unused parameter 'is' [-Wunused-parameter]
void PlyFile::PlyFileImpl::read_header_text(std::string line, std::istream & is, std::vector<std::string>& place, int erase)
                                                                             ^
tinyply/source/tinyply.h:417:64: warning: unused parameter 't' [-Wunused-parameter]
size_t PlyFile::PlyFileImpl::read_property_binary(const Type & t, const size_t & stride, void * dest, size_t & destOffset, std::istream & is)
                                                               ^
tinyply/source/tinyply.h:460:55: warning: unused parameter 't' [-Wunused-parameter]
void PlyFile::PlyFileImpl::write_property_binary(Type t, std::ostream & os, uint8_t * src, size_t & srcOffset, const size_t & stride)
                                                      ^
tinyply/source/tinyply.h:473:17: warning: unused variable 'b' [-Wunused-variable]
    for (auto & b : buffers) for (auto & entry : userData) list_hints += entry.second.list_size_hint;
                ^
tinyply/source/tinyply.h:600:39: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
                    for (int j = 0; j < p.listCount; ++j)
                                    ~ ^ ~~~~~~~~~~~
tinyply/source/tinyply.h:691:101: warning: adding 'uint32_t' (aka 'unsigned int') to a string does not append to the string [-Wstring-plus-int]
                    throw std::invalid_argument("element-property key has already been requested: " + hash_fnv1a(element.name + property.name));
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tinyply/source/tinyply.h:691:101: note: use array indexing to silence this warning
                    throw std::invalid_argument("element-property key has already been requested: " + hash_fnv1a(element.name + property.name));
                                                                                                    ^
                                                &                                                   [                                         ]
tinyply/source/tinyply.h:767:21: warning: 5 enumeration values not handled in switch: 'INVALID', 'INT8', 'UINT8'... [-Wswitch]
            switch (t)
                    ^

Would it be possible to remedy these?

@EgeCiklabakkal
Copy link

Hello,

In my case, these warnings were caused by #include "tinyply.h" line in tinyply.cpp

I wrapped the following onto that line and no longer getting the warnings. I believe this can be used as a temporary solution.

#pragma GCC diagnostic push 
#pragma GCC diagnostic ignored "-Wswitch"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "tinyply.h"
#pragma GCC diagnostic pop

@kedestin kedestin reopened this Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants