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 most warnings in core_lib/structure from g++ #1107

Merged
merged 1 commit into from Oct 14, 2018

Conversation

Projects
None yet
2 participants
@scribblemaniac
Copy link
Member

scribblemaniac commented Oct 14, 2018

object.cpp:

  • remove unnecessary disconnects (automatically called in QObject destructor) [zero-as-null-pointer-constant]
  • change some c-style casts to static_cast [old-style-cast]

activeframepool.cpp/.h:

  • add empty virtual destructor [non-virtual-dtor]

scribblearea.cpp:

  • use QRectFs directly for selection corner drawing [float-conversion]

soundclip.cpp:

  • change some types [float-conversion]
  • add override to destructor [inconsistent-missing-destructor-override]

layercamera.cpp/.h:

  • change NULLs to nullptrs [zero-as-null-pointer-constant]
  • use qreal for loadImageAtFrame parameters [conversion,double-promotion]

camera.cpp/.h:

  • use qreal for rotation and scaling [conversion]
  • add override to destructor [inconsistent-missing-destructor-override]

keyframe.h:

  • remove semicolons after functions [extra-semi]

filemanager.cpp:

  • use static_cast for time_t -> uint conversion [shorten-64-to-32]
  • move strings to an anonymous namespace [missing-variable-declarations]
Fix most warnings in core_lib/structure from g++
object.cpp:
- remove unnecessary disconnects (automatically called in QObject destructor) [zero-as-null-pointer-constant]
- change some c-style casts to static_cast [old-style-cast]

activeframepool.cpp/.h:
- add empty virtual destructor [non-virtual-dtor]

scribblearea.cpp:
- use QRectFs directly for selection corner drawing [float-conversion]

soundclip.cpp:
- change some types [float-conversion]
- add override to destructor [inconsistent-missing-destructor-override]

layercamera.cpp/.h:
- change NULLs to nullptrs [zero-as-null-pointer-constant]
- use qreal for loadImageAtFrame parameters [conversion,double-promotion]

camera.cpp/.h:
- use qreal for rotation and scaling [conversion]
- add override to destructor [inconsistent-missing-destructor-override]

keyframe.h:
- remove semicolons after functions [extra-semi]

filemanager.cpp:
- use static_cast for time_t -> uint conversion [shorten-64-to-32]
- move strings to an anonymous namespace [missing-variable-declarations]
"<li><a href=\"https://github.com/pencil2d/pencil/issues/new\">Github</a></li>"
"<li><a href=\"https://discord.gg/8FxdV2g\">Discord<\a></li>"
"</ul>";
}

This comment has been minimized.

Copy link
@chchwy

chchwy Oct 14, 2018

Member

Is that some kind of new warnings?

This comment has been minimized.

Copy link
@scribblemaniac

scribblemaniac Oct 15, 2018

Author Member

I don't think so. Here's some discussion about the same error: https://www.reddit.com/r/C_Programming/comments/2nkpcq/understanding_clang_wmissingvariabledeclarations/. Basically it sounds like it's to avoid conflicts in the global variable namespace. For example, if two files define contactLinks with different values in the file scope like this, then what should the value be?

I just learned about anonymous namespaces which make the variables only accessible from filemanager.cpp. This seemed like a convenient solution to me. These variables could have also been static members of FileManager, or declared extern in the header file which, from what I understand, does a check to make sure that it is only defined once externally.

@chchwy

This comment has been minimized.

Copy link
Member

chchwy commented Oct 14, 2018

Thanks @scribblemaniac

@chchwy chchwy merged commit 84238d8 into pencil2d:master Oct 14, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.