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

Master branch does not compile #3592

Closed
smurfix opened this issue Feb 1, 2020 · 2 comments
Closed

Master branch does not compile #3592

smurfix opened this issue Feb 1, 2020 · 2 comments

Comments

@smurfix
Copy link
Contributor

smurfix commented Feb 1, 2020

/src/PrusaSlicer/src/libslic3r/libslic3r.h:239:27: error: format not a string literal and no format arguments [-Werror=format-security]
     int bufflen = snprintf(buffer.data(), INITIAL_LEN - 1, fmt, std::forward<Args>(args)...);
                   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/src/PrusaSlicer/src/libslic3r/libslic3r.h:243:17: error: format not a string literal and no format arguments [-Werror=format-security]
         snprintf(buffer.data(), buffer.size(), fmt, std::forward<Args>(args)...);
         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@vintagepc
Copy link

make sure you're using a recent compiler, e.g. gcc-7. There is syntax in the code that isn't supported in gcc-4

@smurfix
Copy link
Contributor Author

smurfix commented Feb 1, 2020

That's not the problem, I'm using gcc 8.3. The problem is that (a) this function is duplicate anyway, (b) there's no way to tell gcc's C++ that the third argument is the variadic part of snprintf.

I'm preparing a patch.

smurfix added a commit to smurfix/PrusaSlicer that referenced this issue Feb 1, 2020
The templated version doesn't work with gcc's -Werror=format-security

Long-term, we should use fmt::format (c++11) or std::string::format (c++20).

Closes:prusa3d#3592.
tamasmeszaros added a commit that referenced this issue Feb 3, 2020
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

3 participants