sirjuddington / SLADE

It's a Doom editor
https://slade.mancubus.net
GNU General Public License v2.0
709 stars 109 forks source link

Clang compiler warnings when building Linux build #226

Closed edward-san closed 7 years ago

edward-san commented 9 years ago

Hi. I got these warnings when I compile slade:

1)

/home/edward-san/zdoom/slade/src/SImageFormats.cpp:487:19: warning: taking the absolute value of unsigned type 'const uint8_t' (aka 'const unsigned char') has no effect [-Wabsolute-value]
        width = ofs[5] + abs(ofs[3]);
                         ^

Was that call needed because the value should be in the [0,127] range? Since ofs is unsigned char, its value is in the [0,255] range, and when converted to int, the range is not touched, so abs will return in the [0, 255] range.

2)

/home/edward-san/zdoom/slade/src/CIEDeltaEquations.cpp:156:7: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
                if (abs(hp1 - hp2) > PI)
                    ^

/home/edward-san/zdoom/slade/src/MathStuff.cpp:440:6: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
        if (abs(dx) > 0.0000001)
            ^

/home/edward-san/zdoom/slade/src/MapEditor.cpp:2896:17: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
        double width = abs(point.x - origin.x);
                       ^

/home/edward-san/zdoom/slade/src/MapEditor.cpp:2897:18: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
        double height = abs(point.y - origin.y);
                        ^

The function abs has parameter int and returns int, so the argument in these calls will be converted to int and hence lose the decimals, therefore the returned value can't have the lost decimals. You can use std::abs or fabs.

3)

/home/edward-san/zdoom/slade/src/DirArchive.cpp:314:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]
                else
                ^

The macro LOG_MESSAGE contains an if and no else, hence the else here is referred to the condition Global::log_verbosity >= level, therefore files_written.push_back(path); would be executed when the condition !entries[a]->exportFile(path) is true... very dangerous.

4)

/home/edward-san/zdoom/slade/src/Conversions.cpp:494:61: warning: '&&' within '||' [-Wlogical-op-parentheses]
        if (mc.getSize() < 22 || mc.getSize() > 29 || (mc[12] != 1 && mc[12] != 5 || mc[mc.getSize()-1] != 0))
                                                       ~~~~~~~~~~~~^~~~~~~~~~~~~~ ~~

/home/edward-san/zdoom/slade/src/LineTextureOverlay.cpp:414:31: warning: '&&' within '||' [-Wlogical-op-parentheses]
        if (key == "F" || key == "f" && side1)
                       ~~ ~~~~~~~~~~~^~~~~~~~

/home/edward-san/zdoom/slade/src/LineTextureOverlay.cpp:418:31: warning: '&&' within '||' [-Wlogical-op-parentheses]
        if (key == "B" || key == "b" && side2)
                       ~~ ~~~~~~~~~~~^~~~~~~~

/home/edward-san/zdoom/slade/src/MapCanvas.cpp:1242:23: warning: '&&' within '||' [-Wlogical-op-parentheses]
        if (!overlayActive() && mouse_state == MSTATE_NORMAL || mouse_state == MSTATE_TAG_SECTORS || mouse_state == MSTATE_TAG_THINGS)
            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~

