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

Wpotentially-evaluated-expression raised on clang-3.6 #2

Closed
tomhenderson opened this issue Oct 7, 2015 · 2 comments
Closed

Wpotentially-evaluated-expression raised on clang-3.6 #2

tomhenderson opened this issue Oct 7, 2015 · 2 comments

Comments

@tomhenderson
Copy link
Contributor

on Xcode 7 or clang-3.6, ns-3 bindings generated by pybindgen raise many warnings such as below for potentially evaluated expression in the argument:

src/topology-read/bindings/ns3module.cc:1482:16: error: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Werror,-Wpotentially-evaluated-expression]
if (typeid((*const_cast<ns3::Node *> (ns3::PeekPointer (retval)))).name() == typeid(PyNs3Node__PythonHelper).name())

To reproduce, check out ns-3.24 release (not ns-3.24.1) and compile with python bindings enabled on either clang-3.6 or Xcode 7.0 machine (may have to disable Werror).

We are suppressing this for now in the wscript, but I wonder if an upstream fix is possible to move the possibly side-effect-inducing expression out of the argument.

@gjcarneiro
Copy link
Owner

Hm, I wonder which "side effects" the compiler means. I am not aware of any side effects here... AFAIK, (*const_cast (ns3::PeekPointer (retval))) has no side effects, but I'd have to check more closely...

template <typename U>
U * PeekPointer (const Ptr<U> &p)
{
  return p.m_ptr;
}

@gjcarneiro
Copy link
Owner

I can't figure this one out. Tried adding __attribute__ ((pure, const)) to the PeekPointer definition, clang still complains. I am writing this off as a clang bug. Not fixing pybindgen.

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