Make functions static, ensure declarations match headers #610
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch used
-Wmissing-declarations
to show functions and symbols that had no declarations, and either make them static or declare in headers.This helps avoid possibility that declarations and functions get out of sync. (which can cause hard to track down crashes which may only happen on some configurations)
And ensures all source files reference headers correctly.
This ensures functions declared in
extern "C"
, do so in the header too.An error found in
calligraph.h
while writing this patch.It helps with refactoring code, when its obvious that functions are only ever used locally, theres no need to double check if they're called from other files, or forget to and cause bugs.
The compiler may also do a better job optimizing the code it knows isn't used elsewhere (inline static calls, fold branches when called with constant arguments).
This has been applied to
toonzlib
, to avoid making very large global changes.If accepted, other modules could have similar changes made and
-Wmissing-declarations
added to CMake.