/home/edward-san/zdoom/slade/src/MapCanvas.cpp:1662:23: warning: '&&' within '||' [-Wlogical-op-parentheses]
                        if (diff_scale < 0 && view_scale_inter < view_scale ||
                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~

/home/edward-san/zdoom/slade/src/MapCanvas.cpp:1663:27: warning: '&&' within '||' [-Wlogical-op-parentheses]
                                diff_scale > 0 && view_scale_inter > view_scale)
                                ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/edward-san/zdoom/slade/src/MapCanvas.cpp:1688:23: warning: '&&' within '||' [-Wlogical-op-parentheses]
                                if (diff_xoff < 0 && view_xoff_inter < view_xoff ||
                                    ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~

/home/edward-san/zdoom/slade/src/MapCanvas.cpp:1689:27: warning: '&&' within '||' [-Wlogical-op-parentheses]
                                        diff_xoff > 0 && view_xoff_inter > view_xoff)
                                        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/edward-san/zdoom/slade/src/MapCanvas.cpp:1704:23: warning: '&&' within '||' [-Wlogical-op-parentheses]
                                if (diff_yoff < 0 && view_yoff_inter < view_yoff ||
                                    ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~

/home/edward-san/zdoom/slade/src/MapCanvas.cpp:1705:27: warning: '&&' within '||' [-Wlogical-op-parentheses]
                                        diff_yoff > 0 && view_yoff_inter > view_yoff)
                                        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/edward-san/zdoom/slade/src/MapEditorConfigDialog.cpp:89:42: warning: '&&' within '||' [-Wlogical-op-parentheses]
                if (theGameConfiguration->anyMapName() &&
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

/home/edward-san/zdoom/slade/src/./AudioFormats.h:378:56: warning: '&&' within '||' [-Wlogical-op-parentheses]
                        if ((samples == (mc.getSize() - 28) && samples > 4) &&
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

/home/edward-san/zdoom/slade/src/./AudioFormats.h:430:68: warning: '&&' within '||' [-Wlogical-op-parentheses]
                if (mc[0] != 'R' || mc[1] != 'I' || mc[2] != 'F' || mc[3] != 'F' &&
                                                                 ~~ ~~~~~~~~~~~~~^~

/home/edward-san/zdoom/slade/src/./AudioFormats.h:431:74: warning: '&&' within '||' [-Wlogical-op-parentheses]
                        mc[8] != 'W' || mc[9] != 'A' || mc[10] != 'V' || mc[11] != 'E' &&
                                                                      ~~ ~~~~~~~~~~~~~~^~

/home/edward-san/zdoom/slade/src/MapEditor.cpp:910:41: warning: '&&' within '||' [-Wlogical-op-parentheses]
                                        needs_tag == AS_TT_SECTOR_AND_BACK && tag > 0)
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~

/home/edward-san/zdoom/slade/src/MapRenderer2D.cpp:984:23: warning: '&&' within '||' [-Wlogical-op-parentheses]
                        if (tt->isAngled() && showicon || thing_force_dir || things_angles)
                            ~~~~~~~~~~~~~~~^~~~~~~~~~~ ~~

/home/edward-san/zdoom/slade/src/MapRenderer2D.cpp:1792:14: warning: '&&' within '||' [-Wlogical-op-parentheses]
        if (texture && tex_flats.size() < map->nSectors() || last_flat_type != type)
            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~

/home/edward-san/zdoom/slade/src/MapRenderer2D.cpp:1911:14: warning: '&&' within '||' [-Wlogical-op-parentheses]
        if (texture && tex_flats.size() != map->nSectors() || last_flat_type != type)
            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~

It's not clear which logic order should have these mixed conditions, so the parentheses are needed, in order to clarify if || must be checked before or after && (for example, I'm sure that if (key == "F" || key == "f" && side1) can be written as if ((key == "F" || key == "f") && side1), because key must be case insensitive).

5)

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:151:19: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant A, 2<B0> Observer", "Illuminant A, 10<B0> Observer",
                                ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:151:49: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant A, 2<B0> Observer", "Illuminant A, 10<B0> Observer",
                                                                 ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:152:19: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant C, 2<B0> Observer", "Illuminant C, 10<B0> Observer",
                                ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:152:49: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant C, 2<B0> Observer", "Illuminant C, 10<B0> Observer",
                                                                 ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:153:21: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D50, 2<B0> Observer", "Illuminant D50, 10<B0> Observer",
                                  ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:153:53: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D50, 2<B0> Observer", "Illuminant D50, 10<B0> Observer",
                                                                     ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:154:21: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D60, 2<B0> Observer", "Illuminant D60, 10<B0> Observer",
                                  ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:154:53: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D60, 2<B0> Observer", "Illuminant D60, 10<B0> Observer",
                                                                     ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:155:21: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D65, 2<B0> Observer", "Illuminant D65, 10<B0> Observer",
                                  ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:155:53: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D65, 2<B0> Observer", "Illuminant D65, 10<B0> Observer",
                                                                     ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:156:21: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D75, 2<B0> Observer", "Illuminant D75, 10<B0> Observer",
                                  ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:156:53: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D75, 2<B0> Observer", "Illuminant D75, 10<B0> Observer",
                                                                     ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:157:20: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant F2, 2<B0> Observer", "Illuminant F2, 10<B0> Observer",
                                 ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:157:51: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant F2, 2<B0> Observer", "Illuminant F2, 10<B0> Observer",
                                                                   ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:158:21: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant TL4, 2<B0> Observer", "Illuminant TL4, 10<B0> Observer",
                                  ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:158:53: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant TL4, 2<B0> Observer", "Illuminant TL4, 10<B0> Observer",
                                                                     ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:159:24: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant UL3000, 2<B0> Observer", "Illuminant UL3000, 10<B0> Observer",
                                     ^~~~

