Opened 9 years ago

Closed 9 years ago

Last modified 13 months ago

#5706 closed defect (wontfix)

Compiler warning in commandLine.cpp

Reported by: SF/ezekiel000 Owned by: fingolfin
Priority: normal Component: --Other--
Keywords: build Cc:
Game:

Description

If the --enable-release configure option is set then this warning appears when processing commandLine.cpp:
C++ base/commandLine.o
base/commandLine.cpp: In function ‘Common::String Base::parseCommandLine(Common::StringMap&, int, const char* const*)’:
base/commandLine.cpp:368:4: warning: ignoring return value of ‘long int strtol(const char*, char**, int)’, declared with attribute warn_unused_result
base/commandLine.cpp:380:4: warning: ignoring return value of ‘long int strtol(const char*, char**, int)’, declared with attribute warn_unused_result
base/commandLine.cpp:392:4: warning: ignoring return value of ‘long int strtol(const char*, char**, int)’, declared with attribute warn_unused_result
base/commandLine.cpp:412:4: warning: ignoring return value of ‘long int strtol(const char*, char**, int)’, declared with attribute warn_unused_result
base/commandLine.cpp:415:4: warning: ignoring return value of ‘long int strtol(const char*, char**, int)’, declared with attribute warn_unused_result
base/commandLine.cpp:418:4: warning: ignoring return value of ‘long int strtol(const char*, char**, int)’, declared with attribute warn_unused_result
base/commandLine.cpp:427:4: warning: ignoring return value of ‘long int strtol(const char*, char**, int)’, declared with attribute warn_unused_result
base/commandLine.cpp:489:4: warning: ignoring return value of ‘long int strtol(const char*, char**, int)’, declared with attribute warn_unused_result
base/commandLine.cpp:514:4: warning: ignoring return value of ‘long int strtol(const char*, char**, int)’, declared with attribute warn_unused_result
base/commandLine.cpp:517:4: warning: ignoring return value of ‘long int strtol(const char*, char**, int)’, declared with attribute warn_unused_result

Ticket imported from: #3304475. Ticket imported from: bugs/5706.

Change History (4)

comment:1 by fingolfin, 9 years ago

Owner: set to fingolfin
Resolution: wontfix
Status: newclosed

comment:2 by fingolfin, 9 years ago

We intentionally ignore the return value of strtol in that place, so this compiler warning is misleading. You don't mention what compiler you are using, nor what operating system / SDK, so I have no idea how to even reproduce this; hence I can't even attempt to silence it.

But feel free to experiment with non-obtrusive ways to silence the warning (e.g. maybe replacing "strtol" by "(void)strtol" does it); if you find any, we will consider including it.

Closing.

comment:3 by SF/ezekiel000, 9 years ago

Sorry I compile on Ubuntu 11.04 amd64, compiler GCC 4.5.

comment:4 by digitall, 13 months ago

Component: --Other--
Note: See TracTickets for help on using tickets.