Menu

#256 clang thinks some || perhaps should be | instead in the source.

Probably Fixed
closed
nobody
None
5
2017-06-08
2017-06-05
No
combat.c:225:42: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
                    (PFLAG_IGNOREHAZARDS || PFLAG_IGNOREBEINGS
                                         ^  ~~~~~~~~~~~~~~~~~~
combat.c:225:42: note: use '|' for a bitwise operation
                    (PFLAG_IGNOREHAZARDS || PFLAG_IGNOREBEINGS
                                         ^~
                                         |
combat.c:238:52: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
                if (current & (PFLAG_IGNOREHAZARDS || PFLAG_IGNOREFIELDS))
                                                   ^  ~~~~~~~~~~~~~~~~~~
combat.c:238:52: note: use '|' for a bitwise operation
                if (current & (PFLAG_IGNOREHAZARDS || PFLAG_IGNOREFIELDS))
                                                   ^~
                                                   |
4 warnings generated.

and also a bunch of warnings like this:

In file included from common.c:25:
./player.h:106:7: warning: 'PlayerParty::distributeMembers' hides overloaded virtual function [-Woverloaded-virtual]
        void distributeMembers(struct place *new_place, int new_x, int new_y,
             ^
./Party.h:55:15: note: hidden overloaded virtual function 'Party::distributeMembers' declared here: different number of parameters (0 vs 5)
        virtual void distributeMembers();
                     ^
In file included from terrain_editor.c:25:
./cursor.h:34:15: warning: 'Cursor::relocate' hides overloaded virtual function [-Woverloaded-virtual]
        virtual void relocate(struct place *newplace, int newx, int newy,
                     ^
./Object.h:196:15: note: hidden overloaded virtual function 'Object::relocate' declared here: type mismatch at 4th parameter ('int' vs 'bool')
        virtual void relocate(struct place *newplace, int newx, int newy, int flags = 0, struct closure *place_switch_hook = NULL);
                     ^

..but I don't C++ enough to know if its bad or not.

Related

Bugs: #256

Discussion

  • Gordon McNutt

    Gordon McNutt - 2017-06-07

    I think it's right about the ||. Will confirm and look at the others.

    ----- Original Message -----

    From: "Janne Johansson" icepic@users.sf.net
    To: "Ticket 256" 256@bugs.nazghul.p.re.sf.net
    Sent: Monday, June 5, 2017 6:49:23 AM
    Subject: [nazghul:bugs] #256 clang thinks some || perhaps should be | instead in the source.

    [bugs:#256] clang thinks some || perhaps should be | instead in the source.

    Status: open
    Group: Probably Fixed
    Created: Mon Jun 05, 2017 12:49 PM UTC by Janne Johansson
    Last Updated: Mon Jun 05, 2017 12:49 PM UTC
    Owner: nobody
    combat.c:225:42: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
    (PFLAG_IGNOREHAZARDS || PFLAG_IGNOREBEINGS
    ^ ~~~~~~~~~~~~~~~~~~
    combat.c:225:42: note: use '|' for a bitwise operation
    (PFLAG_IGNOREHAZARDS || PFLAG_IGNOREBEINGS
    ^~
    |
    combat.c:238:52: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
    if (current & (PFLAG_IGNOREHAZARDS || PFLAG_IGNOREFIELDS))
    ^ ~~~~~~~~~~~~~~~~~~
    combat.c:238:52: note: use '|' for a bitwise operation
    if (current & (PFLAG_IGNOREHAZARDS || PFLAG_IGNOREFIELDS))
    ^~
    |
    4 warnings generated.

    and also a bunch of warnings like this:
    In file included from common . c : 25 : . / player . h : 106 : 7 : warning : 'PlayerParty::distributeMembers' hides overloaded virtual function [ -Woverloaded-virtual ] void distributeMembers ( struct place * new_place , int new_x , int new_y , ^ . / Party . h : 55 : 15 : note : hidden overloaded virtual function 'Party::distributeMembers' declared here : different number of parameters ( 0 vs 5 ) virtual void distributeMembers (); ^ In file included from terrain_editor . c : 25 : . / cursor . h : 34 : 15 : warning : 'Cursor::relocate' hides overloaded virtual function [ -Woverloaded-virtual ] virtual void relocate ( struct place * newplace , int newx , int newy , ^ . / Object . h : 196 : 15 : note : hidden overloaded virtual function 'Object::relocate' declared here : type mismatch at 4 th parameter ( 'int' vs 'bool' ) virtual void relocate ( struct place * newplace , int newx , int newy , int flags = 0 , struct closure * place_switch_hook = NULL ); ^

    ..but I don't C++ enough to know if its bad or not.

    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/nazghul/bugs/256/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

     

    Related

    Bugs: #256

  • Gordon McNutt

    Gordon McNutt - 2017-06-08
    • status: open --> closed
     
  • Gordon McNutt

    Gordon McNutt - 2017-06-08

    Fixed with ed73752 and 0cc63e9.

     

Log in to post a comment.