/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:159:59: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant UL3000, 2<B0> Observer", "Illuminant UL3000, 10<B0> Observer",
                                                                           ^~~~

Since the file in question is encoded in ISO-8859, ° is not a valid character inside a string, hence when I open the menu Graphics->Colorimetry, the CIE Lab Tristimulus option has invisible string values. Replacing any instance of ° with \xc2\xb0 in these strings and enclosing them in wxString::FromUTF8() fixes the problem for me.

6)

/home/edward-san/zdoom/slade/src/MapLine.cpp:307:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
                if (vertex = parent_map->getVertex(value))
                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/edward-san/zdoom/slade/src/MapLine.cpp:317:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
                if (vertex = parent_map->getVertex(value))
                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/edward-san/zdoom/slade/src/MapLine.cpp:329:13: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
                if (side1 = parent_map->getSide(value))
                    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/edward-san/zdoom/slade/src/MapLine.cpp:334:13: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
                if (side2 = parent_map->getSide(value))
                    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you assign something and this must be NULL checked, enclose the assignment in another parenthesis.

7)

/home/edward-san/zdoom/slade/src/ActionSpecialDialog.cpp:803:7: warning: expression result unused [-Wunused-value]
                                                trigger_mid;
                                                ^~~~~~~~~~~

No idea why this was written like that. Maybe it's really unused and hence it needs (void)?

8)

/home/edward-san/zdoom/slade/src/./TextureXPanel.h:19:7: warning: 'TextureXListView::updateItemAttr' hides overloaded virtual function [-Woverloaded-virtual]
        void    updateItemAttr(long item) const;
                ^
/home/edward-san/zdoom/slade/src/./VirtualListView.h:27:15: note: hidden overloaded virtual function 'VirtualListView::updateItemAttr' declared here: different number of parameters (2 vs 1)
        virtual void    updateItemAttr(long item, long column) const {}
                        ^

/home/edward-san/zdoom/slade/src/./PatchTablePanel.h:18:7: warning: 'PatchTableListView::updateItemAttr' hides overloaded virtual function [-Woverloaded-virtual]
        void    updateItemAttr(long item) const;
                ^
/home/edward-san/zdoom/slade/src/./VirtualListView.h:27:15: note: hidden overloaded virtual function 'VirtualListView::updateItemAttr' declared here: different number of parameters (2 vs 1)
        virtual void    updateItemAttr(long item, long column) const {}
                        ^

/home/edward-san/zdoom/slade/src/./ArchiveEntryList.h:52:7: warning: 'ArchiveEntryList::updateList' hides overloaded virtual function [-Woverloaded-virtual]
        void    updateList();
                ^
/home/edward-san/zdoom/slade/src/./VirtualListView.h:60:15: note: hidden overloaded virtual function 'VirtualListView::updateList' declared here: different number of parameters (1 vs 0)
        virtual void    updateList(bool clear = false) { SetItemCount(0); }
                        ^

/home/edward-san/zdoom/slade/src/./UndoManagerHistoryPanel.h:19:7: warning: 'UndoListView::getItemIcon' hides overloaded virtual function [-Woverloaded-virtual]
        int             getItemIcon(long item) const;
                        ^
/home/edward-san/zdoom/slade/src/./VirtualListView.h:26:15: note: hidden overloaded virtual function 'VirtualListView::getItemIcon' declared here: different number of parameters (2 vs 1)
        virtual int             getItemIcon(long item, long column) const { return -1; }
                                ^

/home/edward-san/zdoom/slade/src/./UndoManagerHistoryPanel.h:20:7: warning: 'UndoListView::updateItemAttr' hides overloaded virtual function [-Woverloaded-virtual]
        void    updateItemAttr(long item) const;
                ^
