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

                 Summary: strict aliasing and warnings
                 Project: Freeciv
            Submitted by: akfaew
            Submitted on: Thursday 07/29/2010 at 20:13
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 
         Discussion Lock: Any
        Operating System: None
         Planned Release: 

    _______________________________________________________

Details:

freeciv should be compiled with -fno-strict-aliasing. There exist portions of
code in which pointers of different type refer to the same memory location.
This seems to be forbidden in C99. Optionally, modifications such as this can
be made to suppress warnings:

-        if (entry_int_get(pentry, (int *) &saved_state)) {
+        if (entry_int_get(pentry, (int *) (void *) &saved_state)) {

I have no idea what consequences this might have.

Please have a look at the attached patch, which eliminates some warnings, not
only caused by strict aliasing. (--enable-debug=yes causes warnings to be
treated as errors)

 client/tilespec.c          |    5 +++--
 common/generate_packets.py |    4 ++--
 server/ruleset.c           |   10 +++++-----
 server/savegame.c          |    6 +++---
 server/savegame2.c         |   17 +++++++++++------
 server/settings.c          |    4 ++--
 utility/log.c              |    2 +-
 utility/support.c          |   16 ++++++++--------
 8 files changed, 35 insertions(+), 29 deletions(-)

Also, packets_gen.c and packets_gen.h are not removed by make distclean.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thursday 07/29/2010 at 20:13  Name: warnings.patch  Size: 11kB   By:
akfaew

<http://gna.org/bugs/download.php?file_id=9625>

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


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

Reply via email to