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

DM-10281: compiler warnings in astshim #15

Merged
merged 4 commits into from May 18, 2017
Merged

DM-10281: compiler warnings in astshim #15

merged 4 commits into from May 18, 2017

Conversation

r-owen
Copy link
Contributor

@r-owen r-owen commented May 18, 2017

No description provided.

@@ -1125,7 +1125,7 @@ class Frame : public Mapping {
axis order for output data).
*/
void permAxes(std::vector<int> perm) {
detail::assertEqual(static_cast<int>(perm.size()), "perm.size()", getNaxes(), "naxes");
detail::assertEqual(perm.size(), "perm.size()", static_cast<std::size_t>(getNaxes()), "naxes");
Copy link
Member

Choose a reason for hiding this comment

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

why is getNaxes() returning an int?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because AST itself uses an int (it has astGetI but not an unsigned variant). I consider unsigned ints a bit of a nuisance -- important if very large positive values are expected, but otherwise rarely worth the hassle. Note that much of the DM stack works the same way; for example Box.getArea, getWidth and getHeight all return int, despite the fact that they are never negative.

Fix gcc warnings: format not a string literal and no format arguments
in calls to AST functions by specifying the format argument as `"%s"`
and the data as `options.c_str()` (with thanks to Tim Jenness).
In some places assertEqual was called with (size_t, int)
which led to compiler warnings. Fix those with
static_cast<std::size_t> of the int argument.
In one case the size_t argument was cast to int instead,
but I changed it to match the rest of the code.
The previous two changes made some lines longer
so reformat all C++ code with clang-format.
@r-owen r-owen merged commit 099c320 into master May 18, 2017
@ktlim ktlim deleted the tickets/DM-10281 branch August 25, 2018 04:28
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

Successfully merging this pull request may close these issues.

None yet

2 participants