/home/edward-san/zdoom/slade/src/./VirtualListView.h:27:15: note: hidden overloaded virtual function 'VirtualListView::updateItemAttr' declared here: different number of parameters (2 vs 1)
        virtual void    updateItemAttr(long item, long column) const {}
                        ^

Apparently these functions are similar to some virtual functions in some base classes for their name, but it's not clear if these were intended to override them or not, because of the mismatching number of parameters.

9)

/home/edward-san/zdoom/slade/src/./Args.h:20:40: warning: field 'name' will be initialized after field 'value' [-Wreorder]
        arg_val_t(wxString name, int value) : name(name), value(value) {}
                                              ^

This can be fixed by swapping name and value member definitions inside the arg_val_t class.

10)

/home/edward-san/zdoom/slade/src/SFont.cpp:204:28: warning: array subscript is of type 'char' [-Wchar-subscripts]
        SFontChar* ch = characters[c];
                                  ^~
/home/edward-san/zdoom/slade/src/SFont.cpp:238:29: warning: array subscript is of type 'char' [-Wchar-subscripts]
                SFontChar* ch = characters[CHR(str)[a]];
                                          ^~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/SFont.cpp:259:29: warning: array subscript is of type 'char' [-Wchar-subscripts]
                SFontChar* ch = characters[CHR(str)[a]];
                                          ^~~~~~~~~~~~

That sounds like a big mistake, because a char can be negative in suitable platforms, hence there's a potential read of garbage data before the array region.

edward-san commented 9 years ago

Yeah, now the left warnings are these:

/home/edward-san/zdoom/slade/src/SImageFormats.cpp:487:19: warning: taking the absolute value of unsigned type 'const uint8_t' (aka 'const unsigned char') has no effect [-Wabsolute-value]
        width = ofs[5] + abs(ofs[3]);
                         ^
/home/edward-san/zdoom/slade/src/SImageFormats.cpp:487:19: note: remove the call to 'abs' since unsigned values cannot be negative
        width = ofs[5] + abs(ofs[3]);
                         ^~~
1 warning generated.
/home/edward-san/zdoom/slade/src/Conversions.cpp:494:61: warning: '&&' within '||' [-Wlogical-op-parentheses]
        if (mc.getSize() < 22 || mc.getSize() > 29 || (mc[12] != 1 && mc[12] != 5 || mc[mc.getSize()-1] != 0))
                                                       ~~~~~~~~~~~~^~~~~~~~~~~~~~ ~~
/home/edward-san/zdoom/slade/src/Conversions.cpp:494:61: note: place parentheses around the '&&' expression to silence this warning
        if (mc.getSize() < 22 || mc.getSize() > 29 || (mc[12] != 1 && mc[12] != 5 || mc[mc.getSize()-1] != 0))
                                                                   ^
                                                       (                         )
1 warning generated.
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:151:19: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant A, 2<B0> Observer", "Illuminant A, 10<B0> Observer",
                                ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:151:49: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant A, 2<B0> Observer", "Illuminant A, 10<B0> Observer",
                                                                 ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:152:19: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant C, 2<B0> Observer", "Illuminant C, 10<B0> Observer",
                                ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:152:49: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant C, 2<B0> Observer", "Illuminant C, 10<B0> Observer",
                                                                 ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:153:21: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D50, 2<B0> Observer", "Illuminant D50, 10<B0> Observer",
                                  ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:153:53: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D50, 2<B0> Observer", "Illuminant D50, 10<B0> Observer",
                                                                     ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:154:21: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D60, 2<B0> Observer", "Illuminant D60, 10<B0> Observer",
                                  ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:154:53: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D60, 2<B0> Observer", "Illuminant D60, 10<B0> Observer",
                                                                     ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:155:21: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D65, 2<B0> Observer", "Illuminant D65, 10<B0> Observer",
                                  ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:155:53: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D65, 2<B0> Observer", "Illuminant D65, 10<B0> Observer",
                                                                     ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:156:21: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D75, 2<B0> Observer", "Illuminant D75, 10<B0> Observer",
                                  ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:156:53: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant D75, 2<B0> Observer", "Illuminant D75, 10<B0> Observer",
                                                                     ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:157:20: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant F2, 2<B0> Observer", "Illuminant F2, 10<B0> Observer",
                                 ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:157:51: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant F2, 2<B0> Observer", "Illuminant F2, 10<B0> Observer",
                                                                   ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:158:21: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant TL4, 2<B0> Observer", "Illuminant TL4, 10<B0> Observer",
                                  ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:158:53: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant TL4, 2<B0> Observer", "Illuminant TL4, 10<B0> Observer",
                                                                     ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:159:24: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant UL3000, 2<B0> Observer", "Illuminant UL3000, 10<B0> Observer",
                                     ^~~~
