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

app-shells/squirrelsh: Fix building with GCC-6 #4693

Closed
wants to merge 1 commit into from

Conversation

Peter-Levine
Copy link
Contributor

Bug: https://bugs.gentoo.org/show_bug.cgi?id=594466
Package-Manager: Portage-2.3.5, Repoman-2.3.2

Upstream ticket with patch info: https://sourceforge.net/p/squirrelsh/bugs/6/

@gentoo-repo-qa-bot gentoo-repo-qa-bot added the assigned PR successfully assigned to the package maintainer(s). label May 21, 2017
@gentoo-repo-qa-bot
Copy link
Collaborator

Pull Request assignment

Areas affected: ebuilds
Packages affected: app-shells/squirrelsh

app-shells/squirrelsh: @blueness

#include <string.h>
#include <string>

+#include "common.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from your report, would it be possible to fix this properly once and for all? I never use math.h in C++, use fully qualified std::min and std::max everywhere? don't see this as a requirement, it would just be a nice thing for the ecosystem, as it would make the codebase more robust, and less flaky.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally try to keep my patches to a minimum to enable the code's original pre-GCC6 intent without necessarily using more proper code constructs that may have more wide-ranging consequences throughout.

In the case of app-shells/squirrelsh, there exists in ${S}/common.h:

#if !defined(min)
#	define min(a, b) ((a) < (b) ? (a) : (b))
#endif

This macro name forcibly hides all overloaded declarations of std::min (such as std::min(const T& a, const T& b, Compare comp)). Specifically, the problem happens because there is a call to std::min(const T& a, const T& b, Compare comp) in /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/include/g++-v6/bits/stl_algobase.h and that declaration has been hidden by the presence of a macro with the same name.

However, testing what would happen if I were to change that code in ${S}/common.h to:

#include <algorithm>
using std::min;

I get errors like:

hash_adler32.cpp:90:50: error: no matching function for call to 'min(SQInteger&, int)'
   size_t r = fread(block, 1, min(left, BLOCK_SIZE), file);
                                                  ^

because std::min places more stringent demands on its arguments (such as requiring them to be the exact same type). It would require explicit casts in more files. At that point, I'd prefer to let upstream decide how to deal with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from your report, would it be possible to fix this properly once and for all?

@SoapGentoo Upstream did the work and fixed this for good.. Pushed a new patch based on https://sourceforge.net/p/squirrelsh/git/ci/13280cdf34d96216b4d10b9ea7656a42a967fc2b/

@Peter-Levine Peter-Levine deleted the bug-594466 branch May 26, 2017 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned PR successfully assigned to the package maintainer(s).
Projects
None yet
3 participants