URL:
  <http://gna.org/bugs/?15908>

                 Summary: Warning in ai/advdiplomacy.c (case label value is
less than minimum value for type)
                 Project: Freeciv
            Submitted by: englabenny
            Submitted on: söndag 2010-04-18 den 22:57
                Category: ai
                Severity: 2 - Minor
                Priority: 1 - Later
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 2.2, trunk
         Discussion Lock: Any
        Operating System: None
         Planned Release: 

    _______________________________________________________

Details:

There is a warning in 2.2 branch and trunk in ai/advdiplomacy.c


libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../utility -I./../common
-I./../server -I../common/aicore -I../server/generator
-DLOCALEDIR=\"/usr/local/share/locale\"
"-DDEFAULT_DATA_PATH=\".:data:~/.freeciv/2.3:/usr/local/share/freeciv\""
-DDEFAULT_SAVES_PATH=\"\"
"-DDEFAULT_SCENARIO_PATH=\".:data/scenario:~/.freeciv/scenarios:/usr/local/share/freeciv/scenario\""
-Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations
-Werror -g -O2 -MT advdiplomacy.lo -MD -MP -MF .deps/advdiplomacy.Tpo -c
advdiplomacy.c -o advdiplomacy.o
cc1: warnings being treated as errors
advdiplomacy.c: In function ‘ai_diplomacy_actions’:
advdiplomacy.c:1610: error: case label value is less than minimum value for
type
advdiplomacy.c:1617: error: case label value is less than minimum value for
type
make: *** [advdiplomacy.lo] Fel 1


The warning comes from a switch over a char variable:

switch (adip->ally_patience--) {

the cases for -1 and -2 emit warnings.

If I understand correctly, the minimum value for char is -128, so the warning
could be incorrect. Casting the switch variable to int removes the warning.

gcc version 4.4.3 20100108 (prerelease) (Debian 4.4.2-9)




    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?15908>

_______________________________________________
  Meddelandet skickades via/av Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to