/home/edward-san/zdoom/slade/src/Dialogs/Preferences/ColorimetryPrefsPanel.cpp:159:59: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
                "Illuminant UL3000, 2<B0> Observer", "Illuminant UL3000, 10<B0> Observer",
                                                                           ^~~~

though there are some other warnings which got out with -Wall and -Wextra I'd like to show ASAP.

sirjuddington commented 9 years ago

Ok all but one should be fixed now, and that one is Gez's (i think) code, I'm not sure what the logic there is specifically meant to be so I'm leaving it for now

edward-san commented 9 years ago

Other warnings with more options:

/home/edward-san/zdoom/slade/src/zreaders/files.cpp:48:39: warning: field 'CloseOnDestruct' will be initialized after field 'Status' [-Wreorder]
: File(NULL), Length(0), StartPos(0), CloseOnDestruct(false), Status(0), Message("OK")
                                      ^
/home/edward-san/zdoom/slade/src/zreaders/files.cpp:53:37: warning: field 'CloseOnDestruct' will be initialized after field 'Status' [-Wreorder]
: File(other.File), Length(length), CloseOnDestruct(false), Status(other.Status), Message(other.Message)
                                    ^
/home/edward-san/zdoom/slade/src/zreaders/files.cpp:59:51: warning: field 'CloseOnDestruct' will be initialized after field 'Status' [-Wreorder]
: File(NULL), Length(0), StartPos(0), FilePos(0), CloseOnDestruct(false), Status(0), Message("OK")
                                                  ^
/home/edward-san/zdoom/slade/src/zreaders/files.cpp:69:51: warning: field 'CloseOnDestruct' will be initialized after field 'Status' [-Wreorder]
: File(file), Length(0), StartPos(0), FilePos(0), CloseOnDestruct(false), Status(0), Message("OK")
                                                  ^
/home/edward-san/zdoom/slade/src/zreaders/files.cpp:75:31: warning: field 'CloseOnDestruct' will be initialized after field 'Status' [-Wreorder]
: File(file), Length(length), CloseOnDestruct(true), Status(0), Message("OK")
                              ^
/home/edward-san/zdoom/slade/src/zreaders/files.cpp:360:48: warning: explicitly assigning value of variable of type 'void *' to itself [-Wself-assign]
static void *SzAlloc(void *p, size_t size) { p = p; return malloc(size); }
                                             ~ ^ ~
/home/edward-san/zdoom/slade/src/zreaders/files.cpp:361:48: warning: explicitly assigning value of variable of type 'void *' to itself [-Wself-assign]
static void SzFree(void *p, void *address) { p = p; free(address); }
                                             ~ ^ ~
/home/edward-san/zdoom/slade/src/MapCanvas.cpp:1938:4: warning: delete called on 'MCAnimation' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                        delete animations[a];
                        ^
/home/edward-san/zdoom/slade/src/MapCanvas.cpp:2408:25: warning: delete called on 'MCOverlay' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                        if (overlay_current) delete overlay_current;
                                             ^
/home/edward-san/zdoom/slade/src/MapCanvas.cpp:3136:27: warning: delete called on 'MCOverlay' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                                        if (overlay_current) delete overlay_current;
                                                             ^
/home/edward-san/zdoom/slade/src/MapCanvas.cpp:3306:25: warning: delete called on 'MCOverlay' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                        if (overlay_current) delete overlay_current;
                                             ^
/home/edward-san/zdoom/slade/src/MapCanvas.cpp:3601:25: warning: delete called on 'MCOverlay' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                        if (overlay_current) delete overlay_current;
                                             ^
