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

Compile warnings with --enable-lto #5999

Closed
DorpsGek opened this issue Apr 28, 2014 · 4 comments
Closed

Compile warnings with --enable-lto #5999

DorpsGek opened this issue Apr 28, 2014 · 4 comments
Labels
bug Something isn't working flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) good first issue Good for newcomers

Comments

@DorpsGek
Copy link
Member

flherne opened the ticket and wrote:

When compiling after ./configure --enable-lto, gcc 4.9 produces several compile warnings; without lto enabled there are none reported.
All of them look like false positives to me, but I don't understand the code very well. :P

/home/flh/projects/ottd/trunk/src/table/build_industry.h:1585:31: warning: ‘_origin_industry_tile_specs’ defined but not used [-Wunused-variable]
static const IndustryTileSpec _origin_industry_tile_specs[NEW_INDUSTRYTILEOFFSET] = {

/home/flh/projects/ottd/trunk/src/saveload/../table/townname.h:1840:29: warning: ‘_name_czech_subst_stem’ defined but not used [-Wunused-variable]
static const CzechNameSubst _name_czech_subst_stem[] = {

/home/flh/projects/ottd/trunk/src/saveload/../table/townname.h:1893:29: warning: ‘_name_czech_subst_ending’ defined but not used [-Wunused-variable]
static const CzechNameSubst _name_czech_subst_ending[] = {

/home/flh/projects/ottd/trunk/src/table/palettes.h:17:22: warning: ‘_palette’ defined but not used [-Wunused-variable]
static const Palette _palette = {
^
/home/flh/projects/ottd/trunk/src/table/palettes.h:117:33: warning: ‘_extra_palette_values’ defined but not used [-Wunused-variable]
static const ExtraPaletteValues _extra_palette_values = {

/home/flh/projects/ottd/trunk/src/strings.cpp: In function ‘SetDParamMaxDigits’:
/home/flh/projects/ottd/trunk/src/strings.cpp:123:35: warning: ‘next’ may be used uninitialized in this function [-Wmaybe-uninitialized]
uint64 val = count > 1 ? front : next;

/home/flh/projects/ottd/trunk/src/strings.cpp:123:35: warning: ‘front’ may be used uninitialized in this function [-Wmaybe-uninitialized]
uint64 val = count > 1 ? front : next;

/home/flh/projects/ottd/trunk/src/vehicle_cmd.cpp: In function ‘CmdBuildVehicle’:
/home/flh/projects/ottd/trunk/src/core/overflowsafe_type.hpp:36:70: warning: ‘v’ may be used uninitialized in this function [-Wmaybe-uninitialized]
inline OverflowSafeInt& operator = (const OverflowSafeInt& other) { this->m_value = other.m_value; return *this; }

Reported version: trunk
Operating system: Linux


This issue was imported from FlySpray: https://bugs.openttd.org/task/5999
@DorpsGek
Copy link
Member Author

frosch wrote:

This seems to be caused by static tables in includes which are included by multiple files, but only used in some.
Solution is likely to split the table files to only contain one table per file.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5999#comment13262

@DorpsGek
Copy link
Member Author

DorpsGek commented May 3, 2014

Alberth wrote:

"defined but not used" would be harmless, as frosch already said.

I checked the warnings in strings.cpp and vehicle_cmd.cpp, and all three are false positives.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5999#comment13280

@DorpsGek
Copy link
Member Author

Rubidium wrote:

Technically many of these table header files should only be included in one cpp file, but sometimes it's included in multiple just to get e.g. a length of one of the data arrays.

It could be solved, but right now it's only a minor inconvenience of having these warnings shown. Regardless, it should be fixed some time.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5999#comment13314

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) labels Apr 7, 2018
@TrueBrain TrueBrain added good first issue Good for newcomers bug Something isn't working and removed bug from FlySpray labels Apr 10, 2018
@frosch123 frosch123 removed the Core label Apr 14, 2018
@andythenorth andythenorth added the stale Stale issues label Jan 5, 2019
@TrueBrain TrueBrain removed the stale Stale issues label Jan 24, 2019
@PeterN
Copy link
Member

PeterN commented Mar 31, 2019

Meanwhile, there are currently no errors compiling with --enable-lto, so closing this.

@PeterN PeterN closed this as completed Mar 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants