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

Comments

@DorpsGek
Copy link

@DorpsGek DorpsGek commented Apr 28, 2014

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

This comment has been minimized.

Copy link
Author

@DorpsGek DorpsGek commented Apr 28, 2014

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

This comment has been minimized.

Copy link
Author

@DorpsGek 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

This comment has been minimized.

Copy link
Author

@DorpsGek DorpsGek commented May 11, 2014

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
@PeterN

This comment has been minimized.

Copy link
Member

@PeterN PeterN commented Mar 31, 2019

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

@PeterN PeterN closed this Mar 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.