/home/edward-san/zdoom/slade/src/CTexture.cpp:428:3: warning: delete called on 'CTPatch' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                delete patches[a];
                ^
/home/edward-san/zdoom/slade/src/CTexture.cpp:548:3: warning: delete called on 'CTPatch' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                delete patches[a];
                ^
/home/edward-san/zdoom/slade/src/CTexture.cpp:590:2: warning: delete called on 'CTPatch' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
        delete patches[index];
        ^
/home/edward-san/zdoom/slade/src/CTexture.cpp:615:4: warning: delete called on 'CTPatch' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                        delete (*i);
                        ^
/home/edward-san/zdoom/slade/src/CTexture.cpp:892:3: warning: delete called on 'CTPatch' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                delete patches[a];
                ^
/home/edward-san/zdoom/slade/src/CTexture.cpp:925:3: warning: delete called on 'CTPatch' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                delete patches[a];
                ^
/home/edward-san/zdoom/slade/src/BrowserWindow.cpp:73:3: warning: delete called on 'BrowserItem' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                delete items[a];
                ^
/home/edward-san/zdoom/slade/src/Translation.cpp:59:3: warning: delete called on 'TransRange' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                delete translations[a];
                ^
/home/edward-san/zdoom/slade/src/Translation.cpp:286:3: warning: delete called on 'TransRange' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                delete translations[a];
                ^
/home/edward-san/zdoom/slade/src/Translation.cpp:359:2: warning: delete called on 'TransRange' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
        delete translations[pos];
        ^
/home/edward-san/zdoom/slade/src/EntryOperations.cpp:624:23: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                alph_chunk_t gc = { 'a', 'l', 'P', 'h' };
                                    ^~~~~~~~~~~~~~~~~~
                                    {                 }
/home/edward-san/zdoom/slade/src/EntryOperations.cpp:747:24: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                trans_chunk_t gc = { 't', 'R', 'N', 'S', '\0' };
                                     ^~~~~~~~~~~~~~~~~~~~~~~~
                                     {                       }
/home/edward-san/zdoom/slade/src/BrowserCanvas.cpp:512:15: warning: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Wsign-compare]
                if (++index == items_filter.size() && !looped)
                    ~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~
1 warning generated.
/home/edward-san/zdoom/slade/src/SImageFormats.cpp:236:11: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
        if (size < sizeof(Font2Header))
            ~~~~ ^ ~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/Conversions.cpp:689:33: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
                ((READ_B32(in, 4) + 8) != size))
                  ~~~~~~~~~~~~~~~~~~~  ^  ~~~~
/home/edward-san/zdoom/slade/src/GameConfiguration.cpp:1195:29: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
                                        if (flags_line[f].flag == flag_val)
                                            ~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~
/home/edward-san/zdoom/slade/src/TarArchive.cpp:178:41: warning: comparison of integers of different signs: 'int32_t' (aka 'int') and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
        return (checksum == sigsum || checksum == unssum);
                                      ~~~~~~~~ ^  ~~~~~~
/home/edward-san/zdoom/slade/src/./AudioFormats.h:177:35: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
                                ((READ_B32(mc, 4) + 8) == mc.getSize()))
                                  ~~~~~~~~~~~~~~~~~~~  ^  ~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/./AudioFormats.h:409:21: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
                        if (mc.getSize() == 4 + READ_L16(mc, 2))
                            ~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/./ImageFormats.h:47:25: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
                                if (READ_L32(mc, 2) == mc.getSize() && READ_L32(mc, 6) == 0)
                                    ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/./ImageFormats.h:1300:47: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
                if ((4 + (READ_L16(mc, 0)*READ_L16(mc, 2))) != mc.getSize())
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^  ~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/./ImageFormats.h:1380:27: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
                                        if (READ_L32(mc, 44) != size - 32)
                                            ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~
