MantisBT - Zandronum |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0001393 | Zandronum | [All Projects] Bug | public | 2013-07-03 23:55 | 2018-09-30 21:34 |
|
Reporter | skyrimguy | |
Assigned To | Edward-san | |
Priority | low | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | Linux | OS | Debian Sid | OS Version | x86_64 |
Product Version | | |
Target Version | 1.3 | Fixed in Version | 1.3 | |
|
Summary | 0001393: GCC 4.8.1 warnings while compiling Zandronum on Linux |
Description | Here are a few warnings:
/home/ggg/zandronum_build/zandronum/tools/zipdir/zipdir.c:936:8: warning: attempt to free a non-heap
object ‘compbuf’ [-Wfree-nonheap-object]
free(compbuf);
^
/home/ggg/zandronum_build/zandronum/src/d_net.cpp:2652:33: warning: format ‘%d’ expects argument
of type ‘int’, but argument 2 has type ‘ULONG {aka long unsigned int}’ [-Wformat=]
players[i].userinfo.netname);
^
/home/ggg/zandronum_build/zandronum/src/team.cpp:1254:17: warning: converting to non-pointer type ‘ULONG
{aka long unsigned int}’ from NULL [-Wconversion-null]
return ( NULL );
^
/home/ggg/zandronum_build/zandronum/upnpnat/upnpnat.cpp:481:114: warning: format ‘%d’ expects argument
of type ‘int’, but argument 6 has type ‘std::basic_string<char>::size_type {aka long unsigned
int}’ [-Wformat=]
sprintf(buff,HTTP_HEADER_ACTION,pathString,host.c_str(),port,soap_message.size(),service_type.c_str(),ACTION_ADD);
^
/home/ggg/zandronum_build/zandronum/src/d_protocol.cpp:220:43: warning: narrowing conversion of ‘(((unsigned
int)ucmd->usercmd_t::buttons) & 127u)’ from ‘unsigned int’ to ‘BYTE {aka unsigned char}’
inside { } is ill-formed in C++11 [-Wnarrowing]
BYTE bytes[4] = { ucmd->buttons & 0x7F,
^
/home/ggg/zandronum_build/zandronum/src/d_protocol.cpp:223:31: warning: narrowing conversion of ‘((((unsigned
int)ucmd->usercmd_t::buttons) >> 21) & 255u)’ from ‘unsigned int’ to ‘BYTE {aka
unsigned char}’ inside { } is ill-formed in C++11 [-Wnarrowing]
(ucmd->buttons >> 21) & 0xFF };
^
/home/ggg/zandronum_build/zandronum/src/c_console.cpp:665:36: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
for (int j = 0; j < NUMNOTIFIES-1; ++j)
^
/home/ggg/zandronum_build/zandronum/src/c_console.cpp:205:42: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
#define NUMNOTIFIES (NotifyStrings.Size()) // 4
^
/home/ggg/zandronum_build/zandronum/src/w_wad.cpp:794:34: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
for (int i = 0; i < arc->DB.db.NumFiles; ++i)
^
/home/ggg/zandronum_build/zandronum/src/g_game.cpp:4508:36: warning: narrowing conversion of ‘BigLong(35)’
from ‘int’ to ‘DWORD {aka unsigned int}’ inside { } is ill-formed in C++11 [-Wnarrowing]
DWORD time[2] = { BigLong(TICRATE), BigLong(level.time) };
^
/home/ggg/zandronum_build/zandronum/src/g_game.cpp:4508:57: warning: narrowing conversion of ‘BigLong(level.FLevelLocals::time)’
from ‘int’ to ‘DWORD {aka unsigned int}’ inside { } is ill-formed in C++11 [-Wnarrowing]
DWORD time[2] = { BigLong(TICRATE), BigLong(level.time) };
^
/home/ggg/zandronum_build/zandronum/src/gl/gl_portal.cpp:617:54: warning: narrowing conversion of ‘GLPortal::PlaneMirrorMode’
from ‘int’ to ‘double’ inside { } is ill-formed in C++11 [-Wnarrowing]
double d[4]={0, PlaneMirrorMode, 0, TO_GL(origin->d)};
^
/home/ggg/zandronum_build/zandronum/src/r_main.cpp:1233:55: warning: ‘newblend’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
NormalLight.Maps = realcolormaps + NUMCOLORMAPS*256*newblend;
^
/home/ggg/zandronum_build/zandronum/src/gl/gl_light.cpp:447:27: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
gl_EnableFog(fogcolor!=-1);
^
/home/ggg/zandronum_build/zandronum/src/gl/gl_light.cpp:450:19: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
if (fogcolor!=-1)
^
Total Zandronum Linux client compilation warnings: 132
Total Zandronum Linux server compilation warnings: 111 |
Steps To Reproduce | |
Additional Information | |
Tags | No tags attached. |
Relationships | |
Attached Files | GCC481warningsZandronumLinux.zip (50,135) 2013-07-03 23:55 /tracker/file_download.php?file_id=998&type=bug
warningfixes-1.3.diff (9,687) 2014-01-06 17:38 /tracker/file_download.php?file_id=1134&type=bug
warningfixes-2.0.diff (835) 2014-01-06 17:38 /tracker/file_download.php?file_id=1135&type=bug
strict-aliasing-warns.txt (14,841) 2014-01-06 17:40 /tracker/file_download.php?file_id=1136&type=bug
warningfixes-1.3-2.diff (4,915) 2014-04-06 20:41 /tracker/file_download.php?file_id=1192&type=bug
clang_warns.txt (13,356) 2014-06-15 13:44 /tracker/file_download.php?file_id=1227&type=bug
warningfixes-1.3-clang.diff (12,572) 2014-06-22 10:43 /tracker/file_download.php?file_id=1235&type=bug
warningfixes-2.0-clang.diff (12,572) 2014-06-22 10:43 /tracker/file_download.php?file_id=1236&type=bug
scaletext.diff (2,714) 2014-06-22 21:38 /tracker/file_download.php?file_id=1237&type=bug |
|
Issue History |
Date Modified | Username | Field | Change |
2013-07-03 23:55 | skyrimguy | New Issue | |
2013-07-03 23:55 | skyrimguy | File Added: GCC481warningsZandronumLinux.zip | |
2013-07-04 00:46 | skyrimguy | Note Added: 0006565 | |
2013-07-04 18:25 | Torr Samaho | Priority | urgent => low |
2013-07-04 18:25 | Torr Samaho | Severity | major => minor |
2014-01-03 13:41 | Edward-san | Note Added: 0007866 | |
2014-01-03 13:42 | Edward-san | Note Edited: 0007866 | bug_revision_view_page.php?bugnote_id=7866#r4352 |
2014-01-03 13:43 | Edward-san | Assigned To | => Edward-san |
2014-01-03 13:43 | Edward-san | Status | new => assigned |
2014-01-03 13:47 | Edward-san | Note Edited: 0007866 | bug_revision_view_page.php?bugnote_id=7866#r4353 |
2014-01-06 17:38 | Edward-san | File Added: warningfixes-1.3.diff | |
2014-01-06 17:38 | Edward-san | File Added: warningfixes-2.0.diff | |
2014-01-06 17:40 | Edward-san | File Added: strict-aliasing-warns.txt | |
2014-01-06 17:41 | Edward-san | Note Added: 0007898 | |
2014-01-06 17:42 | Edward-san | Note Edited: 0007898 | bug_revision_view_page.php?bugnote_id=7898#r4375 |
2014-01-06 17:43 | Edward-san | Note Edited: 0007898 | bug_revision_view_page.php?bugnote_id=7898#r4376 |
2014-01-06 18:00 | Dusk | Target Version | => 2.0 |
2014-01-06 18:48 | Dusk | Note Added: 0007900 | |
2014-01-10 11:01 | Edward-san | Status | assigned => needs review |
2014-04-06 20:12 | Edward-san | File Added: warningfixes-1.3-2.diff | |
2014-04-06 20:41 | Edward-san | File Deleted: warningfixes-1.3-2.diff | |
2014-04-06 20:41 | Edward-san | File Added: warningfixes-1.3-2.diff | |
2014-04-06 20:42 | Edward-san | Note Added: 0008508 | |
2014-04-06 20:58 | Torr Samaho | Note Added: 0008509 | |
2014-04-07 20:48 | Torr Samaho | Note Added: 0008514 | |
2014-04-07 20:55 | Torr Samaho | Status | needs review => feedback |
2014-06-08 00:20 | Edward-san | Note Added: 0008890 | |
2014-06-08 00:20 | Edward-san | Resolution | open => suspended |
2014-06-08 00:22 | Edward-san | Status | feedback => acknowledged |
2014-06-15 13:43 | Edward-san | Note Added: 0009371 | |
2014-06-15 13:43 | Edward-san | Resolution | suspended => open |
2014-06-15 13:44 | Edward-san | File Added: clang_warns.txt | |
2014-06-15 13:45 | Edward-san | Note Edited: 0009371 | bug_revision_view_page.php?bugnote_id=9371#r4981 |
2014-06-15 13:46 | Edward-san | Note Edited: 0009371 | bug_revision_view_page.php?bugnote_id=9371#r4982 |
2014-06-15 14:13 | Watermelon | Status | acknowledged => assigned |
2014-06-22 10:43 | Edward-san | File Added: warningfixes-1.3-clang.diff | |
2014-06-22 10:43 | Edward-san | File Added: warningfixes-2.0-clang.diff | |
2014-06-22 10:44 | Edward-san | Note Added: 0009647 | |
2014-06-22 10:44 | Edward-san | Status | assigned => needs review |
2014-06-22 21:38 | Edward-san | File Added: scaletext.diff | |
2014-06-22 21:40 | Edward-san | Note Added: 0009683 | |
2014-06-28 19:58 | Edward-san | Note Edited: 0009683 | bug_revision_view_page.php?bugnote_id=9683#r5225 |
2014-06-28 19:58 | Edward-san | Note Edited: 0009683 | bug_revision_view_page.php?bugnote_id=9683#r5226 |
2014-06-28 19:59 | Edward-san | Note Edited: 0009683 | bug_revision_view_page.php?bugnote_id=9683#r5227 |
2014-06-28 19:59 | Edward-san | Note Edited: 0009683 | bug_revision_view_page.php?bugnote_id=9683#r5228 |
2014-10-27 10:05 | Edward-san | Note Added: 0010703 | |
2014-10-27 10:05 | Edward-san | Status | needs review => resolved |
2014-10-27 10:05 | Edward-san | Fixed in Version | => 1.3 |
2014-10-27 10:05 | Edward-san | Resolution | open => fixed |
2014-10-27 10:06 | Edward-san | Target Version | 2.0 => 1.3 |
2018-09-30 21:34 | Blzut3 | Status | resolved => closed |
Notes |
|
|
I forgot to mention, this is while compiling Zandronum 1.1-alpha-r130630-2011 and compilation is successful. |
|
|
(0007866)
|
Edward-san
|
2014-01-03 13:41
(edited on: 2014-01-03 13:47) |
|
Working on this, with reference to zandronum 1.3 beta and zandronum 2.0 beta. Keep in mind that the warnings which are from gzdoom are ignored, hence also the ones which are from sources different from src/ and upnpnat/ are ignored.
|
|
|
(0007898)
|
Edward-san
|
2014-01-06 17:41
(edited on: 2014-01-06 17:43) |
|
Some of the warnings are fixed and the fixes are attached as patches for 1.3 and 2.0 (2.0 contains only the fixes which are not present in 1.3, the 1.3 patch can be merged in 2.0).
The other warnings are the following kind:
1)some are inherited from gzdoom and can't be fixed without messing the codebase update schedule;
2)some are false positives, like the -Wmaybe-uninitialized warnings
3)some others can be fixed, like the -Wunused-result warnings, but I leave to Torr's opinion, because these ones are not fixed in zdoom
4)the -Wstrict-aliasing warnings, attached as the txt file here, are the hard part which I have no idea: for example, in src/p_mobj.cpp, line 348:
arc << ... << (DWORD &)lNetID // [BC] We need to archive this so that it's restored properly when going between maps in a hub.
gcc reports:
warning: dereferencing type-punned pointer will break strict-aliasing rules
is it false positive? if not, is it there another way to achieve what Carn wanted without breaking strict aliasing rule?
One peculiar thing I noticed is that zdoom codebase has no such strict-aliasing violation...
|
|
|
(0007900)
|
Dusk
|
2014-01-06 18:48
|
|
Quote
[19:51:53] <Dusk> edward-san, i think FArchive needs an operator<< overload for ULONG
[19:52:05] <Dusk> then you can get rid of the type punning
[19:52:32] <Dusk> (if it were up to me though i'd just make these variables just be int)
[20:00:17] <edward-san> interestingly, there's SWAP_* which is used in operator<<
[20:00:43] <edward-san> since ULONG can be unsigned int (in wine... :\)
[20:00:48] <edward-san> ...
[20:34:16] <Dusk> who plays zandronum with wine today :P
[20:34:35] <Dusk> i think it's a mere relic from the days when skulltag was closed source
[20:34:38] <Dusk> we should probably drop it
|
|
|
|
|
|
|
I added the new 1.3 patch. |
|
|
|
I also added your 2.0 patch. |
|
|
|
Ok, now the only problem is the FArchive type punning thing. I'll suspend this for now. |
|
|
(0009371)
|
Edward-san
|
2014-06-15 13:43
(edited on: 2014-06-15 13:46) |
|
Let me add clang warnings to the wheel (I changed my local copy to allow clang to compile)!
Posting them asap.
[edit] Done, removed the (g)zdoom codebase warnings while at it.
|
|
|
|
Uploaded the fixes to clang warnings for 1.3 and 2.0. |
|
|
(0009683)
|
Edward-san
|
2014-06-22 21:40
(edited on: 2014-06-28 19:59) |
|
I made a patch which sets con_scaletext back to Int (was set to Bool in the old source), as it caused a warning in gcc I noticed just now. Do you know something about the reason for that, Torr?
Also, I'd like to discuss about the other portions of patches which were not merged in the 'stable' repository.
|
|
|
|
I'll continue the GCC/Clang warnings history in a new ticket. This has done enough for the time being. |
|