Changes between Version 3 and Version 19 of Ticket #5294


Ignore:
Timestamp:
Dec 18, 2020, 1:11:44 AM (3 years ago)
Author:
Stan
Comment:

Most of the warnings were fixed, only those remain now

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5294

    • Property Keywords simple removed
    • Property PatchPhab:D2055, Phab:D2099, Phab:D2102, Phab:D2153
  • Ticket #5294 – Description

    v3 v19  
    11When I compile 0ad with gcc 8.1.0, I get the following warnings:
    22{{{
    3 In file included from ../../../source/simulation2/helpers/Pathfinding.h:26,
    4                  from ../../../source/simulation2/helpers/LongPathfinder.h:21,
    5                  from ../../../source/simulation2/helpers/LongPathfinder.cpp:20:
    6 ../../../source/simulation2/helpers/Grid.h: In instantiation of ‘T* SparseGrid<T>::GetBucket(int, int) [with T = PathfindTile]’:
    7 ../../../source/simulation2/helpers/Grid.h:238:10:   required from ‘T& SparseGrid<T>::get(int, int) [with T = PathfindTile]’
    8 ../../../source/simulation2/helpers/LongPathfinder.cpp:406:41:   required from here
    9 ../../../source/simulation2/helpers/Grid.h:194:10: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct PathfindTile’; use assignment or value-initialization instead [-Wclass-memaccess]
    10     memset(m_Data[b], 0, BucketSize*BucketSize*sizeof(T));
    11     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    12 In file included from ../../../source/simulation2/helpers/LongPathfinder.cpp:20:
    13 ../../../source/simulation2/helpers/LongPathfinder.h:63:8: note: ‘struct PathfindTile’ declared here
    14  struct PathfindTile
    15         ^~~~~~~~~~~~
    16 ====================================================================================================================================================================================
    17 
    18 ../../../source/ps/ModIo.cpp: In member function ‘void ModIo::StartDownloadMod(size_t)’:
    19 ../../../source/ps/ModIo.cpp:321:82: warning: ‘new’ of type ‘DownloadCallbackData’ with extended alignment 64 [-Waligned-new=]
    20   m_CallbackData = new DownloadCallbackData(sys_OpenFile(m_DownloadFilePath, "wb"));
    21                                                                                   ^
    22 ../../../source/ps/ModIo.cpp:321:82: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
    23 ../../../source/ps/ModIo.cpp:321:82: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
    24 
    25 ====================================================================================================================================================================================
    26 
    27 In file included from /usr/include/string.h:635,
    28                  from /usr/include/c++/8/cstring:42,
    29                  from /usr/include/boost/filesystem/path.hpp:36,
    30                  from /usr/include/boost/filesystem.hpp:16,
    31                  from ../../../source/lib/pch/pch_boost.h:57,
    32                  from ../../../source/lib/precompiled.h:76,
    33                  from ../../../source/pch/engine/precompiled.h:18:
    34 In function ‘void* memcpy(void*, const void*, size_t)’,
    35     inlined from ‘void rewriteBuffer(u8*, u32&)’ at ../../../source/ps/Profiler2.cpp:564:10:
    36 /usr/include/x86_64-linux-gnu/bits/string3.h:53:33: warning: ‘void* __builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)’ forming offset [257, 4294967295] is out of the bounds [0, 256] of object ‘message’ with type ‘char [256]’ [-Warray-bounds]
    37    return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
    38           ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    39 ../../../source/ps/Profiler2.cpp: In function ‘void rewriteBuffer(u8*, u32&)’:
    40 ../../../source/ps/Profiler2.cpp:563:9: note: ‘message’ declared here
    41     char message[CProfiler2::MAX_ATTRIBUTE_LENGTH] = {0};
    42          ^~~~~~~
    43 
    443====================================================================================================================================================================================
    454
     
    7837====================================================================================================================================================================================
    7938
    80      if (start_thread(ctx, (mg_thread_func_t) worker_thread, ctx) != 0) {
    81 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp: In function ‘std::__cxx11::wstring fromXmlChar(const xmlChar*)’:
    82 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:96:31: warning: this statement may fall through [-Wimplicit-fallthrough=]
    83    case 5: ch += *source++; ch <<= 6;
    84                             ~~~^~~~~
    85 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:97:3: note: here
    86    case 4: ch += *source++; ch <<= 6;
    87    ^~~~
    88 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:97:31: warning: this statement may fall through [-Wimplicit-fallthrough=]
    89    case 4: ch += *source++; ch <<= 6;
    90                             ~~~^~~~~
    91 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:98:3: note: here
    92    case 3: ch += *source++; ch <<= 6;
    93    ^~~~
    94 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:98:31: warning: this statement may fall through [-Wimplicit-fallthrough=]
    95    case 3: ch += *source++; ch <<= 6;
    96                             ~~~^~~~~
    97 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:99:3: note: here
    98    case 2: ch += *source++; ch <<= 6;
    99    ^~~~
    100 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:99:31: warning: this statement may fall through [-Wimplicit-fallthrough=]
    101    case 2: ch += *source++; ch <<= 6;
    102                             ~~~^~~~~
    103 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:100:3: note: here
    104    case 1: ch += *source++; ch <<= 6;
    105    ^~~~
    106 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:100:31: warning: this statement may fall through [-Wimplicit-fallthrough=]
    107    case 1: ch += *source++; ch <<= 6;
    108                             ~~~^~~~~
    109 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:101:3: note: here
    110    case 0: ch += *source++;
    111    ^~~~
    112 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp: In constructor ‘toXmlChar::toXmlChar(const wstring&)’:
    113 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:67:49: warning: this statement may fall through [-Wimplicit-fallthrough=]
    114     case 4: *--target = ((ch | 0x80) & 0xBF); ch >>= 6;
    115                                               ~~~^~~~~
    116 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:68:4: note: here
    117     case 3: *--target = ((ch | 0x80) & 0xBF); ch >>= 6;
    118     ^~~~
    119 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:68:49: warning: this statement may fall through [-Wimplicit-fallthrough=]
    120     case 3: *--target = ((ch | 0x80) & 0xBF); ch >>= 6;
    121                                               ~~~^~~~~
    122 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:69:4: note: here
    123     case 2: *--target = ((ch | 0x80) & 0xBF); ch >>= 6;
    124     ^~~~
    125 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:69:49: warning: this statement may fall through [-Wimplicit-fallthrough=]
    126     case 2: *--target = ((ch | 0x80) & 0xBF); ch >>= 6;
    127                                               ~~~^~~~~
    128 ../../../source/tools/atlas/AtlasObject/AtlasObjectXML.cpp:70:4: note: here
    129     case 1: *--target = (char)(ch | firstByteMark[bytesToWrite]);
    130     ^~~~
    131 
    132 ====================================================================================================================================================================================
    133 
    134 In file included from ../../../source/lib/res/graphics/tests/test_tex.cpp:17:
    135 /path/to/0ad/source/lib/res/graphics/tests/test_tex.h: In member function ‘void TestTex::generate_encode_decode_compare(size_t, size_t, size_t, size_t, const OsPath&)’:
    136 /path/to/0ad/source/lib/res/graphics/tests/test_tex.h:49:27: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct Tex’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
    137     memset(&t, 0, sizeof(t));
    138                            ^
    139 In file included from /path/to/0ad/source/lib/res/graphics/tests/test_tex.h:25,
    140                  from ../../../source/lib/res/graphics/tests/test_tex.cpp:17:
    141 ../../../source/lib/tex/tex.h:209:8: note: ‘struct Tex’ declared here
    142  struct Tex
    143         ^~~
    144 
    145 ====================================================================================================================================================================================
    146 
    147 In file included from ../../../source/lib/self_test.h:38,
    148                  from ../../../source/pch/test/precompiled.h:24:
    149 /path/to/0ad/source/simulation2/tests/test_Serializer.h: In member function ‘void TestSerializer::test_bounds()’:
    150 /path/to/0ad/source/simulation2/tests/test_Serializer.h:286:59: warning: catching polymorphic type ‘class PSERROR_Serialize_OutOfBounds’ by value [-Wcatch-value=]
    151    TS_ASSERT_THROWS(serialize.NumberI32("x", 17, -16, 16), PSERROR_Serialize_OutOfBounds);
    152                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    153 /path/to/0ad/source/simulation2/tests/test_Serializer.h:287:60: warning: catching polymorphic type ‘class PSERROR_Serialize_OutOfBounds’ by value [-Wcatch-value=]
    154    TS_ASSERT_THROWS(serialize.NumberI32("x", -17, -16, 16), PSERROR_Serialize_OutOfBounds);
    155                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    156 /path/to/0ad/source/simulation2/tests/test_Serializer.h: In member function ‘void TestSerializer::test_script_exceptions()’:
    157 /path/to/0ad/source/simulation2/tests/test_Serializer.h:769:57: warning: catching polymorphic type ‘class PSERROR_Serialize_InvalidScriptValue’ by value [-Wcatch-value=]
    158    TS_ASSERT_THROWS(serialize.ScriptVal("script", &obj), PSERROR_Serialize_InvalidScriptValue);
    159 
    160 ====================================================================================================================================================================================
    161 
    162 In file included from /usr/include/string.h:494,
    163                  from /usr/include/c++/9.1.0/cstring:42,
    164                  from /usr/local/include/boost/system/error_code.hpp:20,
    165                  from /usr/local/include/boost/filesystem/path_traits.hpp:22,
    166                  from /usr/local/include/boost/filesystem/path.hpp:26,
    167                  from /usr/local/include/boost/filesystem.hpp:16,
    168                  from ../../../source/lib/pch/pch_boost.h:57,
    169                  from ../../../source/lib/precompiled.h:76,
    170                  from ../../../source/pch/engine/precompiled.h:18,
    171                  from ../../../source/ps/FileIo.cpp:22:
    172 In function ‘char* strncpy(char*, const char*, size_t)’,
    173     inlined from ‘CFilePacker::CFilePacker(u32, const char*)’ at ../../../source/ps/FileIo.cpp:50:9:
    174 /usr/include/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 4 equals destination size [-Wstringop-truncation]
    175   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
    176       |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    177 
    178 
    17939}}}