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 missing declarations #30739

Merged
merged 2 commits into from
May 22, 2019

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: None

Purpose of change

Mark functions static when they are local to a single file. This has various advantages:

  • Clarity for devs.
  • Allows you to know when they are unused and can be deleted.
  • Helps the optimizer make better choices.
  • Smaller export tables in binaries.

Describe the solution

Mark functions with no prior declarations as static, and remove the unused ones. 17 functions deleted, by my count.

Additional context

This can be enforced with -Wmissing-declarations (that's how I found all of these), but I'm not turning on that warning in this PR, because the chances are high that more functions like this are being added, and it would start triggering warnings before it was merged. Will be easier to do that separately along with any (relatively minor) cleanup due to recent changes.

Mark functions with no prior declarations as static, and remove the
unused ones.
@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels May 21, 2019
@ZhilkinSerg
Copy link
Contributor

Great! That is one of the things I wanted to do long time ago, but didn't for no reasons.

@ZhilkinSerg ZhilkinSerg self-assigned this May 21, 2019
@kevingranade
Copy link
Member

On mingw builds:

src/debug.cpp:469:13: error: 'bool debug_is_safe_string(const char*, const char*)' defined but not used [-Werror=unused-function]
 static bool debug_is_safe_string( const char *start, const char *finish )
             ^

Put it inside !WIN32 since it's only used there.
@kevingranade kevingranade merged commit f3049e5 into CleverRaven:master May 22, 2019
@jbytheway jbytheway deleted the fix_missing_declarations branch May 22, 2019 18:21
Mooses2k added a commit to Mooses2k/Cataclysm-DDA that referenced this pull request May 23, 2019
mlangsdorf suggestion on saving ally_rule

remove redunancy

comma

mlangsdorf suggested scope fix

rules.

This makes it work, but text is backwards

fixes so lines up with text in dialogue
CHANGES THE DEFAULT FOLLOW DISTANCE TO 2

Rock as a spare part

Switch build configurations away from trusty

For clang-4 we use the Trusty source on Xenial.

For clang-5 that trick doesn't work, so we retain the Trusty host.

Fix coverage CXXFLAGS code

This was setting CXXFLAGS and LDFLAGS, when it should have been
appending to them.  Without this, Travis builds will fail because they
can't disable warnings on old compilers.

Improve .travis.yml comments

Try trimming down build somewhat

Add clang-7, clang-8 Travis builds

Disable clang-6 and -7 builds on PRs

Don't install unnecessary 32-bit libraries

These two Travis builds were installing 32-bit libraries, for which
there should be no need.

add fire barrels

Update data/json/recipes/recipe_others.json

update per review

Co-Authored-By: Alexey Mostovoy <amurkin1988@yandex.ru>

Update data/json/recipes/recipe_others.json

update per review

Co-Authored-By: Alexey Mostovoy <amurkin1988@yandex.ru>

Update furniture.json

update per review

Update furniture.json

Add description to furniture.json

Update data/json/furniture.json

Co-Authored-By: matskuman5 <selinmatias5@gmail.com>

Update data/json/items/tool/deployable.json

Co-Authored-By: matskuman5 <selinmatias5@gmail.com>

Update data/json/furniture.json

Co-Authored-By: matskuman5 <selinmatias5@gmail.com>

Update data/json/items/tool/deployable.json

Co-Authored-By: matskuman5 <selinmatias5@gmail.com>

avatar::memorial

moved memorial out of player into the new avatar class

added NPC text

Fix missing declarations (CleverRaven#30739)

* Fix missing declarations
Mark functions with no prior declarations as static, and remove the
unused ones.
* Move debug_is_safe_string definition
Put it inside !WIN32 since it's only used there.

fixed typo in NR-031 description

typo!

acorn_roasted: remove duplicate entry for itype acorn_roasted

There are two acorn_roasted entries in this file. The one removed is
defined prior to the itype it copies from (acorns). The remaining entry
is immediately following the definition of acorns, and can be loaded
without being deferred.

Change to variable name and logic requested by mlangsdorf

Avoid undefined shift

Avoid uninitialized value in jmapgen_int

NOLINT undefined shifts in legacy hash code

Enable clang-analyzer-core.UndefinedBinaryOperatorResult

Have fixed all warnings for this check.

Remove legacy hash code

This was only present in the tests, contained undefined behaviour, and
was obsolete.

Add a --user-dir option to the tests

This gives control over where the tests write files, which allows
parallel test runs to be performed without stepping on each other's
toes.

Use separate user_dir for modded tests

Now the tests can run in parallel, have one of them write to a different
location to avoid failures due to filesystem race conditions.

Changed weight and volume values to be more realistic.

Fixed silly JSON error.

Linted JSON.

Added empty newline at the end of the file to satisfy the JSON linting gods.

Move hydroponics mod folders out of a subfolder

Replaced battery spawn with full pocket batteries

Moved Brawling martial art autolearn code to json

Logic that determines if a martial arts style is learned each turn is controlled by json instead of hardcoded.

Astyle typo fixes

Update MARTIALART_JSON.md

Saving some future person a bunch of time

Add clean water to makeshift steam engine recipe

Allows the player to use clean water to make makeshift steam engines.

Fix copy-from for overmap specials

Restore minimap enemy blink/fade functionality (CleverRaven#30745)

* start conditional panel update infrastructure

* Revert "Remove unnecessary `draw_panels()` calls"

This reverts commit 2db3b84.

* Revert "Only draw panels on first entry into game::get_player_input()"

This reverts commit d629d93.

* commit include file change

* preserve panel spacing (so minimap draws in right location)

* comments are fun.

* adjust draw_panels invocations to force redraw when appropriate

* cleanup of things that shouldn't have been reverted

Fixes cell phone and talking doll weirdness (CleverRaven#30742)

* Added charged phone group.

* Removed initial_charges from cell phone

* Began the work

Added a proper item template to everyone who needs a charged cell phone starting out. This is gonna suck...

* First pass on professions.json

* Fixed professions.json

* Fixed the mods too!

* Removed initial_charges from creepy_doll and talking_doll

* Update data/json/professions.json

Co-Authored-By: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>

* Update data/json/professions.json

Co-Authored-By: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>

* Modified home_mechanic to have a charged phone

They didn't really need it, but I did it for consistency.

Game report: add precise version and name for systems. (CleverRaven#30729)

* Add precise versions for Windows systems.

* Add Android system version retrieval.

* Simplify formatting for Windows version.

* Add Linux system version.

* make operating_system_version() return '<unknown>' if the version can't be determined.

- Invert condition on Linux version function;

* Simplify Android version retrieval.

* Extract shell execution function.

- will be reused by Linux, Mac and BSD.

* Add MacOS system version.

* Sort methods alphabetically.

* Add BSD version retrieval.

* Fix structure init. Fix error in macos function.

* Fix typo in output...

Robot salvage system (CleverRaven#30456)

* nervous sytem modules
* motor system
* structural system
* tank tread
* ai core
* more AI cores
* Uncraft Robots
* gun fix
* uncraft nursebot
* uncraft turret
* inactive turrets recipe
* manhack recipe
* uncraft hazmatbot
* Add schematics for bots
* schematics item group
* item_groups fro schematics
* recipe for every bot
* uncraft modules
* add self_monitoring_module to nurse and cleaner bots
* Damage overflow from a robot is transfered to its corpse
* sane crafting time
* flavor on robot death
* can't repair broken robot items
* electronics is used skill, mechanics is required

mall miscellanious files

pallet, overmap_terrain, item_groups, multitile_city_buildings entries

2nd story, roof enhancements

Adds 2nd story and more work on the roof

move item_group

per feedback

Add AT4 (CleverRaven#30734)

* Added AT4 to guns_launcher_rocket itemgroup
* Add AT4

disp_name and skin_name

stomach and guts

Fix some typos in uninstall bionic (CleverRaven#30763)

* fix uninstall typos
@ZhilkinSerg ZhilkinSerg removed their assignment May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants