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

Fix various warnings #1832

Merged
merged 5 commits into from
Nov 5, 2019
Merged

Fix various warnings #1832

merged 5 commits into from
Nov 5, 2019

Conversation

ZedThree
Copy link
Member

@ZedThree ZedThree commented Nov 4, 2019

Fixes the following warnings on gcc:

  • overloaded-virtual
  • old-style-cast
  • non-virtual-dtor
  • pedantic

There are >300 warnings from our use of int instead of size_t in lots of places. I'm not a huge fan of unsigned types, but seeing as the standard library does use them, we might be better off switching to use them. There's probably a few places where it's not as simple as just changing the type, and we'd have to make other changes, but the majority of places are likely fine.

Likely not a real problem: the issue is if someone uses the derived
class concretely (i.e. _not_ through a pointer to the base class),
then some of the overloads of virtual methods may be hidden.
Note about reinterpret_cast: there are three different situations here
that require reinterpret_cast over static_cast:

- cast to void**: this is solely for context objects that PETSc stores
  but does not touch, so completely fine (assuming we're consistent
  ourselves)
- function pointer cast: this is required because PETSc deliberately
  takes the _wrong_ function signature for reasons?! This is fine
  assuming the actual function signature matches how PETSc calls the
  function
- cast to PetscObject: this is because PETSc has reinvented C++ in C,
  and this is essentially a cast to base-class pointer. This is fine
  assuming we pass something that has a PetscObject as its first
  member -- read the documentation or source code to find out!
Should deprecate and remove this function!
@ZedThree ZedThree merged commit 9e50240 into next Nov 5, 2019
@ZedThree ZedThree deleted the v43-warning-fixes branch November 5, 2019 11:29
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