Zandronum Chat on our Discord Server Get the latest version: 3.1
Source Code

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001393Zandronum[All Projects] Bugpublic2013-07-03 23:552018-09-30 21:34
Reporterskyrimguy 
Assigned ToEdward-san 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSDebian SidOS Versionx86_64
Product Version 
Target Version1.3Fixed in Version1.3 
Summary0001393: GCC 4.8.1 warnings while compiling Zandronum on Linux
DescriptionHere 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
Attached Fileszip file icon GCC481warningsZandronumLinux.zip [^] (50,135 bytes) 2013-07-03 23:55
diff file icon warningfixes-1.3.diff [^] (9,687 bytes) 2014-01-06 17:38 [Show Content]
diff file icon warningfixes-2.0.diff [^] (835 bytes) 2014-01-06 17:38 [Show Content]
txt file icon strict-aliasing-warns.txt [^] (14,841 bytes) 2014-01-06 17:40 [Show Content]
diff file icon warningfixes-1.3-2.diff [^] (4,915 bytes) 2014-04-06 20:41 [Show Content]
txt file icon clang_warns.txt [^] (13,356 bytes) 2014-06-15 13:44 [Show Content]
diff file icon warningfixes-1.3-clang.diff [^] (12,572 bytes) 2014-06-22 10:43 [Show Content]
diff file icon warningfixes-2.0-clang.diff [^] (12,572 bytes) 2014-06-22 10:43 [Show Content]
diff file icon scaletext.diff [^] (2,714 bytes) 2014-06-22 21:38 [Show Content]

- Relationships

-  Notes
User avatar (0006565)
skyrimguy (reporter)
2013-07-04 00:46

I forgot to mention, this is while compiling Zandronum 1.1-alpha-r130630-2011 and compilation is successful.
User avatar (0007866)
Edward-san (developer)
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.

User avatar (0007898)
Edward-san (developer)
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...

User avatar (0007900)
Dusk (developer)
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
User avatar (0008508)
Edward-san (developer)
2014-04-06 20:42

Final changes available.
User avatar (0008509)
Torr Samaho (administrator)
2014-04-06 20:58

I added the new 1.3 patch.
User avatar (0008514)
Torr Samaho (administrator)
2014-04-07 20:48

I also added your 2.0 patch.
User avatar (0008890)
Edward-san (developer)
2014-06-08 00:20

Ok, now the only problem is the FArchive type punning thing. I'll suspend this for now.
User avatar (0009371)
Edward-san (developer)
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.

User avatar (0009647)
Edward-san (developer)
2014-06-22 10:44

Uploaded the fixes to clang warnings for 1.3 and 2.0.
User avatar (0009683)
Edward-san (developer)
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.

User avatar (0010703)
Edward-san (developer)
2014-10-27 10:05

I'll continue the GCC/Clang warnings history in a new ticket. This has done enough for the time being.

Issue Community Support
This issue is already marked as resolved.
If you feel that is not the case, please reopen it and explain why.
Supporters: No one explicitly supports this issue yet.
Opponents: No one explicitly opposes this issue yet.

- 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 View Revisions
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 View Revisions
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 View Revisions
2014-01-06 17:43 Edward-san Note Edited: 0007898 View Revisions
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 View Revisions
2014-06-15 13:46 Edward-san Note Edited: 0009371 View Revisions
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 View Revisions
2014-06-28 19:58 Edward-san Note Edited: 0009683 View Revisions
2014-06-28 19:59 Edward-san Note Edited: 0009683 View Revisions
2014-06-28 19:59 Edward-san Note Edited: 0009683 View Revisions
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






Questions or other issues? Contact Us.

Links


Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker