After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 363438 - Abbreviated struct initialization breaks with Solaris forte compiler
Abbreviated struct initialization breaks with Solaris forte compiler
Status: RESOLVED FIXED
Product: gnome-games-superseded
Classification: Deprecated
Component: general
2.17.x
Other Solaris
: Normal normal
: ---
Assigned To: GNOME Games maintainers
GNOME Games maintainers
Depends on:
Blocks:
 
 
Reported: 2006-10-19 15:30 UTC by Damien Carbery
Modified: 2006-11-07 15:31 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
Expand struct initialization as described in bug report. (402 bytes, patch)
2006-10-19 15:31 UTC, Damien Carbery
none Details | Review
Fix struct init issues in dependencies/ggzmod-ggz/ggzmod-ggz.c (811 bytes, patch)
2006-10-23 15:53 UTC, Damien Carbery
none Details | Review
More stuct init issues corrected. (4.31 KB, patch)
2006-10-23 16:14 UTC, Damien Carbery
none Details | Review

Description Damien Carbery 2006-10-19 15:30:34 UTC
gnome-games-2.17.1/dependencies/libggz/numberlist.c in ggz_numberlist_new():
GGZNumberList list = {values: 0, min: -1, max: -1};
breaks with the Solaris forte (Sun Studio 11) compiler.
Fix is to expand this to 4 lines:

      GGZNumberList list;
      list.values = 0;
      list.min = -1;
      list.max = -1;

Attached patch does this.
Comment 1 Damien Carbery 2006-10-19 15:31:46 UTC
Created attachment 75020 [details] [review]
Expand struct initialization as described in bug report.
Comment 2 Damien Carbery 2006-10-23 15:53:49 UTC
Created attachment 75247 [details] [review]
Fix struct init issues in dependencies/ggzmod-ggz/ggzmod-ggz.c

dependencies/ggzmod-ggz/ggzmod-ggz.c has similar issues to dependencies/libggz/numberlist.c so attaching this patch to this bug instead of opening a new one.
Comment 3 Damien Carbery 2006-10-23 16:14:52 UTC
Created attachment 75249 [details] [review]
More stuct init issues corrected.

This patch includes more struct init issues that break the Solaris build. It also includes one instance where a void function was returning a value (ggzcore_game_set_server_fd in dependencies/ggzcore/game.c) where I simply removed 'return'.
Comment 4 Andreas Røsdal 2006-11-04 22:39:13 UTC
Thanks for the patches, they are now in CVS.

Please let me know if there are any other problems with using the Sun forte compiler.
Comment 5 Damien Carbery 2006-11-07 08:25:27 UTC
I just found out that the forte compiler supports "designated initializers":
  GGZNumberList list = {.values= 0, .min= -1, .max= -1};
So, if you would prefer a compact initialization style, you can use the '.' plus '=' format. Apologies for not knowing this earlier.
Comment 6 Damien Carbery 2006-11-07 15:31:58 UTC
BTW, the "designated initializers" change in comment #5 is a C99 feature, not a Solaris specific one so it will be safe for all modern compilers.