/home/edward-san/zdoom/slade/src/ArchiveManager.cpp:860:12: warning: comparison of integers of different signs: 'unsigned int' and 'int' [-Wsign-compare]
        if (index == base_resource)
            ~~~~~ ^  ~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/DatArchive.cpp:722:12: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'wxFileOffset' (aka 'long') [-Wsign-compare]
        if (start > file.Length())
            ~~~~~ ^ ~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/DatArchive.cpp:729:27: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'wxFileOffset' (aka 'long') [-Wsign-compare]
        for (size_t i = start; i < file.Length(); ++i, ++len)
                               ~ ^ ~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/Misc.cpp:681:13: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
        if (offset != 4 * numtex + 4)
            ~~~~~~ ^  ~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/TextureXEditor.cpp:623:44: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (index < tabs->GetPageCount() && index != tabs->GetSelection())
                                            ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/ArchivePanel.cpp:651:30: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
                && (name.find('\\') != wxNOT_FOUND || name.find('/') != wxNOT_FOUND))
                    ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/ArchivePanel.cpp:651:63: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
                && (name.find('\\') != wxNOT_FOUND || name.find('/') != wxNOT_FOUND))
                                                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/MapEditor.cpp:3674:68: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
                                if (selection_3d[s].type == item.type && selection_3d[s].index == osector->getIndex())
                                                                         ~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/MapEditor.cpp:4032:27: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
                if (walls_done[a].index == side->getIndex())
                    ~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/SToolBar.cpp:697:21: warning: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Wsign-compare]
        else if (e.GetId() == groups.size())
                 ~~~~~~~~~ ^  ~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/./SIFOther.h:280:22: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
                if (data.getSize() != width * height + SCWALLOFFSET)
                    ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/./SIFOther.h:690:22: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
                if (data.getSize() != 4 + info.width*info.height)
                    ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/./SIFRott.h:321:22: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
                if (data.getSize() != 4 + info.width*info.height)
                    ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/SIFormat.cpp:271:30: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
                        if (valid_flat_size[a][0] == width && valid_flat_size[a][1] == height
                            ~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~
/home/edward-san/zdoom/slade/src/SIFormat.cpp:271:64: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
                        if (valid_flat_size[a][0] == width && valid_flat_size[a][1] == height
                                                              ~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~
/home/edward-san/zdoom/slade/src/SIFormat.cpp:440:25: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
                        if (image.getWidth() == valid_flat_size[a][0] &&
                            ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/SIFormat.cpp:441:30: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
                                image.getHeight() == valid_flat_size[a][1])
                                ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/EntryOperations.cpp:1558:11: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
                if (crc != READ_B32(data, pointer + 8 + chsz))
                    ~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/UndoRedo.cpp:290:26: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
        if (current_level_index == undo_levels.size() - 1 || undo_levels.size() == 0)
            ~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/WadArchive.cpp:722:44: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (name.length() <= 8 && name.find('\\') != wxNOT_FOUND)
                                  ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/EntryType.cpp:218:25: warning: comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'value_type' (aka 'int') [-Wsign-compare]
                        if (entry->getSize() == match_size[a])
                            ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~
/home/edward-san/zdoom/slade/src/MapRenderer2D.cpp:213:44: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (list_vertices > 0 && map->nVertices() == n_vertices && map->geometryUpdated() <= vertices_updated)
                                 ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~
/home/edward-san/zdoom/slade/src/MapRenderer2D.cpp:242:44: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (vbo_vertices == 0 || map->nVertices() != n_vertices || map->geometryUpdated() > vertices_updated)
                                 ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~
/home/edward-san/zdoom/slade/src/MapRenderer2D.cpp:396:17: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
                map->nLines() == n_lines &&
                ~~~~~~~~~~~~~ ^  ~~~~~~~
/home/edward-san/zdoom/slade/src/MapRenderer2D.cpp:464:17: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
                map->nLines() != n_lines ||
                ~~~~~~~~~~~~~ ^  ~~~~~~~
/home/edward-san/zdoom/slade/src/GZipArchive.cpp:522:40: warning: comparison of integers of different signs: 'wxFileOffset' (aka 'long') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
        if (!file.IsOpened() || file.Length() < mds)
                                ~~~~~~~~~~~~~ ^ ~~~
/home/edward-san/zdoom/slade/src/TextureXPanel.cpp:709:20: warning: comparison of integers of different signs: 'value_type' (aka 'long') and 'unsigned long' [-Wsign-compare]
                if (selection[i] != itr->second)
                    ~~~~~~~~~~~~ ^  ~~~~~~~~~~~